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
f4a4afa9
Commit
f4a4afa9
authored
Oct 05, 2020
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Swithc on air valvle if detection.
parent
a5697ea2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
eggs/osie_plc/osie_ocr.py
eggs/osie_plc/osie_ocr.py
+14
-2
No files found.
eggs/osie_plc/osie_ocr.py
View file @
f4a4afa9
...
@@ -6,14 +6,25 @@ based on number of countours control a modbus server remotely.
...
@@ -6,14 +6,25 @@ based on number of countours control a modbus server remotely.
import
cv2
import
cv2
import
numpy
as
np
import
numpy
as
np
import
pymodbus
import
pymodbus
from
pymodbus.client.sync
import
ModbusTcpClient
as
ModbusClient
UNIT
=
0x1
def
nothing
(
x
):
def
nothing
(
x
):
# any operation
# any operation
pass
pass
def
sendModbusCommand
():
"""
XXX: Pure example.
"""
client
=
ModbusClient
(
'localhost'
,
port
=
502
)
client
.
connect
()
rr
=
client
.
read_coils
(
1
,
1
,
unit
=
UNIT
)
client
.
write_coils
(
1
,
[
not
rr
.
bits
[
0
]],
unit
=
UNIT
)
client
.
close
()
#sendModbusCommand()
cap
=
cv2
.
VideoCapture
(
1
)
cap
=
cv2
.
VideoCapture
(
1
)
cv2
.
namedWindow
(
"Trackbars"
)
cv2
.
namedWindow
(
"Trackbars"
)
cv2
.
createTrackbar
(
"L-H"
,
"Trackbars"
,
0
,
180
,
nothing
)
cv2
.
createTrackbar
(
"L-H"
,
"Trackbars"
,
0
,
180
,
nothing
)
cv2
.
createTrackbar
(
"L-S"
,
"Trackbars"
,
66
,
255
,
nothing
)
cv2
.
createTrackbar
(
"L-S"
,
"Trackbars"
,
66
,
255
,
nothing
)
...
@@ -64,7 +75,8 @@ while True:
...
@@ -64,7 +75,8 @@ while True:
elif
len
(
approx
)
==
4
:
elif
len
(
approx
)
==
4
:
cv2
.
putText
(
frame
,
"Rectangle"
,
(
x
,
y
),
font
,
1
,
(
0
,
0
,
0
))
cv2
.
putText
(
frame
,
"Rectangle"
,
(
x
,
y
),
font
,
1
,
(
0
,
0
,
0
))
elif
10
<
len
(
approx
)
<
20
:
elif
10
<
len
(
approx
)
<
20
:
cv2
.
putText
(
frame
,
"Circle"
,
(
x
,
y
),
font
,
1
,
(
0
,
0
,
0
))
cv2
.
putText
(
frame
,
"Circle-fire!"
,
(
x
,
y
),
font
,
1
,
(
0
,
0
,
0
))
sendModbusCommand
()
cv2
.
imshow
(
"Frame"
,
frame
)
cv2
.
imshow
(
"Frame"
,
frame
)
cv2
.
imshow
(
"Mask"
,
mask
)
cv2
.
imshow
(
"Mask"
,
mask
)
...
...
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