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
10e639cd
Commit
10e639cd
authored
8 years ago
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7966 from Tetragramm:Issue#4235
parents
c9cedf3c
7cc0b0f9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
matchcontours.cpp
modules/imgproc/src/matchcontours.cpp
+22
-0
No files found.
modules/imgproc/src/matchcontours.cpp
View file @
10e639cd
...
...
@@ -50,6 +50,7 @@ double cv::matchShapes(InputArray contour1, InputArray contour2, int method, dou
double
eps
=
1.e-5
;
double
mmm
;
double
result
=
0
;
bool
anyA
=
false
,
anyB
=
false
;
HuMoments
(
moments
(
contour1
),
ma
);
HuMoments
(
moments
(
contour2
),
mb
);
...
...
@@ -62,6 +63,11 @@ double cv::matchShapes(InputArray contour1, InputArray contour2, int method, dou
double
ama
=
fabs
(
ma
[
i
]
);
double
amb
=
fabs
(
mb
[
i
]
);
if
(
ama
>
0
)
anyA
=
true
;
if
(
amb
>
0
)
anyB
=
true
;
if
(
ma
[
i
]
>
0
)
sma
=
1
;
else
if
(
ma
[
i
]
<
0
)
...
...
@@ -90,6 +96,11 @@ double cv::matchShapes(InputArray contour1, InputArray contour2, int method, dou
double
ama
=
fabs
(
ma
[
i
]
);
double
amb
=
fabs
(
mb
[
i
]
);
if
(
ama
>
0
)
anyA
=
true
;
if
(
amb
>
0
)
anyB
=
true
;
if
(
ma
[
i
]
>
0
)
sma
=
1
;
else
if
(
ma
[
i
]
<
0
)
...
...
@@ -118,6 +129,11 @@ double cv::matchShapes(InputArray contour1, InputArray contour2, int method, dou
double
ama
=
fabs
(
ma
[
i
]
);
double
amb
=
fabs
(
mb
[
i
]
);
if
(
ama
>
0
)
anyA
=
true
;
if
(
amb
>
0
)
anyB
=
true
;
if
(
ma
[
i
]
>
0
)
sma
=
1
;
else
if
(
ma
[
i
]
<
0
)
...
...
@@ -145,6 +161,12 @@ double cv::matchShapes(InputArray contour1, InputArray contour2, int method, dou
CV_Error
(
CV_StsBadArg
,
"Unknown comparison method"
);
}
//If anyA and anyB are both true, the result is correct.
//If anyA and anyB are both false, the distance is 0, perfect match.
//If only one is true, then it's a false 0 and return large error.
if
(
anyA
!=
anyB
)
result
=
DBL_MAX
;
return
result
;
}
...
...
This diff is collapsed.
Click to expand it.
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