gtatters / Thermimage

R Package for working with radiometric thermal image files and data
GNU General Public License v3.0
164 stars 41 forks source link

Equation to convert to temperature #14

Closed helenabdr closed 3 years ago

helenabdr commented 3 years ago

Hi there,

I think it is not a bug, but it is a question that I have no answer to. For some raw values of this function def raw2temp(raw, E=0.75, OD=1, RTemp=20, ATemp=28, IRWTemp=20, IRT=1, RH=60, PR1=15965.437, PB=1417.1, PF=1, PO=-3949, PR2=0.01401533) I have a mathematical lack due to log. But I've already checked all the metadata in my image and that's fine. Any idea?

gtatters commented 3 years ago

Indeed, not a bug, but a feature I think of how FLIR provides a generic equation that can work across a range of cameras with different resolutions. Since the image stores data in 16 bits, in principle, you have 2^16 bits of information, ranging from 0 to 65535.

See the calibration curve example I provide: https://github.com/gtatters/Thermimage/blob/master/README_files/figure-gfm/unnamed-chunk-18-1.png

You can see how the relationship is curvilinear and at some raw value (probably values below 3949 since the PO constant seems to define that), you will get NA values.

You can't estimate that cold anyway since it is well below the range of your camera.

gtatters commented 3 years ago

so try this, it might help explain:

raw<-1:65535 templookup<-raw2temp(raw, E=0.75, OD=1, RTemp=20, ATemp=28, IRWTemp=20, IRT=1, RH=60, PR1=15965.437, PB=1417.1, PF=1, PO=-3949, PR2=0.01401533) plot(raw, templookup, type='l')

helenabdr commented 3 years ago

I got it, thanks for the clarification!

gtatters commented 3 years ago

no problem. It confused me when I first worked this out! But that's why creating a 'lookup" helped make sense of it since you are essentially converting a digital integer value (integer) into a numeric. Every camera differs based on the unique calibration constants derived by the manufacturer.