資源簡介
openmv后視鏡.zip

代碼片段和文件信息
#?Iris?Detection?2?Example
#
#?This?example?shows?how?to?find?the?eye?gaze?(pupil?detection)?after?finding
#?the?eyes?in?an?image.?This?script?uses?the?find_eyes?function?which?determines
#?the?center?point?of?roi?that?should?contain?a?pupil.?It?does?this?by?basically
#?finding?the?center?of?the?darkest?area?in?the?eye?roi?which?is?the?pupil?center.
#
#?Note:?This?script?does?not?detect?a?face?first?use?it?with?the?telephoto?lens.
import?sensor?time?image
from?pyb?import?UART
from?pyb?import?LED
red_led???=?LED(1)
green_led?=?LED(2)
blue_led??=?LED(3)
ir_led????=?LED(4)
uart?=?UART(3?115200)
#?Reset?sensor
sensor.reset()
#?Sensor?settings
sensor.set_contrast(3)
sensor.set_gainceiling(64)
#?Set?resolution?to?VGA.
sensor.set_framesize(sensor.VGA)
#?Bin/Crop?image?to?200x100?which?gives?more?details?with?less?data?to?process
sensor.set_windowing((220?190?200?100))
sensor.set_pixformat(sensor.GRAYSCALE)
#?Load?Haar?Cascade
#?By?default?this?will?use?all?stages?lower?stages?is?faster?but?less?accurate.
eyes_cascade?=?image.HaarCascade(“eye“?stages=24)
print(eyes_cascade)
#?FPS?clock
clock?=?time.clock()
while?(True):
????clock.tick()
????green_led.on()
????#?Capture?snapshot
????img?=?sensor.snapshot()
????#?Find?eyes?!
????#?Note:?Lower?scale?factor?scales-down?the?image?more?and?detects?smaller?objects.
????#?Higher?threshold?results?in?a?higher?detection?rate?with?more?false?positives.
????eyes?=?img.find_features(eyes_cascade?threshold=0.5?scale_factor=1.5)
????#?Find?iris
????for?e?in?eyes:
????????iris?=?img.find_eye(e)
????????print(iris)
????????#uart.write(iris)
????????#uart.write(iris[1])
????????output_str=“%.3d%.3d“?%?(iris[0]?iris[1])?#方式1
????????if?output_str!=0:?red_led.on()
????????time.sleep(20)
????????red_led.off()
???????????????#output_str=json.dumps([max_blob.cx()max_blob.cy()])?#方式2
???????????????#print(‘you?send:‘output_str)
????????uart.write(output_str+‘\r\n‘)
????????
????????img.draw_rectangle(e)
????????img.draw_cross(iris[0]?iris[1])
????#?Print?FPS.
????#?Note:?Actual?FPS?is?higher?streaming?the?FB?makes?it?slower.
?????#print(1)
?????#print(2)
????#print(clock.fps())
????#uart.write(“Hello?World!\r“)
????time.sleep(10)
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????349249??2018-12-16?12:53??后視鏡驅動\OBJ\timer.crf
?????目錄???????????0??2019-05-12?23:37??后視鏡驅動\
?????目錄???????????0??2019-05-12?23:37??后視鏡驅動\CORE\
?????文件???????17273??2010-06-07?10:25??后視鏡驅動\CORE\core_cm3.c
?????文件???????85714??2011-02-09?14:59??后視鏡驅動\CORE\core_cm3.h
?????文件???????17273??2010-06-07?10:25??后視鏡驅動\CORE\core_cm3_1.c
?????文件???????85714??2011-02-09?14:59??后視鏡驅動\CORE\core_cm3_1.h
?????文件???????15503??2011-03-10?10:52??后視鏡驅動\CORE\startup_stm32f10x_hd.s
?????文件???????12955??2017-08-03?17:35??后視鏡驅動\CORE\startup_stm32f10x_md.s
?????目錄???????????0??2019-05-12?23:37??后視鏡驅動\HARDWARE\
?????目錄???????????0??2019-05-12?23:37??后視鏡驅動\HARDWARE\CAN\
?????文件????????5056??2018-11-06?09:49??后視鏡驅動\HARDWARE\CAN\can.c
?????文件?????????389??2018-11-06?08:42??后視鏡驅動\HARDWARE\CAN\can.h
?????目錄???????????0??2019-05-12?23:37??后視鏡驅動\HARDWARE\KEY\
?????文件????????1060??2018-11-06?08:56??后視鏡驅動\HARDWARE\KEY\key.c
?????文件?????????575??2018-11-06?08:20??后視鏡驅動\HARDWARE\KEY\key.h
?????目錄???????????0??2019-05-12?23:37??后視鏡驅動\HARDWARE\LCD\
?????文件???????35016??2015-03-13?14:54??后視鏡驅動\HARDWARE\LCD\font.h
?????文件???????85363??2018-11-09?09:16??后視鏡驅動\HARDWARE\LCD\lcd.c
?????文件????????7529??2015-04-24?11:48??后視鏡驅動\HARDWARE\LCD\lcd.h
?????目錄???????????0??2019-05-12?23:37??后視鏡驅動\HARDWARE\LED\
?????文件?????????836??2018-11-09?21:14??后視鏡驅動\HARDWARE\LED\led.c
?????文件?????????171??2018-11-08?10:05??后視鏡驅動\HARDWARE\LED\led.h
?????文件????????2346??2018-11-13?22:12??后視鏡驅動\HARDWARE\motor.c
?????文件?????????463??2018-11-13?21:25??后視鏡驅動\HARDWARE\motor.h
?????文件????????1624??2018-11-13?21:26??后視鏡驅動\HARDWARE\timer.c
?????文件?????????109??2018-11-08?10:17??后視鏡驅動\HARDWARE\timer.h
?????目錄???????????0??2019-05-12?23:37??后視鏡驅動\OBJ\
?????文件??????359764??2018-12-16?12:53??后視鏡驅動\OBJ\CAN.axf
?????文件????????1851??2018-12-16?12:53??后視鏡驅動\OBJ\CAN.build_log.htm
?????文件???????31056??2018-12-16?12:53??后視鏡驅動\OBJ\CAN.hex
............此處省略159個文件信息
評論
共有 條評論