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
716e0192
Commit
716e0192
authored
Feb 08, 2013
by
Andrey Kamaev
Committed by
OpenCV Buildbot
Feb 08, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #456 from vpisarev:python_ptseq_fix
parents
3ed6c094
43d61d96
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletion
+36
-1
utils.cpp
modules/imgproc/src/utils.cpp
+4
-0
test2.py
modules/python/test/test2.py
+32
-1
No files found.
modules/imgproc/src/utils.cpp
View file @
716e0192
...
...
@@ -47,11 +47,15 @@ CV_IMPL CvSeq* cvPointSeqFromMat( int seq_kind, const CvArr* arr,
CV_Assert
(
arr
!=
0
&&
contour_header
!=
0
&&
block
!=
0
);
int
eltype
;
CvMat
hdr
;
CvMat
*
mat
=
(
CvMat
*
)
arr
;
if
(
!
CV_IS_MAT
(
mat
))
CV_Error
(
CV_StsBadArg
,
"Input array is not a valid matrix"
);
if
(
CV_MAT_CN
(
mat
->
type
)
==
1
&&
mat
->
width
==
2
)
mat
=
cvReshape
(
mat
,
&
hdr
,
2
);
eltype
=
CV_MAT_TYPE
(
mat
->
type
);
if
(
eltype
!=
CV_32SC2
&&
eltype
!=
CV_32FC2
)
CV_Error
(
CV_StsUnsupportedFormat
,
...
...
modules/python/test/test2.py
View file @
716e0192
...
...
@@ -82,8 +82,39 @@ class Hackathon244Tests(NewOpenCVTests):
for
kpt
in
keypoints
:
self
.
assertNotEqual
(
kpt
.
response
,
0
)
def
check_close_angles
(
self
,
a
,
b
,
angle_delta
):
self
.
assert_
(
abs
(
a
-
b
)
<=
angle_delta
or
abs
(
360
-
abs
(
a
-
b
))
<=
angle_delta
)
def
check_close_pairs
(
self
,
a
,
b
,
delta
):
self
.
assertLessEqual
(
abs
(
a
[
0
]
-
b
[
0
]),
delta
)
self
.
assertLessEqual
(
abs
(
a
[
1
]
-
b
[
1
]),
delta
)
def
check_close_boxes
(
self
,
a
,
b
,
delta
,
angle_delta
):
self
.
check_close_pairs
(
a
[
0
],
b
[
0
],
delta
)
self
.
check_close_pairs
(
a
[
1
],
b
[
1
],
delta
)
self
.
check_close_angles
(
a
[
2
],
b
[
2
],
angle_delta
)
def
test_geometry
(
self
):
npt
=
100
np
.
random
.
seed
(
244
)
a
=
np
.
random
.
randn
(
npt
,
2
)
.
astype
(
'float32'
)
*
50
+
150
img
=
np
.
zeros
((
300
,
300
,
3
),
dtype
=
'uint8'
)
be
=
cv2
.
fitEllipse
(
a
)
br
=
cv2
.
minAreaRect
(
a
)
mc
,
mr
=
cv2
.
minEnclosingCircle
(
a
)
be0
=
((
150.2511749267578
,
150.77322387695312
),
(
158.024658203125
,
197.57696533203125
),
37.57804489135742
)
br0
=
((
161.2974090576172
,
154.41793823242188
),
(
199.2301483154297
,
207.7177734375
),
-
9.164555549621582
)
mc0
,
mr0
=
(
160.41790771484375
,
144.55152893066406
),
136.713500977
self
.
check_close_boxes
(
be
,
be0
,
5
,
15
)
self
.
check_close_boxes
(
br
,
br0
,
5
,
15
)
self
.
check_close_pairs
(
mc
,
mc0
,
5
)
self
.
assertLessEqual
(
abs
(
mr
-
mr0
),
5
)
if
__name__
==
'__main__'
:
print
"testing"
,
cv
.
__version__
print
"testing"
,
cv
2
.
__version__
random
.
seed
(
0
)
unittest
.
main
()
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