Skip to content

Commit fe7bab4

Browse files
jperezruavpisarev
authored andcommitted
Corrections for compiling issues in Win, And and Doc
1 parent 61c27ac commit fe7bab4

File tree

14 files changed

+37
-43
lines changed

14 files changed

+37
-43
lines changed

modules/shape/doc/histogram_cost_matrix.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ An Chi based cost extraction. ::
7070
CV_EXPORTS_W Ptr<HistogramCostExtractor> createChiHistogramCostExtractor(int nDummies=25, float defaultCost=0.2);
7171

7272
EMDL1HistogramCostExtractor
73-
-------------------------
73+
---------------------------
7474
.. ocv:class:: EMDL1HistogramCostExtractor : public HistogramCostExtractor
7575
7676
An EMD-L1 based cost extraction. ::

modules/shape/doc/shape_distances.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
Shape Distance and Common Interfaces
1+
Shape Distance and Common Interfaces
22
====================================
33

44
.. highlight:: cpp
55

66
Shape Distance algorithms in OpenCV are derivated from a common interface that allows you to
77
switch between them in a practical way for solving the same problem with different methods.
8-
Thus, all objects that implement shape distance measures inherit the
8+
Thus, all objects that implement shape distance measures inherit the
99
:ocv:class:`ShapeDistanceExtractor` interface.
1010

1111

@@ -123,7 +123,7 @@ ShapeContextDistanceExtractor::setShapeContextWeight
123123
----------------------------------------------------
124124
Set the weight of the shape context distance in the final value of the shape distance.
125125
The shape context distance between two shapes is defined as the symmetric sum of shape
126-
context matching costs over best matching points.
126+
context matching costs over best matching points.
127127
The final value of the shape distance is a user-defined linear combination of the shape
128128
context distance, an image appearance distance, and a bending energy.
129129

modules/shape/include/opencv2/shape/emdL1.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ CV_EXPORTS float EMDL1(InputArray signature1, InputArray signature2);
5555

5656
}//namespace cv
5757

58-
#endif
58+
#endif

modules/shape/src/aff_trans.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class AffineTransformerImpl : public AffineTransformer
8888
virtual void read(const FileNode& fn)
8989
{
9090
CV_Assert( (String)fn["name"] == name_ );
91-
fullAffine = (int)fn["affine_type"];
91+
fullAffine = (bool)int(fn["affine_type"]);
9292
}
9393

9494
private:

modules/shape/src/emdL1.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@
4141
//M*/
4242

4343
/*
44-
* Implementation of an optimized EMD for histograms based in
45-
* the papers "EMD-L1: An efficient and Robust Algorithm
46-
* for comparing histogram-based descriptors", by Haibin Ling and
44+
* Implementation of an optimized EMD for histograms based in
45+
* the papers "EMD-L1: An efficient and Robust Algorithm
46+
* for comparing histogram-based descriptors", by Haibin Ling and
4747
* Kazunori Okuda; and "The Earth Mover's Distance is the Mallows
48-
* Distance: Some Insights from Statistics", by Elizaveta Levina and
48+
* Distance: Some Insights from Statistics", by Elizaveta Levina and
4949
* Peter Bickel, based on HAIBIN LING AND KAZUNORI OKADA implementation.
5050
*/
5151

@@ -393,9 +393,9 @@ bool EmdL1::greedySolution3()
393393

394394
//- determine which direction to move, either right or upward
395395
dFlow = D[i1][i2][i3];
396-
f1 = i1<(binsDim1-1)?fabs(dFlow+d1s[i1+1]):VHIGH;
397-
f2 = i2<(binsDim2-1)?fabs(dFlow+d2s[i2+1]):VHIGH;
398-
f3 = i3<(binsDim3-1)?fabs(dFlow+d3s[i3+1]):VHIGH;
396+
f1 = i1<(binsDim1-1)?(float)fabs(dFlow+d1s[i1+1]):VHIGH;
397+
f2 = i2<(binsDim2-1)?(float)fabs(dFlow+d2s[i2+1]):VHIGH;
398+
f3 = i3<(binsDim3-1)?(float)fabs(dFlow+d3s[i3+1]):VHIGH;
399399

400400
if(f1<f2 && f1<f3)
401401
{
@@ -791,4 +791,3 @@ float cv::EMDL1(InputArray _signature1, InputArray _signature2)
791791
EmdL1 emdl1;
792792
return emdl1.getEMDL1(signature1, signature2);
793793
}
794-

modules/shape/src/emdL1_def.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,3 @@ class EmdL1
139139
int m_iFrom;
140140
int m_iTo;
141141
};
142-

modules/shape/src/haus_dis.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class HausdorffDistanceExtractorImpl : public HausdorffDistanceExtractor
8888
{
8989
CV_Assert( (String)fn["name"] == name_ );
9090
distanceFlag = (int)fn["distance"];
91-
rankProportion = (int)fn["rank"];
91+
rankProportion = (float)fn["rank"];
9292
}
9393

9494
private:
@@ -111,7 +111,7 @@ static float _apply(const Mat &set1, const Mat &set2, int distType, double propR
111111
for (int c=0; c<disMat.cols; c++)
112112
{
113113
Point2f diff = set1.at<Point2f>(0,r)-set2.at<Point2f>(0,c);
114-
disMat.at<float>(r,c) = norm(Mat(diff), distType);
114+
disMat.at<float>(r,c) = (float)norm(Mat(diff), distType);
115115
}
116116
}
117117

@@ -147,5 +147,3 @@ Ptr <HausdorffDistanceExtractor> createHausdorffDistanceExtractor(int distanceFl
147147
}
148148

149149
} // cv
150-
151-

modules/shape/src/hist_cost.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ void NormHistogramCostExtractorImpl::buildCostMatrix(InputArray _descriptors1, I
156156
if (i<scd1.rows && j<scd2.rows)
157157
{
158158
Mat columnDiff = scd1.row(i)-scd2.row(j);
159-
costMatrix.at<float>(i,j)=norm(columnDiff, flag);
159+
costMatrix.at<float>(i,j)=(float)norm(columnDiff, flag);
160160
}
161161
else
162162
{
@@ -288,11 +288,11 @@ void EMDHistogramCostExtractorImpl::buildCostMatrix(InputArray _descriptors1, In
288288
sig2.col(0)=scd2.row(j).t();
289289
for (int k=0; k<sig1.rows; k++)
290290
{
291-
sig1.at<float>(k,1)=k;
291+
sig1.at<float>(k,1)=float(k);
292292
}
293293
for (int k=0; k<sig2.rows; k++)
294294
{
295-
sig2.at<float>(k,1)=k;
295+
sig2.at<float>(k,1)=float(k);
296296
}
297297

298298
costMatrix.at<float>(i,j) = cv::EMD(sig1, sig2, flag);
@@ -543,5 +543,3 @@ Ptr <HistogramCostExtractor> createEMDL1HistogramCostExtractor(int nDummies, flo
543543
}
544544

545545
} // cv
546-
547-

modules/shape/src/sc_dis.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
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

modules/shape/src/tps_trans.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class ThinPlateSplineShapeTransformerImpl : public ThinPlateSplineShapeTransform
104104
String name_;
105105
};
106106

107-
static double distance(Point2f p, Point2f q)
107+
static float distance(Point2f p, Point2f q)
108108
{
109109
Point2f diff = p - q;
110110
float norma = diff.x*diff.x + diff.y*diff.y;// - 2*diff.x*diff.y;
@@ -237,7 +237,7 @@ void ThinPlateSplineShapeTransformerImpl::estimateTransformation(InputArray _pts
237237
{
238238
if (i==j)
239239
{
240-
matK.at<float>(i,j)=regularizationParameter;
240+
matK.at<float>(i,j)=float(regularizationParameter);
241241
}
242242
else
243243
{

0 commit comments

Comments
 (0)