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
7a59d6c7
Commit
7a59d6c7
authored
Mar 26, 2012
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved convergence of minEnclosingCircle algorithm, patch #947 (thanks to Hannes Sommer)
parent
29077f11
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
4 deletions
+23
-4
shapedescr.cpp
modules/imgproc/src/shapedescr.cpp
+23
-4
No files found.
modules/imgproc/src/shapedescr.cpp
View file @
7a59d6c7
...
...
@@ -371,9 +371,11 @@ cvMinEnclosingCircle( const void* array, CvPoint2D32f * _center, float *_radius
for
(
k
=
0
;
k
<
max_iters
;
k
++
)
{
double
min_delta
=
0
,
delta
;
CvPoint2D32f
ptfl
;
icvFindEnslosingCicle4pts_32f
(
pts
,
&
center
,
&
radius
);
CvPoint2D32f
ptfl
,
farAway
=
{
0
,
0
};
/*only for first iteration because the alg is repared at the loop's foot*/
if
(
k
==
0
)
icvFindEnslosingCicle4pts_32f
(
pts
,
&
center
,
&
radius
);
cvStartReadSeq
(
sequence
,
&
reader
,
0
);
for
(
i
=
0
;
i
<
count
;
i
++
)
...
...
@@ -393,12 +395,29 @@ cvMinEnclosingCircle( const void* array, CvPoint2D32f * _center, float *_radius
if
(
delta
<
min_delta
)
{
min_delta
=
delta
;
pts
[
3
]
=
ptfl
;
farAway
=
ptfl
;
}
}
result
=
min_delta
>=
0
;
if
(
result
)
break
;
CvPoint2D32f
ptsCopy
[
4
];
/* find good replacement partner for the point which is at most far away,
starting with the one that lays in the actual circle (i=3) */
for
(
int
i
=
3
;
i
>=
0
;
i
--
)
{
for
(
int
j
=
0
;
j
<
4
;
j
++
)
{
ptsCopy
[
j
]
=
(
i
!=
j
)
?
pts
[
j
]
:
farAway
;
}
icvFindEnslosingCicle4pts_32f
(
ptsCopy
,
&
center
,
&
radius
);
if
(
icvIsPtInCircle
(
pts
[
i
],
center
,
radius
)
>=
0
){
// replaced one again in the new circle?
pts
[
i
]
=
farAway
;
break
;
}
}
}
if
(
!
result
)
...
...
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