Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-235
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-235
2021-235
Commits
0979293b
Commit
0979293b
authored
Nov 26, 2021
by
Dinuja Theeraj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
58b033a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
get_data.py
get_data.py
+40
-0
No files found.
get_data.py
0 → 100644
View file @
0979293b
from
cv2
import
cv2
import
random
scale
=
0.5
circles
=
[]
counter
=
0
counter2
=
0
point1
=
[]
point2
=
[]
myPoints
=
[]
myColor
=
[]
def
mousePoints
(
event
,
x
,
y
,
flags
,
params
):
global
counter
,
point1
,
point2
,
counter2
,
circles
,
myColor
if
event
==
cv2
.
EVENT_LBUTTONDOWN
:
if
counter
==
0
:
point1
=
int
(
x
//
scale
),
int
(
y
//
scale
)
counter
+=
1
myColor
=
(
random
.
randint
(
0
,
2
)
*
200
,
random
.
randint
(
0
,
2
)
*
200
,
random
.
randint
(
0
,
2
)
*
200
)
elif
counter
==
1
:
point2
=
int
(
x
//
scale
),
int
(
y
//
scale
)
types
=
input
(
'Enter Type '
)
name
=
input
(
'Enter Name '
)
myPoints
.
append
([
point1
,
point2
,
types
,
name
])
counter
=
0
circles
.
append
([
x
,
y
,
myColor
])
counter2
+=
1
img
=
cv2
.
imread
(
'template.jpg'
)
h
,
w
,
c
=
img
.
shape
img
=
cv2
.
resize
(
img
,
(
w
//
3
,
h
//
3
),
None
,
scale
,
scale
)
while
True
:
for
x
,
y
,
color
in
circles
:
cv2
.
circle
(
img
,(
x
,
y
),
3
,
color
,
cv2
.
FILLED
)
cv2
.
imshow
(
"Original Image "
,
img
)
cv2
.
setMouseCallback
(
"Original Image "
,
mousePoints
)
if
cv2
.
waitKey
(
1
)
&
0xFF
==
ord
(
's'
):
print
(
myPoints
)
break
\ No newline at end of file
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