EasyManua.ls Logo

SunFounder PiCrawler Kit - Page 65

Default Icon
137 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
SunFounder PiCrawler Kit
(continued from previous page)
print('Color detect : %s'%color_list[index])
# face detection
elif key =="f":
flag_face = not flag_face
face_detect(flag_face)
# qrcode detection
elif key =="r":
qr_code_flag = not qr_code_flag
if qr_code_flag == True:
if qrcode_thread == None or not qrcode_thread.is_alive():
qrcode_thread = threading.Thread(target=qrcode_detect)
qrcode_thread.setDaemon(True)
qrcode_thread.start()
else:
if qrcode_thread != None and qrcode_thread.is_alive():
# wait for thread to end
qrcode_thread.join()
print('QRcode Detect: close')
# show detected object information
elif key == "s":
object_show()
sleep(0.5)
if __name__ == "__main__":
main()
How it works?
The first thing you need to pay attention to here is the following function. These two functions allow you to start the
camera.
Vilib.camera_start()
Vilib.display()
Functions related to “object detection”:
Vilib.face_detect_switch(True) : Switch ON/OFF face detection
Vilib.color_detect(color) : For color detection, only one color detection can be performed at the
same time. The parameters that can be input are: "red", "orange", "yellow", "green", "blue",
"purple"
Vilib.color_detect_switch(False) : Switch OFF color detection
Vilib.qrcode_detect_switch(False) : Switch ON/OFF QR code detection, Returns the decoded
data of the QR code.
Vilib.gesture_detect_switch(False) : Switch ON/OFF gesture detection
Vilib.traffic_sign_detect_switch(False) : Switch ON/OFF traffic sign detection
The information detected by the target will be stored in the detect_obj_parameter = Manager().dict()
dictionary.
In the main program, you can use it like this:
Vilib.detect_obj_parameter['color_x']
3.7. Computer Vision 61

Other manuals for SunFounder PiCrawler Kit

Related product manuals