get_regression的阈值参数放上我用阈值编辑器得到的返回值为空,放上[(100,100)]就有返回值!!?
-
# Untitled - By: xiongM - 周日 7月 23 2023 THRESHOLD = (17, 83, -17, 8, -11, 11) # Grayscale threshold for dark things... GRAY = (44, 255) import sensor, image, time, lcd from pyb import LED sensor.reset() sensor.set_vflip(True) sensor.set_hmirror(True) sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QQQVGA) # 80x60 (4,800 pixels) - O(N^2) max = 2,3040,000. sensor.set_auto_gain(False) sensor.set_auto_whitebal(False) #sensor.set_windowing([80,60]) sensor.skip_frames(time = 2000) # WARNING: If you use QQVGA it may take seconds clock = time.clock() # to process a frame sometimes. lcd.init() while(True): img = sensor.snapshot().binary([THRESHOLD], invert=True) #如果这儿是上面的THRESHOLD ,line就为空,如果是下面的100,100就能成功拟合 line = img.get_regression([(100,100)], robust = True) if(line): img.draw_line(line.line(), color = 127) if line.theta()>90: theta_err = line.theta()-180 else: theta_err = line.theta() print(theta_err, line.magnitude(), line.rho())
-
这是正常的,img.binary后,img就是黑白的了,就不能用彩色的阈值了。
-
二值化后的get_regression的的阈值一项应该放二值化过后图像的灰度阈值?这样理解对么?
-
@kxr4 是的。