From: Juan Manuel Perez Date: Wed, 25 Sep 2013 16:30:33 +0000 (+0200) Subject: Replaced dynamic_cas with Ptr::dynamicCast<>, and & with && X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~3732^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4672a70c1f5c969ae48926eea1c166e32b1939a3;p=platform%2Fupstream%2Fopencv.git Replaced dynamic_cas with Ptr::dynamicCast<>, and & with && --- diff --git a/modules/shape/src/aff_trans.cpp b/modules/shape/src/aff_trans.cpp index 02f290f..c290e3f 100644 --- a/modules/shape/src/aff_trans.cpp +++ b/modules/shape/src/aff_trans.cpp @@ -186,7 +186,7 @@ void AffineTransformerImpl::estimateTransformation(InputArray _pts1, InputArray { Mat pts1 = _pts1.getMat(); Mat pts2 = _pts2.getMat(); - CV_Assert((pts1.channels()==2) & (pts1.cols>0) & (pts2.channels()==2) & (pts2.cols>0)); + CV_Assert((pts1.channels()==2) && (pts1.cols>0) && (pts2.channels()==2) && (pts2.cols>0)); CV_Assert(_matches.size()>1); if (pts1.type() != CV_32F) @@ -230,7 +230,7 @@ void AffineTransformerImpl::estimateTransformation(InputArray _pts1, InputArray float AffineTransformerImpl::applyTransformation(InputArray inPts, OutputArray outPts) { Mat pts1 = inPts.getMat(); - CV_Assert((pts1.channels()==2) & (pts1.cols>0)); + CV_Assert((pts1.channels()==2) && (pts1.cols>0)); //Apply transformation in the complete set of points Mat fAffine; diff --git a/modules/shape/src/emdL1.cpp b/modules/shape/src/emdL1.cpp index b8381de..75f1b13 100644 --- a/modules/shape/src/emdL1.cpp +++ b/modules/shape/src/emdL1.cpp @@ -60,7 +60,7 @@ float EmdL1::getEMDL1(cv::Mat &sig1, cv::Mat &sig2) { // Initialization - CV_Assert((sig1.rows==sig2.rows) & (sig1.cols==sig2.cols) & (!sig1.empty()) & (!sig2.empty())); + CV_Assert((sig1.rows==sig2.rows) && (sig1.cols==sig2.cols) && (!sig1.empty()) && (!sig2.empty())); if(!initBaseTrees(sig1.rows, 1)) return -1; diff --git a/modules/shape/src/haus_dis.cpp b/modules/shape/src/haus_dis.cpp index a2c555e..ff5bd8c 100644 --- a/modules/shape/src/haus_dis.cpp +++ b/modules/shape/src/haus_dis.cpp @@ -71,7 +71,7 @@ public: virtual void setRankProportion(float _rankProportion) { - CV_Assert((_rankProportion>0) & (_rankProportion<=1)); + CV_Assert((_rankProportion>0) && (_rankProportion<=1)); rankProportion=_rankProportion; } virtual float getRankProportion() const {return rankProportion;} @@ -135,8 +135,8 @@ float HausdorffDistanceExtractorImpl::computeDistance(InputArray contour1, Input set1.convertTo(set1, CV_32F); if (set2.type() != CV_32F) set2.convertTo(set2, CV_32F); - CV_Assert((set1.channels()==2) & (set1.cols>0)); - CV_Assert((set2.channels()==2) & (set2.cols>0)); + CV_Assert((set1.channels()==2) && (set1.cols>0)); + CV_Assert((set2.channels()==2) && (set2.cols>0)); return std::max( _apply(set1, set2, distanceFlag, rankProportion), _apply(set2, set1, distanceFlag, rankProportion) ); } diff --git a/modules/shape/src/sc_dis.cpp b/modules/shape/src/sc_dis.cpp index e41efc2..f19080b 100644 --- a/modules/shape/src/sc_dis.cpp +++ b/modules/shape/src/sc_dis.cpp @@ -45,7 +45,7 @@ * Belongie et al., 2002 by Juan Manuel Perez for GSoC 2013. */ #include "precomp.hpp" -//#include "opencv2/highgui.hpp" +#include "opencv2/core.hpp" /* * ShapeContextDescriptor class */ @@ -181,7 +181,7 @@ protected: { if (queryInliers.size()>0) { - mask.at(i,j)=char(queryInliers[j] & queryInliers[i]); + mask.at(i,j)=char(queryInliers[j] && queryInliers[i]); } else { @@ -641,14 +641,14 @@ public: virtual void setImages(InputArray _image1, InputArray _image2) { Mat image1_=_image1.getMat(), image2_=_image2.getMat(); - CV_Assert((image1_.depth()==0) & (image2_.depth()==0)); + CV_Assert((image1_.depth()==0) && (image2_.depth()==0)); image1=image1_; image2=image2_; } virtual void getImages(OutputArray _image1, OutputArray _image2) const { - CV_Assert((!image1.empty()) & (!image2.empty())); + CV_Assert((!image1.empty()) && (!image2.empty())); _image1.create(image1.size(), image1.type()); _image2.create(image2.size(), image2.type()); _image1.getMat()=image1; @@ -726,11 +726,11 @@ float ShapeContextDistanceExtractorImpl::computeDistance(InputArray contour1, In else sset1.copyTo(set2); - CV_Assert((set1.channels()==2) & (set1.cols>0)); - CV_Assert((set2.channels()==2) & (set2.cols>0)); + CV_Assert((set1.channels()==2) && (set1.cols>0)); + CV_Assert((set2.channels()==2) && (set2.cols>0)); if (imageAppearanceWeight!=0) { - CV_Assert((!image1.empty()) & (!image2.empty())); + CV_Assert((!image1.empty()) && (!image2.empty())); } // Initializing Extractor, Descriptor structures and Matcher // @@ -747,9 +747,9 @@ float ShapeContextDistanceExtractorImpl::computeDistance(InputArray contour1, In // Initializing some variables // std::vector inliers1, inliers2; - bool isTPS=false; - if ( dynamic_cast(&*transformer) ) - isTPS=true; + + Ptr transDown = transformer.dynamicCast(); + Mat warpedImage; for (int ii=0; ii(&*transformer)->setRegularizationParameter(beta); + if ( !transDown.empty() ) + transDown->setRegularizationParameter(beta); transformer->estimateTransformation(set1, set2, matches); bEnergy += transformer->applyTransformation(set1, set1); @@ -777,7 +777,7 @@ float ShapeContextDistanceExtractorImpl::computeDistance(InputArray contour1, In // Have to accumulate the transformation along all the iterations if (ii==0) { - if ( isTPS ) + if ( !transDown.empty() ) { image2.copyTo(warpedImage); } @@ -794,7 +794,7 @@ float ShapeContextDistanceExtractorImpl::computeDistance(InputArray contour1, In if (imageAppearanceWeight!=0) { // compute appearance cost - if ( isTPS ) + if ( !transDown.empty() ) { resize(warpedImage, warpedImage, image1.size()); Mat temp=(warpedImage-image1); diff --git a/modules/shape/src/tps_trans.cpp b/modules/shape/src/tps_trans.cpp index b841567..cbf2d1b 100644 --- a/modules/shape/src/tps_trans.cpp +++ b/modules/shape/src/tps_trans.cpp @@ -169,7 +169,7 @@ float ThinPlateSplineShapeTransformerImpl::applyTransformation(InputArray inPts, { CV_Assert(tpsComputed); Mat pts1 = inPts.getMat(); - CV_Assert((pts1.channels()==2) & (pts1.cols>0)); + CV_Assert((pts1.channels()==2) && (pts1.cols>0)); //Apply transformation in the complete set of points // Ensambling output // @@ -192,7 +192,7 @@ void ThinPlateSplineShapeTransformerImpl::estimateTransformation(InputArray _pts { Mat pts1 = _pts1.getMat(); Mat pts2 = _pts2.getMat(); - CV_Assert((pts1.channels()==2) & (pts1.cols>0) & (pts2.channels()==2) & (pts2.cols>0)); + CV_Assert((pts1.channels()==2) && (pts1.cols>0) && (pts2.channels()==2) && (pts2.cols>0)); CV_Assert(_matches.size()>1); if (pts1.type() != CV_32F)