Get grayscale image from MLX90640


I have been trying to get the output from the fir.snapshot() to be grayscale but that does not seem to work, and gives me the error:
AttributeError: ‘module’ object has no attribute ‘PIXFORMAT_GRAYSCALE’ when running:
img = fir.snapshot(x_size = w, y_size = h, hint = drawing_hint, copy_to_fb = True, hmirror = False, vflip = True, pixformat=fir.PIXFORMAT_GRAYSCALE, scale = [27, 50]).
It gives me the same error even trying to use fir.PIXFORMAT_RGB565, which is the default I believe.

Any help on how to get the grayscale image out instead of a colour image would be amazing. Thanks so much for your help!

Documentation bug.

It’s just fir.GRAYSCALE.

Can you make a bug tracker on the openmv github about this?


Hi, thanks for the quick response, this has resolved the issue for me. I have also created a new issue on github.

Another question, is there a way to reverse the grayscale easily, so that hotter is whiter, like with the FLIR lepton? It appears to be the other way around for me, where the darker it is the warmer it is.

Thanks again!

There’s a method in the image processing library for this. Please see the documentation. It’s a one liner.