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

This commit is contained in:
Andrey Kamaev 2012-06-27 15:15:32 +00:00
parent f09ae32796
commit 6c3137a8b5

View File

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