Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
fe7bab49
Commit
fe7bab49
authored
Sep 23, 2013
by
Juan Manuel Perez
Committed by
Vadim Pisarevsky
Sep 30, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Corrections for compiling issues in Win, And and Doc
parent
61c27ac8
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
25 additions
and
31 deletions
+25
-31
histogram_cost_matrix.rst
modules/shape/doc/histogram_cost_matrix.rst
+1
-1
shape_distances.rst
modules/shape/doc/shape_distances.rst
+0
-0
emdL1.hpp
modules/shape/include/opencv2/shape/emdL1.hpp
+0
-0
aff_trans.cpp
modules/shape/src/aff_trans.cpp
+1
-1
emdL1.cpp
modules/shape/src/emdL1.cpp
+3
-4
emdL1_def.hpp
modules/shape/src/emdL1_def.hpp
+0
-1
haus_dis.cpp
modules/shape/src/haus_dis.cpp
+2
-4
hist_cost.cpp
modules/shape/src/hist_cost.cpp
+3
-5
sc_dis.cpp
modules/shape/src/sc_dis.cpp
+10
-10
tps_trans.cpp
modules/shape/src/tps_trans.cpp
+2
-2
test_hausdorff.cpp
modules/shape/test/test_hausdorff.cpp
+2
-2
test_shape.cpp
modules/shape/test/test_shape.cpp
+0
-0
shape_example.cpp
samples/cpp/shape_example.cpp
+1
-1
No files found.
modules/shape/doc/histogram_cost_matrix.rst
View file @
fe7bab49
...
...
@@ -70,7 +70,7 @@ An Chi based cost extraction. ::
CV_EXPORTS_W Ptr<HistogramCostExtractor> createChiHistogramCostExtractor(int nDummies=25, float defaultCost=0.2);
EMDL1HistogramCostExtractor
-------------------------
-------------------------
--
.. ocv:class:: EMDL1HistogramCostExtractor : public HistogramCostExtractor
An EMD-L1 based cost extraction. ::
...
...
modules/shape/doc/shape_distances.rst
View file @
fe7bab49
modules/shape/include/opencv2/shape/emdL1.hpp
View file @
fe7bab49
modules/shape/src/aff_trans.cpp
View file @
fe7bab49
...
...
@@ -88,7 +88,7 @@ public:
virtual
void
read
(
const
FileNode
&
fn
)
{
CV_Assert
(
(
String
)
fn
[
"name"
]
==
name_
);
fullAffine
=
(
int
)
fn
[
"affine_type"
]
;
fullAffine
=
(
bool
)
int
(
fn
[
"affine_type"
])
;
}
private
:
...
...
modules/shape/src/emdL1.cpp
View file @
fe7bab49
...
...
@@ -393,9 +393,9 @@ bool EmdL1::greedySolution3()
//- determine which direction to move, either right or upward
dFlow
=
D
[
i1
][
i2
][
i3
];
f1
=
i1
<
(
binsDim1
-
1
)
?
fabs
(
dFlow
+
d1s
[
i1
+
1
])
:
VHIGH
;
f2
=
i2
<
(
binsDim2
-
1
)
?
fabs
(
dFlow
+
d2s
[
i2
+
1
])
:
VHIGH
;
f3
=
i3
<
(
binsDim3
-
1
)
?
fabs
(
dFlow
+
d3s
[
i3
+
1
])
:
VHIGH
;
f1
=
i1
<
(
binsDim1
-
1
)
?
(
float
)
fabs
(
dFlow
+
d1s
[
i1
+
1
])
:
VHIGH
;
f2
=
i2
<
(
binsDim2
-
1
)
?
(
float
)
fabs
(
dFlow
+
d2s
[
i2
+
1
])
:
VHIGH
;
f3
=
i3
<
(
binsDim3
-
1
)
?
(
float
)
fabs
(
dFlow
+
d3s
[
i3
+
1
])
:
VHIGH
;
if
(
f1
<
f2
&&
f1
<
f3
)
{
...
...
@@ -791,4 +791,3 @@ float cv::EMDL1(InputArray _signature1, InputArray _signature2)
EmdL1
emdl1
;
return
emdl1
.
getEMDL1
(
signature1
,
signature2
);
}
modules/shape/src/emdL1_def.hpp
View file @
fe7bab49
...
...
@@ -139,4 +139,3 @@ private:
int
m_iFrom
;
int
m_iTo
;
};
modules/shape/src/haus_dis.cpp
View file @
fe7bab49
...
...
@@ -88,7 +88,7 @@ public:
{
CV_Assert
(
(
String
)
fn
[
"name"
]
==
name_
);
distanceFlag
=
(
int
)
fn
[
"distance"
];
rankProportion
=
(
in
t
)
fn
[
"rank"
];
rankProportion
=
(
floa
t
)
fn
[
"rank"
];
}
private
:
...
...
@@ -111,7 +111,7 @@ static float _apply(const Mat &set1, const Mat &set2, int distType, double propR
for
(
int
c
=
0
;
c
<
disMat
.
cols
;
c
++
)
{
Point2f
diff
=
set1
.
at
<
Point2f
>
(
0
,
r
)
-
set2
.
at
<
Point2f
>
(
0
,
c
);
disMat
.
at
<
float
>
(
r
,
c
)
=
norm
(
Mat
(
diff
),
distType
);
disMat
.
at
<
float
>
(
r
,
c
)
=
(
float
)
norm
(
Mat
(
diff
),
distType
);
}
}
...
...
@@ -147,5 +147,3 @@ Ptr <HausdorffDistanceExtractor> createHausdorffDistanceExtractor(int distanceFl
}
}
// cv
modules/shape/src/hist_cost.cpp
View file @
fe7bab49
...
...
@@ -156,7 +156,7 @@ void NormHistogramCostExtractorImpl::buildCostMatrix(InputArray _descriptors1, I
if
(
i
<
scd1
.
rows
&&
j
<
scd2
.
rows
)
{
Mat
columnDiff
=
scd1
.
row
(
i
)
-
scd2
.
row
(
j
);
costMatrix
.
at
<
float
>
(
i
,
j
)
=
norm
(
columnDiff
,
flag
);
costMatrix
.
at
<
float
>
(
i
,
j
)
=
(
float
)
norm
(
columnDiff
,
flag
);
}
else
{
...
...
@@ -288,11 +288,11 @@ void EMDHistogramCostExtractorImpl::buildCostMatrix(InputArray _descriptors1, In
sig2
.
col
(
0
)
=
scd2
.
row
(
j
).
t
();
for
(
int
k
=
0
;
k
<
sig1
.
rows
;
k
++
)
{
sig1
.
at
<
float
>
(
k
,
1
)
=
k
;
sig1
.
at
<
float
>
(
k
,
1
)
=
float
(
k
)
;
}
for
(
int
k
=
0
;
k
<
sig2
.
rows
;
k
++
)
{
sig2
.
at
<
float
>
(
k
,
1
)
=
k
;
sig2
.
at
<
float
>
(
k
,
1
)
=
float
(
k
)
;
}
costMatrix
.
at
<
float
>
(
i
,
j
)
=
cv
::
EMD
(
sig1
,
sig2
,
flag
);
...
...
@@ -543,5 +543,3 @@ Ptr <HistogramCostExtractor> createEMDL1HistogramCostExtractor(int nDummies, flo
}
}
// cv
modules/shape/src/sc_dis.cpp
View file @
fe7bab49
...
...
@@ -176,7 +176,7 @@ protected:
{
for
(
int
j
=
0
;
j
<
contourMat
.
cols
;
j
++
)
{
disMatrix
.
at
<
float
>
(
i
,
j
)
=
norm
(
cv
::
Mat
(
contourMat
.
at
<
cv
::
Point2f
>
(
0
,
i
)
-
contourMat
.
at
<
cv
::
Point2f
>
(
0
,
j
)),
cv
::
NORM_L2
);
disMatrix
.
at
<
float
>
(
i
,
j
)
=
(
float
)
norm
(
cv
::
Mat
(
contourMat
.
at
<
cv
::
Point2f
>
(
0
,
i
)
-
contourMat
.
at
<
cv
::
Point2f
>
(
0
,
j
)),
cv
::
NORM_L2
);
if
(
_meanDistance
<
0
)
{
if
(
queryInliers
.
size
()
>
0
)
...
...
@@ -193,7 +193,7 @@ protected:
if
(
_meanDistance
<
0
)
{
meanDistance
=
mean
(
disMatrix
,
mask
)[
0
];
meanDistance
=
(
float
)
mean
(
disMatrix
,
mask
)[
0
];
}
else
{
...
...
@@ -239,7 +239,7 @@ protected:
float
refAngle
=
atan2
(
refPt
.
y
,
refPt
.
x
);
angleMatrix
.
at
<
float
>
(
i
,
j
)
-=
refAngle
;
}
angleMatrix
.
at
<
float
>
(
i
,
j
)
=
f
mod
(
angleMatrix
.
at
<
float
>
(
i
,
j
)
+
FLT_EPSILON
,
2
*
CV_PI
)
+
CV_PI
;
angleMatrix
.
at
<
float
>
(
i
,
j
)
=
f
loat
(
fmod
(
double
(
angleMatrix
.
at
<
float
>
(
i
,
j
)
+
(
double
)
FLT_EPSILON
),
2
*
CV_PI
)
+
CV_PI
)
;
//angleMatrix.at<float>(i,j) = 1+floor( angleMatrix.at<float>(i,j)*nAngularBins/(2*CV_PI) );
}
}
...
...
@@ -426,7 +426,7 @@ protected:
for
(
j
=
0
;
j
<
costMatrix
.
rows
;
j
++
)
{
d
[
j
]
=
costMatrix
.
at
<
float
>
(
freerow
,
j
)
-
v
[
j
];
pred
[
j
]
=
f
reerow
;
pred
[
j
]
=
f
loat
(
freerow
)
;
collist
[
j
]
=
j
;
// init column list.
}
...
...
@@ -479,7 +479,7 @@ protected:
v2
=
costMatrix
.
at
<
float
>
(
i
,
j
)
-
v
[
j
]
-
h
;
if
(
v2
<
d
[
j
])
{
pred
[
j
]
=
i
;
pred
[
j
]
=
float
(
i
)
;
if
(
v2
==
min
)
{
if
(
colsol
[
j
]
<
0
)
...
...
@@ -511,7 +511,7 @@ protected:
// reset row and column assignments along the alternating path.
do
{
i
=
pred
[
endofpath
]
;
i
=
int
(
pred
[
endofpath
])
;
colsol
[
endofpath
]
=
i
;
j1
=
endofpath
;
endofpath
=
rowsol
[
i
];
...
...
@@ -526,7 +526,7 @@ protected:
{
double
minval
;
minMaxIdx
(
trueCostMatrix
.
row
(
nrow
),
&
minval
);
leftcost
+=
minval
;
leftcost
+=
float
(
minval
)
;
}
leftcost
/=
trueCostMatrix
.
rows
;
...
...
@@ -535,7 +535,7 @@ protected:
{
double
minval
;
minMaxIdx
(
trueCostMatrix
.
col
(
ncol
),
&
minval
);
rightcost
+=
minval
;
rightcost
+=
float
(
minval
)
;
}
rightcost
/=
trueCostMatrix
.
cols
;
...
...
@@ -815,7 +815,7 @@ float ShapeContextDistanceExtractorImpl::computeDistance(InputArray contour1, In
{
float
xx
=
sset1
.
at
<
Point2f
>
(
0
,
pt
).
x
;
float
yy
=
sset1
.
at
<
Point2f
>
(
0
,
pt
).
y
;
float
val
=
std
::
exp
(
-
(
(
xx
-
jj
)
*
(
xx
-
jj
)
+
(
yy
-
ii
)
*
(
yy
-
ii
)
)
/
(
2
*
sigma
*
sigma
)
)
/
(
sigma
*
sigma
*
2
*
CV_PI
);
float
val
=
float
(
std
::
exp
(
-
float
(
(
xx
-
jj
)
*
(
xx
-
jj
)
+
(
yy
-
ii
)
*
(
yy
-
ii
)
)
/
(
2
*
sigma
*
sigma
)
)
/
(
sigma
*
sigma
*
2
*
CV_PI
)
);
gaussWindow
.
at
<
float
>
(
ii
,
jj
)
+=
val
;
}
}
...
...
@@ -831,7 +831,7 @@ float ShapeContextDistanceExtractorImpl::computeDistance(InputArray contour1, In
appIm
.
at
<
float
>
(
ii
,
jj
)
=
elema
*
elemb
;
}
}
iAppearance
=
cv
::
sum
(
appIm
)[
0
]
/
sset1
.
cols
;
iAppearance
=
float
(
cv
::
sum
(
appIm
)[
0
]
/
sset1
.
cols
)
;
}
sDistance
=
matcher
.
getMatchingCost
();
...
...
modules/shape/src/tps_trans.cpp
View file @
fe7bab49
...
...
@@ -104,7 +104,7 @@ protected:
String
name_
;
};
static
double
distance
(
Point2f
p
,
Point2f
q
)
static
float
distance
(
Point2f
p
,
Point2f
q
)
{
Point2f
diff
=
p
-
q
;
float
norma
=
diff
.
x
*
diff
.
x
+
diff
.
y
*
diff
.
y
;
// - 2*diff.x*diff.y;
...
...
@@ -237,7 +237,7 @@ void ThinPlateSplineShapeTransformerImpl::estimateTransformation(InputArray _pts
{
if
(
i
==
j
)
{
matK
.
at
<
float
>
(
i
,
j
)
=
regularizationParameter
;
matK
.
at
<
float
>
(
i
,
j
)
=
float
(
regularizationParameter
)
;
}
else
{
...
...
modules/shape/test/test_hausdorff.cpp
View file @
fe7bab49
...
...
@@ -87,7 +87,7 @@ vector<Point2f> CV_HaussTest::normalizeContour(const vector<Point> &contour)
else
{
disMat
.
at
<
float
>
(
ii
,
jj
)
=
f
abs
(
contour
[
ii
].
x
*
contour
[
jj
].
x
)
+
fabs
(
contour
[
ii
].
y
*
contour
[
jj
].
y
);
f
loat
(
fabs
(
double
(
contour
[
ii
].
x
*
contour
[
jj
].
x
)))
+
float
(
fabs
(
double
(
contour
[
ii
].
y
*
contour
[
jj
].
y
))
);
}
}
meanpt
.
x
+=
contour
[
ii
].
x
;
...
...
@@ -95,7 +95,7 @@ vector<Point2f> CV_HaussTest::normalizeContour(const vector<Point> &contour)
}
meanpt
.
x
/=
contour
.
size
();
meanpt
.
y
/=
contour
.
size
();
meanVal
=
cv
::
mean
(
disMat
)[
0
]
;
meanVal
=
float
(
cv
::
mean
(
disMat
)[
0
])
;
for
(
size_t
ii
=
0
;
ii
<
contour
.
size
();
ii
++
)
{
output
[
ii
].
x
=
(
contour
[
ii
].
x
-
meanpt
.
x
)
/
meanVal
;
...
...
modules/shape/test/test_shape.cpp
View file @
fe7bab49
samples/cpp/shape_example.cpp
View file @
fe7bab49
...
...
@@ -75,7 +75,7 @@ int main(int argc, char** argv)
imshow
(
"QUERY"
,
queryToShow
);
moveWindow
(
"TEST"
,
0
,
0
);
vector
<
Point
>
contQuery
=
simpleContour
(
query
);
int
bestMatch
;
int
bestMatch
=
0
;
float
bestDis
=
FLT_MAX
;
for
(
int
ii
=
1
;
ii
<=
20
;
ii
++
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment