Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
osie
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
nexedi
osie
Commits
d09c5642
Commit
d09c5642
authored
May 21, 2024
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a trackbar which allows user to define the number of pixels
which make up an area of interest for evaluation for us.
parent
12bb1632
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
oi-sensor/oi-sensor.py
oi-sensor/oi-sensor.py
+5
-1
No files found.
oi-sensor/oi-sensor.py
View file @
d09c5642
...
...
@@ -27,6 +27,7 @@ DEFAULT_LV = (0, 255,)
DEFAULT_UH
=
(
135
,
180
,)
DEFAULT_US
=
(
190
,
255
,)
DEFAULT_UV
=
(
190
,
255
,)
DEFAULT_AREA
=
(
400
,
1000
,)
# command line handling
parser
=
argparse
.
ArgumentParser
(
description
=
'Run optical inspection OPC UA server.'
)
...
...
@@ -73,6 +74,7 @@ async def main():
cv2
.
createTrackbar
(
"U-H"
,
"Trackbars"
,
DEFAULT_UH
[
0
],
DEFAULT_UH
[
1
],
nothing
)
cv2
.
createTrackbar
(
"U-S"
,
"Trackbars"
,
DEFAULT_US
[
0
],
DEFAULT_US
[
1
],
nothing
)
cv2
.
createTrackbar
(
"U-V"
,
"Trackbars"
,
DEFAULT_UV
[
0
],
DEFAULT_UV
[
1
],
nothing
)
cv2
.
createTrackbar
(
"Area"
,
"Trackbars"
,
DEFAULT_AREA
[
0
],
DEFAULT_AREA
[
1
],
nothing
)
_logger
.
info
(
"Starting server!"
)
async
with
server
:
...
...
@@ -92,6 +94,7 @@ async def main():
u_h
=
cv2
.
getTrackbarPos
(
"U-H"
,
"Trackbars"
)
u_s
=
cv2
.
getTrackbarPos
(
"U-S"
,
"Trackbars"
)
u_v
=
cv2
.
getTrackbarPos
(
"U-V"
,
"Trackbars"
)
designated_area
=
cv2
.
getTrackbarPos
(
"Area"
,
"Trackbars"
)
else
:
# read defaults provided
l_h
=
DEFAULT_LH
[
0
]
...
...
@@ -100,6 +103,7 @@ async def main():
u_h
=
DEFAULT_UH
[
0
]
u_s
=
DEFAULT_US
[
0
]
u_v
=
DEFAULT_UV
[
0
]
designated_area
=
DEFAULT_AREA
[
0
]
lower_red
=
np
.
array
([
l_h
,
l_s
,
l_v
])
upper_red
=
np
.
array
([
u_h
,
u_s
,
u_v
])
...
...
@@ -117,7 +121,7 @@ async def main():
x
=
approx
.
ravel
()[
0
]
y
=
approx
.
ravel
()[
1
]
if
area
>
400
:
if
area
>
designated_area
:
cv2
.
drawContours
(
frame
,
[
approx
],
0
,
(
0
,
0
,
0
),
5
)
number_of_points
=
len
(
approx
)
if
number_of_points
==
3
:
...
...
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