麻烦请问OPENMV 阈值二值化的数学模型是什么呢?资料中没有找到,是wallner算法吗?还是其他的,望大神解答
fuzs
@fuzs
fuzs 发布的帖子
-
RE: 像素块数量提取的相关问题
Single Color RGB565 Blob Tracking Example
This example shows off single color RGB565 tracking using the OpenMV Cam.
import sensor, image, time, math, lcd
from pyb import UARTColor Tracking Thresholds (L Min, L Max, A Min, A Max, B Min, B Max)
The below thresholds track in general red/green/blue things. You may wish to tune them...
thresholds = (0, 100, -128, -7, -9, 127), # generic_red_thresholds
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA) # 320*240
sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False) # must be turned off for color tracking
sensor.set_auto_whitebal(False) # must be turned off for color tracking
clock = time.clock()
lcd.init()
uart = UART(3, 9600, timeout_char=1000) # i使用给定波特率初始化
uart.init(9600, bits=8, parity=None, stop=0, timeout_char=1000) # 使用给定参数初始化Only blobs that with more pixels than "pixel_threshold" and more area than "area_threshold" are
returned by "find_blobs" below. Change "pixels_threshold" and "area_threshold" if you change the
camera resolution. "merge=True" merges all overlapping blobs in the image.
while(True):
clock.tick()
img = sensor.snapshot()
for blob in img.find_blobs([thresholds[0]], pixels_threshold=3000, area_threshold=3000, merge=True):
img.draw_rectangle(blob.rect())
img.draw_cross(blob.cx(), blob.cy())
a = 76800
b = blob.pixels()
c = b/a
d = int(255-255*c)
img.draw_string(100,150,'b='+str(b),color=(0,0,0))
img.draw_string(100,170,'c='+str(c),color=(0,0,0))
lcd.display(img)
uart.writechar(d) # write 1 character 写入一个字符
#time.sleep(500)
print(a, b, c, d)
print(clock.fps()) -
像素块数量提取的相关问题
麻烦请问各位,就是在使用blob.pixels()提取捕捉像素块的数量时,若没有捕捉对象在视野范围内,那么blob.pixels()就没有数据显示(即print没有任何数据显示),
如图所示,上面的部分为视野里有捕捉对象返回的数据,下面的部分为视野里没有捕捉对象返回的数据如何设置才能使没有捕捉对象也能返回一个值(比如说返回0)