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
67158b12
Commit
67158b12
authored
Jul 16, 2015
by
Alexander Smorkalov
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4191 from SpecLad:irc-workaround
parents
4bf82e50
9e50cf53
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
12 deletions
+16
-12
rotcalipers.cpp
modules/imgproc/src/rotcalipers.cpp
+16
-12
No files found.
modules/imgproc/src/rotcalipers.cpp
View file @
67158b12
...
...
@@ -186,24 +186,28 @@ icvRotatingCalipers( CvPoint2D32f* points, int n, int mode, float* out )
/* compute cosine of angle between calipers side and polygon edge */
/* dp - dot product */
float
dp0
=
base_a
*
vect
[
seq
[
0
]].
x
+
base_b
*
vect
[
seq
[
0
]].
y
;
float
dp1
=
-
base_b
*
vect
[
seq
[
1
]].
x
+
base_a
*
vect
[
seq
[
1
]].
y
;
float
dp2
=
-
base_a
*
vect
[
seq
[
2
]].
x
-
base_b
*
vect
[
seq
[
2
]].
y
;
float
dp3
=
base_b
*
vect
[
seq
[
3
]].
x
-
base_a
*
vect
[
seq
[
3
]].
y
;
float
dp
[
4
]
=
{
+
base_a
*
vect
[
seq
[
0
]].
x
+
base_b
*
vect
[
seq
[
0
]].
y
,
-
base_b
*
vect
[
seq
[
1
]].
x
+
base_a
*
vect
[
seq
[
1
]].
y
,
-
base_a
*
vect
[
seq
[
2
]].
x
-
base_b
*
vect
[
seq
[
2
]].
y
,
+
base_b
*
vect
[
seq
[
3
]].
x
-
base_a
*
vect
[
seq
[
3
]].
y
,
};
float
cosalpha
=
dp0
*
inv_vect_length
[
seq
[
0
]];
float
maxcos
=
cosalpha
;
float
maxcos
=
dp
[
0
]
*
inv_vect_length
[
seq
[
0
]];
/* number of calipers edges, that has minimal angle with edge */
int
main_element
=
0
;
/* choose minimal angle */
cosalpha
=
dp1
*
inv_vect_length
[
seq
[
1
]];
maxcos
=
(
cosalpha
>
maxcos
)
?
(
main_element
=
1
,
cosalpha
)
:
maxcos
;
cosalpha
=
dp2
*
inv_vect_length
[
seq
[
2
]];
maxcos
=
(
cosalpha
>
maxcos
)
?
(
main_element
=
2
,
cosalpha
)
:
maxcos
;
cosalpha
=
dp3
*
inv_vect_length
[
seq
[
3
]];
maxcos
=
(
cosalpha
>
maxcos
)
?
(
main_element
=
3
,
cosalpha
)
:
maxcos
;
for
(
i
=
1
;
i
<
4
;
++
i
)
{
float
cosalpha
=
dp
[
i
]
*
inv_vect_length
[
seq
[
i
]];
if
(
cosalpha
>
maxcos
)
{
main_element
=
i
;
maxcos
=
cosalpha
;
}
}
/*rotate calipers*/
{
...
...
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