@kidswong999 另外想问下有没有方法做一个白底黑色圆的蒙版的方法?
M
m1aw
@m1aw
0
声望
44
楼层
567
资料浏览
0
粉丝
0
关注
m1aw 发布的帖子
-
蒙版mask使用问题
mask为全黑图片中有个白色的圆,如下图:
在clear中使用该mask,想要达到的效果应该是中间白色圆部分变黑,但实际却得到了些很奇怪的结果,如下图:
代码如下:# Untitled - By: User6151644 - 周三 10月 11 2023 import sensor, image, time sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.SXGA) sensor.skip_frames(time = 2000) clock = time.clock() x=544 y=515 radius1=286 radius2=350 mask = sensor.snapshot(copy_to_fb=False) mask.clear() mask.draw_circle((x,y,radius2),color=(255,255,255),fill=True) while(True): clock.tick() img = sensor.snapshot().clear(mask=mask) print(clock.fps())
所用机器是openmv4h7plus
-
RuntimeError:Frame size is not supported or is not set 错误
openmv4H7 set_windowing后报错
import sensor, image, time from pyb import USB_VCP usb = USB_VCP() sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.VGA) sensor.skip_frames(time = 2000) sensor.set_windowing((134,243,113,110)) clock = time.clock() img = sensor.snapshot() while(True): clock.tick() img = sensor.snapshot()
请问这是什么问题
-
虚拟串口如何得到int型数据?
想通过虚拟串口接收int数据,但是以下代码却得不到想要的结果。本来应该是发送1,led灯会亮,但是实际上却不行
代码:import sensor, image, time, ustruct from pyb import USB_VCP,LED green_led = LED(2) red_led = LED(1) usb = USB_VCP() sensor.reset() # Reset and initialize the sensor. sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240) sensor.skip_frames(time = 2000) # Wait for settings take effect. while(True): if USB_VCP.any(): cmd = usb.readline().decode().strip() val = int(cmd) if (val == 1): green_led.on()