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
1
Merge Requests
1
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
a48f1192
Commit
a48f1192
authored
Jul 18, 2024
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable prints to stdout (too verbose).
parent
0a6c02be
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
oi-sensor/oi-sensor.py
oi-sensor/oi-sensor.py
+3
-3
No files found.
oi-sensor/oi-sensor.py
View file @
a48f1192
...
@@ -132,7 +132,7 @@ async def main():
...
@@ -132,7 +132,7 @@ async def main():
contours
,
_
=
cv2
.
findContours
(
mask
,
cv2
.
RETR_TREE
,
cv2
.
CHAIN_APPROX_SIMPLE
)
contours
,
_
=
cv2
.
findContours
(
mask
,
cv2
.
RETR_TREE
,
cv2
.
CHAIN_APPROX_SIMPLE
)
now
=
time
.
time
()
*
1000
now
=
time
.
time
()
*
1000
diff
=
(
now
-
before
)
diff
=
(
now
-
before
)
print
(
"Processing time = %.2f ms, countours = %d"
%
(
diff
,
len
(
contours
)))
#
print("Processing time = %.2f ms, countours = %d" %(diff, len(contours)))
contour_detected
=
False
contour_detected
=
False
for
cnt
in
contours
:
for
cnt
in
contours
:
area
=
cv2
.
contourArea
(
cnt
)
area
=
cv2
.
contourArea
(
cnt
)
...
@@ -158,7 +158,7 @@ async def main():
...
@@ -158,7 +158,7 @@ async def main():
result
=
3.0
result
=
3.0
# printout
# printout
print
(
"
\
t
Detected area (px)=%.2f, result=%d, shape changes=%d"
%
(
area
,
result
,
shape_change_counter
))
#
print("\tDetected area (px)=%.2f, result=%d, shape changes=%d" %(area, result, shape_change_counter))
# update list for last X results (FILO)
# update list for last X results (FILO)
if
current_shape
!=
result
:
if
current_shape
!=
result
:
...
@@ -179,7 +179,7 @@ async def main():
...
@@ -179,7 +179,7 @@ async def main():
shape_change_counter
+=
1
shape_change_counter
+=
1
await
myvar
.
write_value
(
result
)
await
myvar
.
write_value
(
result
)
current_shape
=
result
current_shape
=
result
print
(
"
\
t
No shape detected, result=%d, shape changes=%d"
%
(
result
,
shape_change_counter
))
#
print("\tNo shape detected, result=%d, shape changes=%d" %(result, shape_change_counter))
# show current MASK and camera output windows
# show current MASK and camera output windows
if
not
headless
:
if
not
headless
:
...
...
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