logo

mlx90640调色问题 调色不一致

2022-03-05 12:50
O
_1lte
import image, time, fir

drawing_hint = image.BICUBIC # or image.BILINEAR or 0 (nearest neighbor)

# Initialize the thermal sensor
fir.init()
w = fir.width()
h = fir.height()

if (fir.type() == fir.FIR_MLX90621):
    w = w * 10
    h = h * 10
elif (fir.type() == fir.FIR_MLX90640):
    w = w * 10
    h = h * 10
elif (fir.type() == fir.FIR_MLX90641):
    w = w * 10
    h = h * 10
elif (fir.type() == fir.FIR_AMG8833):
    w = w * 20
    h = h * 20

# FPS clock
clock = time.clock()

while (True):
    clock.tick()

    try:
        img = fir.snapshot(x_size=w, y_size=h,
                           color_palette=fir.PALETTE_IRONBOW, hint=drawing_hint,
                           copy_to_fb=True)
    except OSError:
        continue

    # Print FPS.
    print(clock.fps())
a58fc818-0079-45a6-9ae6-e9eb61f21151.png

而我仿照编写的程序 为了放在摄像头图像上

import image, time, fir, sensor

drawing_hint = image.BILINEAR # or image.BILINEAR or 0 (nearest neighbor) or image.BICUBIC

# Initialize the thermal sensor
sensor.reset()
#初始化摄像头,reset()是sensor模块里面的函数

sensor.set_pixformat(sensor.RGB565)
#设置图像色彩格式,有RGB565色彩图和GRAYSCALE灰度图两种

sensor.set_framesize(sensor.QVGA)
#设置图像像素大小



sensor.skip_frames(time = 2000)
fir.init(type=fir.FIR_MLX90640, refresh=32)
w = fir.width()*10
h = fir.height()*10
ir_buffer =  fir.snapshot(x_size=w, y_size=h, pixformat=sensor.GRAYSCALE)

clock = time.clock()

while (True):
    clock.tick()
    img = sensor.snapshot()
    ta, ir, to_min, to_max = fir.read_ir()
    to_max=to_max/0.92
    fir.draw_ir(ir_buffer, ir, alpha=256, hint=drawing_hint)
    img.draw_image(ir_buffer, 0, 0, alpha=256,color_palette=fir.PALETTE_IRONBOW)

出来的图像调色是这样的

125c3dc4-a193-4443-b513-5ed82838ebef.png

怎么才能变成上面那幅图的调色

O
_1lte

我怎么感觉图像颜色反了,温度越低反而越深,怎么调整一下比较合适

2022-03-07 19:08
I
网红小智智 星瞳科技

https://book.openmv.cc/example/12-Thermopile-Shield/MLX90621-overlay.html

2026-06-11 22:00
8
832w72ppvimb

为啥我跑这段代码都跑不了

2026-06-12 09:53
Z
星小瞳xs

请提供报错代码和屏幕截图