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
50d02b9f
Commit
50d02b9f
authored
Sep 14, 2016
by
danil-tolkachev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
supress numpy future warning with `None` comparison
parent
05b15943
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
houghcircles.py
samples/python/houghcircles.py
+1
-1
houghlines.py
samples/python/houghlines.py
+1
-1
tst_scene_render.py
samples/python/tst_scene_render.py
+5
-5
No files found.
samples/python/houghcircles.py
View file @
50d02b9f
...
...
@@ -30,7 +30,7 @@ if __name__ == '__main__':
circles
=
cv2
.
HoughCircles
(
img
,
cv2
.
HOUGH_GRADIENT
,
1
,
10
,
np
.
array
([]),
100
,
30
,
1
,
30
)
if
circles
!=
None
:
# Check if circles have been found and only then iterate over these and add them to the image
if
circles
is
not
None
:
# Check if circles have been found and only then iterate over these and add them to the image
a
,
b
,
c
=
circles
.
shape
for
i
in
range
(
b
):
cv2
.
circle
(
cimg
,
(
circles
[
0
][
i
][
0
],
circles
[
0
][
i
][
1
]),
circles
[
0
][
i
][
2
],
(
0
,
0
,
255
),
3
,
cv2
.
LINE_AA
)
...
...
samples/python/houghlines.py
View file @
50d02b9f
...
...
@@ -36,7 +36,7 @@ if __name__ == '__main__':
else
:
# HoughLines
lines
=
cv2
.
HoughLines
(
dst
,
1
,
math
.
pi
/
180.0
,
50
,
np
.
array
([]),
0
,
0
)
if
lines
!=
None
:
if
lines
is
not
None
:
a
,
b
,
c
=
lines
.
shape
for
i
in
range
(
a
):
rho
=
lines
[
i
][
0
][
0
]
...
...
samples/python/tst_scene_render.py
View file @
50d02b9f
...
...
@@ -21,7 +21,7 @@ class TestSceneRender():
self
.
deformation
=
deformation
self
.
speed
=
speed
if
bgImg
!=
None
:
if
bgImg
is
not
None
:
self
.
sceneBg
=
bgImg
.
copy
()
else
:
self
.
sceneBg
=
np
.
zeros
(
defaultSize
,
defaultSize
,
np
.
uint8
)
...
...
@@ -29,7 +29,7 @@ class TestSceneRender():
self
.
w
=
self
.
sceneBg
.
shape
[
0
]
self
.
h
=
self
.
sceneBg
.
shape
[
1
]
if
fgImg
!=
None
:
if
fgImg
is
not
None
:
self
.
foreground
=
fgImg
.
copy
()
self
.
center
=
self
.
currentCenter
=
(
int
(
self
.
w
/
2
-
fgImg
.
shape
[
0
]
/
2
),
int
(
self
.
h
/
2
-
fgImg
.
shape
[
1
]
/
2
))
...
...
@@ -52,7 +52,7 @@ class TestSceneRender():
def
getRectInTime
(
self
,
time
):
if
self
.
foreground
!=
None
:
if
self
.
foreground
is
not
None
:
tmp
=
np
.
array
(
self
.
center
)
+
np
.
array
((
self
.
getXOffset
(
time
),
self
.
getYOffset
(
time
)))
x0
,
y0
=
tmp
x1
,
y1
=
tmp
+
self
.
foreground
.
shape
[
0
:
2
]
...
...
@@ -64,7 +64,7 @@ class TestSceneRender():
def
getCurrentRect
(
self
):
if
self
.
foreground
!=
None
:
if
self
.
foreground
is
not
None
:
x0
=
self
.
currentCenter
[
0
]
y0
=
self
.
currentCenter
[
1
]
...
...
@@ -79,7 +79,7 @@ class TestSceneRender():
def
getNextFrame
(
self
):
img
=
self
.
sceneBg
.
copy
()
if
self
.
foreground
!=
None
:
if
self
.
foreground
is
not
None
:
self
.
currentCenter
=
(
self
.
center
[
0
]
+
self
.
getXOffset
(
self
.
time
),
self
.
center
[
1
]
+
self
.
getYOffset
(
self
.
time
))
img
[
self
.
currentCenter
[
0
]:
self
.
currentCenter
[
0
]
+
self
.
foreground
.
shape
[
0
],
self
.
currentCenter
[
1
]:
self
.
currentCenter
[
1
]
+
self
.
foreground
.
shape
[
1
]]
=
self
.
foreground
...
...
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