logo

求助:为什么二值化以后仍然有灰色的像素点?

2018-12-05 15:21
1
小陈

图上,黑色的线周围有一些灰色的像素点,不知道是怎么回事0.0......求教


import sensor, image, time

sensor.reset()
sensor.set_framesize(sensor.QVGA)
sensor.set_pixformat(sensor.RGB565)


Line_threshold = (60, 100, -18, 32, -33, 56) # L A B

sensor.skip_frames(time = 1000)
clock = time.clock()

min_degree = 0
max_degree = 179
#img_raw = sensor.snapshot().lens_corr(1.8).save('123.bmp')




img_op=image.Image('123.bmp',copy_to_fb=True)


    #time.sleep(3000)
img_op.binary([Line_threshold])

#img_op.erode(2)

img_op.dilate(1)
img_op.erode(1)
for l in img_op.find_lines (threshold = 3300, theta_margin = 1000, rho_margin = 10):
        if (min_degree <= l.theta()) and (l.theta() <= max_degree):

           # img_op.draw_line(l.line(), color = (255, 0, 0))

            print(l.theta())



sensor.flush()

time.sleep(100)
77544b81-692f-4965-9b9e-91ea615e2c3d.jpg
I
网红小智智 星瞳科技

这只是OpenMV把图像传输给电脑的时候的压缩失真,不影响代码。

OpenMV的图片肯定是黑白的。

1
小陈
bf236752-1106-4b93-b6bf-682725ea8f63.jpg

就像这样的。

I
网红小智智 星瞳科技

新的问题,请单独发帖子。