Fixed divide by zero problem in cvStereoRectify (thanks to Philip Van Valkenberg) #2099

pull/2/head
Andrey Kamaev 13 years ago
parent f09ae32796
commit 6c3137a8b5
  1. 3
      modules/calib3d/src/calibration.cpp

@ -2366,7 +2366,8 @@ void cvStereoRectify( const CvMat* _cameraMatrix1, const CvMat* _cameraMatrix2,
// calculate global Z rotation
cvCrossProduct(&t,&uu,&ww);
double nw = cvNorm(&ww, 0, CV_L2);
cvConvertScale(&ww, &ww, acos(fabs(c)/nt)/nw);
if (nw > 0.0)
cvConvertScale(&ww, &ww, acos(fabs(c)/nt)/nw);
cvRodrigues2(&ww, &wR);
// apply to both views

Loading…
Cancel
Save