WIFI传图做色块识别,手机上看不到框框怎办
-
手机上看不到把色块框起来的框框
-
需要编写程序的,你把你的程序贴一下
-
此回复已被删除!
-
import sensor, image, time, network, usocket, sys from pyb import UART,LED uart = UART(3, 1382400) #设置串口波特率 uart.init(1382400,timeout_char=100) green_threshold = ((42, 78, 34, 82, 0, 63))#目标颜色 # Reset sensor sensor.reset() # Set sensor settings sensor.set_contrast(1) sensor.set_brightness(1) sensor.set_saturation(1) sensor.set_gainceiling(16) sensor.set_framesize(sensor.QQVGA) sensor.set_pixformat(sensor.RGB565) sensor.skip_frames(10) sensor.set_auto_whitebal(False) # turn this off. #sensor.set_auto_gain(False) clock = time.clock() 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(uart.readchar()!=43): print("connect...") #连接成功LED显示 LED(1).on() time.sleep(2000) uart.write("HTTP/1.1 200 OK!\r\n" \ "Server: OpenMV\r\n" \ "Content-Type: multipart/x-mixed-replace;boundary=openmv\r\n" \ "Cache-Control: no-cache\r\n" \ "Pragma: no-cache\r\n\r\nend") # FPS clock time.sleep(4000) # Start streaming images # NOTE: Disable IDE preview to increase streaming FPS. while (True): clock.tick() # Track elapsed milliseconds between snapshots(). img = sensor.snapshot() cframe = img.compressed(quality=35) header = "\r\n--openmv\r\n" \ "Content-Type: image/jpeg\r\n"\ "Content-Length:"+str(cframe.size())+"\r\n\r\n" blobs = img.find_blobs([green_threshold]) if blobs: max_blob = find_max(blobs) pan_error = max_blob.cx()-img.width()/2 tilt_error = max_blob.cy()-img.height()/2 print("pan_error: ", pan_error) img.draw_rectangle(max_blob.rect()) # rect img.draw_cross(max_blob.cx(), max_blob.cy()) # cx, cy uart.write(header) uart.write(cframe) uart.write("end")
-
cframe = img.compressed(quality=35)
这一句,需要放在后面,需要在draw_rectangle/draw_cross后面,才可以让画出框框的图像发送出去。
-
谢谢你,我以后会常来这提问。谢谢。