Replaced dynamic_cas with Ptr::dynamicCast<>, and & with &&
This commit is contained in:
parent
1bf4298251
commit
4672a70c1f
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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) );
|
||||
}
|
||||
|
@ -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<char>(i,j)=char(queryInliers[j] & queryInliers[i]);
|
||||
mask.at<char>(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<int> inliers1, inliers2;
|
||||
bool isTPS=false;
|
||||
if ( dynamic_cast<ThinPlateSplineShapeTransformer*>(&*transformer) )
|
||||
isTPS=true;
|
||||
|
||||
Ptr<ThinPlateSplineShapeTransformer> transDown = transformer.dynamicCast<ThinPlateSplineShapeTransformer>();
|
||||
|
||||
Mat warpedImage;
|
||||
for (int ii=0; ii<iterations; ii++)
|
||||
{
|
||||
@ -766,8 +766,8 @@ float ShapeContextDistanceExtractorImpl::computeDistance(InputArray contour1, In
|
||||
matcher.matchDescriptors(set1SCD, set2SCD, matches, comparer, inliers1, inliers2);
|
||||
|
||||
// apply TPS transform //
|
||||
if ( isTPS )
|
||||
dynamic_cast<ThinPlateSplineShapeTransformer*>(&*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);
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user