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
4113d5da
Commit
4113d5da
authored
Nov 30, 2010
by
Alexander Shishkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed compilation errors on Windows
parent
b55777eb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
chamfermatching.cpp
modules/contrib/src/chamfermatching.cpp
+8
-8
No files found.
modules/contrib/src/chamfermatching.cpp
View file @
4113d5da
...
...
@@ -711,10 +711,10 @@ float ChamferMatcher::Matching::getAngle(coordinate_t a, coordinate_t b, int& dx
{
dx
=
b
.
first
-
a
.
first
;
dy
=
-
(
b
.
second
-
a
.
second
);
// in image coordinated Y axis points downward
float
angle
=
atan2
(
dy
,
dx
);
float
angle
=
atan2
((
float
)
dy
,(
float
)
dx
);
if
(
angle
<
0
)
{
angle
+=
M
_PI
;
angle
+=
CV
_PI
;
}
return
angle
;
...
...
@@ -728,7 +728,7 @@ void ChamferMatcher::Matching::findContourOrientations(const template_coords_t&
int
coords_size
=
coords
.
size
();
vector
<
float
>
angles
(
2
*
M
);
orientations
.
insert
(
orientations
.
begin
(),
coords_size
,
float
(
-
3
*
M
_PI
));
// mark as invalid in the beginning
orientations
.
insert
(
orientations
.
begin
(),
coords_size
,
float
(
-
3
*
CV
_PI
));
// mark as invalid in the beginning
if
(
coords_size
<
2
*
M
+
1
)
{
// if contour not long enough to estimate orientations, abort
return
;
...
...
@@ -879,7 +879,7 @@ void ChamferMatcher::Template::show() const
//CV_PIXEL(unsigned char, templ_color,x,y)[1] = 255;
if
(
i
%
3
==
0
)
{
if
(
orientations
[
i
]
<
-
M
_PI
)
{
if
(
orientations
[
i
]
<
-
CV
_PI
)
{
continue
;
}
Point
p1
;
...
...
@@ -1012,7 +1012,7 @@ void ChamferMatcher::Matching::computeEdgeOrientations(Mat& edge_img, Mat& orien
{
Mat
contour_img
(
edge_img
.
size
(),
CV_8UC1
);
orientation_img
.
setTo
(
3
*
(
-
M
_PI
));
orientation_img
.
setTo
(
3
*
(
-
CV
_PI
));
template_coords_t
coords
;
template_orientations_t
orientations
;
...
...
@@ -1024,7 +1024,7 @@ void ChamferMatcher::Matching::computeEdgeOrientations(Mat& edge_img, Mat& orien
for
(
size_t
i
=
0
;
i
<
coords
.
size
();
++
i
)
{
int
x
=
coords
[
i
].
first
;
int
y
=
coords
[
i
].
second
;
// if (orientations[i]>-M
_PI)
// if (orientations[i]>-CV
_PI)
// {
//CV_PIXEL(unsigned char, contour_img, x, y)[0] = 255;
contour_img
.
at
<
uchar
>
(
y
,
x
)
=
255
;
...
...
@@ -1094,7 +1094,7 @@ ChamferMatcher::Match* ChamferMatcher::Matching::localChamferDistance(Point offs
for
(
size_t
i
=
0
;
i
<
addr
.
size
();
++
i
)
{
if
(
addr
[
i
]
<
(
orientation_img
.
cols
*
orientation_img
.
rows
)
-
(
offset
.
y
*
orientation_img
.
cols
+
offset
.
x
)){
if
(
tpl
->
orientations
[
i
]
>=-
M_PI
&&
(
*
(
optr
+
addr
[
i
]))
>=-
M
_PI
)
{
if
(
tpl
->
orientations
[
i
]
>=-
CV_PI
&&
(
*
(
optr
+
addr
[
i
]))
>=-
CV
_PI
)
{
sum_orientation
+=
orientation_diff
(
tpl
->
orientations
[
i
],
(
*
(
optr
+
addr
[
i
])));
cnt_orientation
++
;
}
...
...
@@ -1102,7 +1102,7 @@ ChamferMatcher::Match* ChamferMatcher::Matching::localChamferDistance(Point offs
}
if
(
cnt_orientation
>
0
)
{
cost
=
beta
*
cost
+
alpha
*
(
sum_orientation
/
(
2
*
M
_PI
))
/
cnt_orientation
;
cost
=
beta
*
cost
+
alpha
*
(
sum_orientation
/
(
2
*
CV
_PI
))
/
cnt_orientation
;
}
}
...
...
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