Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
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_contrib
Commits
5925bc53
Commit
5925bc53
authored
May 22, 2015
by
BISMOY MURASING
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code to grab the red lined polygon from Google Maps
parent
c9fb3913
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
0 deletions
+30
-0
findredlinedpolygonfromgooglemaps.py
...les/ximgproc/samples/findredlinedpolygonfromgooglemaps.py
+30
-0
polygonstanfordoutput.png
modules/ximgproc/samples/polygonstanfordoutput.png
+0
-0
stanford.png
modules/ximgproc/samples/stanford.png
+0
-0
No files found.
modules/ximgproc/samples/findredlinedpolygonfromgooglemaps.py
0 → 100644
View file @
5925bc53
# USAGE - How to run this code ?
# python find_shapes.py --image shapes.png
#python findredlinedpolygonfromgooglemaps.py --image stanford.png
import
numpy
as
np
import
argparse
import
cv2
# construct the argument parse and parse the arguments
ap
=
argparse
.
ArgumentParser
()
ap
.
add_argument
(
"-i"
,
"--image"
,
help
=
"path to the image file"
)
args
=
vars
(
ap
.
parse_args
())
# load the image
image
=
cv2
.
imread
(
args
[
"image"
])
lower
=
np
.
array
([
20
,
0
,
155
])
upper
=
np
.
array
([
255
,
120
,
250
])
shapeMask
=
cv2
.
inRange
(
image
,
lower
,
upper
)
# find the contours in the mask
(
cnts
,
_
)
=
cv2
.
findContours
(
shapeMask
.
copy
(),
cv2
.
RETR_EXTERNAL
,
cv2
.
CHAIN_APPROX_SIMPLE
)
cv2
.
imshow
(
"Mask"
,
shapeMask
)
# loop over the contours
for
c
in
cnts
:
cv2
.
drawContours
(
image
,
[
c
],
-
1
,
(
0
,
255
,
0
),
2
)
cv2
.
imshow
(
"Image"
,
image
)
cv2
.
waitKey
(
0
)
\ No newline at end of file
modules/ximgproc/samples/polygonstanfordoutput.png
0 → 100644
View file @
5925bc53
37.4 KB
modules/ximgproc/samples/stanford.png
0 → 100644
View file @
5925bc53
872 KB
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