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
afad87b5
Commit
afad87b5
authored
Jul 02, 2011
by
Alexander Mordvintsev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inpaint.py sample added
parent
f0a4185b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
2 deletions
+36
-2
inpaint.py
samples/python2/inpaint.py
+35
-0
watershed.py
samples/python2/watershed.py
+1
-2
No files found.
samples/python2/inpaint.py
0 → 100644
View file @
afad87b5
import
numpy
as
np
import
cv2
from
common
import
Sketcher
help_message
=
'''USAGE: inpaint.py [<image>]
Keys:
SPACE - update inpaint
r - restore image
ESC - exit
'''
if
__name__
==
'__main__'
:
import
sys
try
:
fn
=
sys
.
argv
[
1
]
except
:
fn
=
'../cpp/fruits.jpg'
print
help_message
img
=
cv2
.
imread
(
fn
)
img_mark
=
img
.
copy
()
mark
=
np
.
zeros
(
img
.
shape
[:
2
],
np
.
uint8
)
sketch
=
Sketcher
(
'img'
,
[
img_mark
,
mark
],
lambda
:
((
255
,
255
,
255
),
255
))
while
True
:
ch
=
cv2
.
waitKey
()
if
ch
==
27
:
break
if
ch
==
ord
(
' '
):
res
=
cv2
.
inpaint
(
img_mark
,
mark
,
3
,
cv2
.
INPAINT_TELEA
)
cv2
.
imshow
(
'inpaint'
,
res
)
if
ch
==
ord
(
'r'
):
img_mark
[:]
=
img
mark
[:]
=
0
sketch
.
show
()
samples/python2/watershed.py
View file @
afad87b5
...
...
@@ -36,7 +36,7 @@ class App:
def
run
(
self
):
while
True
:
ch
=
cv2
.
waitKey
(
1
0
)
ch
=
cv2
.
waitKey
(
5
0
)
if
ch
==
27
:
break
if
ch
>=
ord
(
'1'
)
and
ch
<=
ord
(
'7'
):
...
...
@@ -52,7 +52,6 @@ class App:
self
.
markers
[:]
=
0
self
.
markers_vis
[:]
=
self
.
img
self
.
sketch
.
show
()
cv2
.
destroyWindow
(
'watershed'
)
if
__name__
==
'__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