4242
4343/*
4444 * Implementation of the paper Shape Matching and Object Recognition Using Shape Contexts
45- * Belongie et al., 2002 by Juan Manuel Perez for GSoC 2013.
45+ * Belongie et al., 2002 by Juan Manuel Perez for GSoC 2013.
4646 */
4747#include " precomp.hpp"
4848// #include "opencv2/highgui.hpp"
@@ -176,7 +176,7 @@ class SCD
176176 {
177177 for (int j=0 ; j<contourMat.cols ; j++)
178178 {
179- disMatrix.at <float >(i,j) = norm ( cv::Mat (contourMat.at <cv::Point2f>(0 ,i)-contourMat.at <cv::Point2f>(0 ,j)), cv::NORM_L2 );
179+ disMatrix.at <float >(i,j) = ( float ) norm ( cv::Mat (contourMat.at <cv::Point2f>(0 ,i)-contourMat.at <cv::Point2f>(0 ,j)), cv::NORM_L2 );
180180 if (_meanDistance<0 )
181181 {
182182 if (queryInliers.size ()>0 )
@@ -193,7 +193,7 @@ class SCD
193193
194194 if (_meanDistance<0 )
195195 {
196- meanDistance=mean (disMatrix, mask)[0 ];
196+ meanDistance=( float ) mean (disMatrix, mask)[0 ];
197197 }
198198 else
199199 {
@@ -239,7 +239,7 @@ class SCD
239239 float refAngle = atan2 (refPt.y , refPt.x );
240240 angleMatrix.at <float >(i,j) -= refAngle;
241241 }
242- angleMatrix.at <float >(i,j) = fmod (angleMatrix.at <float >(i,j)+FLT_EPSILON,2 *CV_PI)+CV_PI;
242+ angleMatrix.at <float >(i,j) = float ( fmod (double ( angleMatrix.at <float >(i,j)+( double ) FLT_EPSILON) ,2 *CV_PI)+CV_PI) ;
243243 // angleMatrix.at<float>(i,j) = 1+floor( angleMatrix.at<float>(i,j)*nAngularBins/(2*CV_PI) );
244244 }
245245 }
@@ -426,7 +426,7 @@ class SCDMatcher
426426 for (j = 0 ; j < costMatrix.rows ; j++)
427427 {
428428 d[j] = costMatrix.at <float >(freerow,j) - v[j];
429- pred[j] = freerow;
429+ pred[j] = float ( freerow) ;
430430 collist[j] = j; // init column list.
431431 }
432432
@@ -479,7 +479,7 @@ class SCDMatcher
479479 v2 = costMatrix.at <float >(i,j) - v[j] - h;
480480 if (v2 < d[j])
481481 {
482- pred[j] = i ;
482+ pred[j] = float (i) ;
483483 if (v2 == min)
484484 {
485485 if (colsol[j] < 0 )
@@ -511,7 +511,7 @@ class SCDMatcher
511511 // reset row and column assignments along the alternating path.
512512 do
513513 {
514- i = pred[endofpath];
514+ i = int ( pred[endofpath]) ;
515515 colsol[endofpath] = i;
516516 j1 = endofpath;
517517 endofpath = rowsol[i];
@@ -526,7 +526,7 @@ class SCDMatcher
526526 {
527527 double minval;
528528 minMaxIdx (trueCostMatrix.row (nrow), &minval);
529- leftcost+=minval;
529+ leftcost+=float ( minval) ;
530530 }
531531 leftcost /= trueCostMatrix.rows ;
532532
@@ -535,7 +535,7 @@ class SCDMatcher
535535 {
536536 double minval;
537537 minMaxIdx (trueCostMatrix.col (ncol), &minval);
538- rightcost+=minval;
538+ rightcost+=float ( minval) ;
539539 }
540540 rightcost /= trueCostMatrix.cols ;
541541
@@ -815,7 +815,7 @@ float ShapeContextDistanceExtractorImpl::computeDistance(InputArray contour1, In
815815 {
816816 float xx = sset1.at <Point2f>(0 ,pt).x ;
817817 float yy = sset1.at <Point2f>(0 ,pt).y ;
818- float val = std::exp ( -( (xx-jj)*(xx-jj) + (yy-ii)*(yy-ii) )/(2 *sigma*sigma) ) / (sigma*sigma*2 *CV_PI);
818+ float val = float ( std::exp ( -float ( (xx-jj)*(xx-jj) + (yy-ii)*(yy-ii) )/(2 *sigma*sigma) ) / (sigma*sigma*2 *CV_PI) );
819819 gaussWindow.at <float >(ii,jj) += val;
820820 }
821821 }
@@ -831,7 +831,7 @@ float ShapeContextDistanceExtractorImpl::computeDistance(InputArray contour1, In
831831 appIm.at <float >(ii,jj) = elema*elemb;
832832 }
833833 }
834- iAppearance = cv::sum (appIm)[0 ]/sset1.cols ;
834+ iAppearance = float ( cv::sum (appIm)[0 ]/sset1.cols ) ;
835835 }
836836 sDistance = matcher.getMatchingCost ();
837837
0 commit comments