脱机运行帧率变低......
-
import sensor, image, time from pyb import UART sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QQVGA) sensor.skip_frames(time = 2000) clock = time.clock() sensor.set_auto_gain(False) sensor.set_auto_whitebal(False) sensor.set_windowing((10,0,130,120)) color_threshold =(71, 100, -10, 10, -21, 24) uart=UART(3,115200) def find_max(blobs): max_size=0 for blob in blobs: if blob[2]*blob[3] > max_size: max_blob=blob max_size = blob[2]*blob[3] return max_blob while(True): clock.tick() img = sensor.snapshot().lens_corr(1.8) blobs = img.find_blobs([color_threshold],area_threshold=50,pixels_threshold=50) #blobs = img.find_blobs([color_threshold]) if blobs: max_blob = find_max(blobs) img.draw_rectangle(max_blob.rect()) img.draw_cross(max_blob.cx(),max_blob.cy()) uart.write("x:%03d,y:%03d\r\n"%(max_blob.cx(),max_blob.cy())) print("x:%03d,y:%03d\r\n"%(max_blob.cx(),max_blob.cy())) print(clock.fps())
OPENMV4 H7 ov7725
固件版本4.0.2
-