logo

如何获取一个像素点的LAB值

2021-03-10 14:18
Y
_6g4g

如何获取一个像素点的LAB值

image.get_pixel()函数只能获取RGB

2021-03-10 16:43
I
网红小智智 星瞳科技

https://docs.singtown.com/micropython/zh/latest/openmvcam/library/omv.image.html#image.rgb_to_lab

用函数转换一下。

2021-03-10 18:47
Y
_6g4g
d05aadf0-f965-4600-9f03-137b66218af6.png

用这个函数会报错呢?请问是为什么呢

2021-03-11 18:00
I
网红小智智 星瞳科技
import sensor, image, time

sensor.reset()                      # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # 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.
clock = time.clock()                # Create a clock object to track the FPS.

while(True):
    clock.tick()                    # Update the FPS clock.
    img = sensor.snapshot()         # Take a picture and return the image.
    pixel_rgb = img.get_pixel(0,0)
    print(pixel_rgb)
    pixel_lab = image.rgb_to_lab(pixel_rgb)
    print(pixel_lab)
2021-04-27 10:57
V
aomg

直接用模块名,不用实例名调用