Ask Your Question

Revision history [back]

Help with normalising

Hi all, trying to get useful data out of my Flir Lepton thermal camera.

It's giving me an 80x60 array of numbers, which can range from 0 to 65536, but they're usually around the 8000-mark.

The default pylepton_overlay code just uses cv2.normalize to stretch everything based on the min and max samples in the image. But the normalisation obviously changes based o n what's in the image.

What I want to do is clip everything below 7000 and above 9000, and normalise 7000 -> 0 and 9000 -> 65536.

Clipping is easy:

cv2.max(image,7000,image)

cv2.min(image,9000,image)

Now how do I nromalise to only the range of 7000:9000?

So far the auto-min/max code is:

cv2.normalize(image,image,0,65536,cv2.NORM_MINMAX,-1) # it needs another ',mask' at the end, that's what I want to know the format of.

The docs page is rather unhelpfully scant, "If you want to only use the mask to calculate the norm or min-max but modify the whole array, you can use norm() and Mat::convertTo()."

Yes, that's exactly what I want to do. Use a mask of ranges 7000 to 9000 as the min-max and normalise the whole array. Can anyone help me out as to how/syntax please?