Closed kyrahendersonn closed 3 years ago
it would help if you attached the image for me to test. it looks like it is not a radiometric jpg (but I have no way of testing what users might try to import) and thus cannot be imported with this function. Maybe look through some of the older issues where this has come up many times as people try to import non-radiometric jpgs.
[image: test.jpeg]Here is a test image! Thank you for the quick response
On Fri, Apr 30, 2021 at 2:25 PM Glenn Tattersall @.***> wrote:
it would help if you attached the image for me to test. it looks like it is not a radiometric jpg (but I have no way of testing what users might try to import) and thus cannot be imported with this function. Maybe look through some of the older issues where this has come up many times as people try to import non-radiometric jpgs.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gtatters/Thermimage/issues/17#issuecomment-830408080, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASSVUBOAVHEBXSPQZ5T2KYTTLMN4TANCNFSM435QDGMA .
no image attached. also, if you want me to check the code, you'll need to attach all the code not just screenshots of portions of it. Kind of hard to troubleshoot with only snippets of info.
`library(tools)
library(Thermimage)
library(exifr)
library(png)
library(fields)
setwd("/Volumes/bde/R_photos/flirone") #set directory to dated folder of images
imgDir<-"/Volumes/bde/R_photos/flirone" l.files<-list_files_with_exts(imgDir, full.names = TRUE, c("jpg","JPG","JPEG"))
for(fn in l.files)
{
img<-readflirJPG(fn, exiftoolpath = "installed")
f<-paste0(fn)
cams<-flirsettings(f, exiftoolpath="installed", camvals="")
ObjectEmissivity<- cams$Info$Emissivity # Image Saved Emissivity - should be ~0.95 or 0.96
dateOriginal<-cams$Dates$DateTimeOriginal # Original date/time extracted from file
dateModif<- cams$Dates$FileModificationDateTime # Modification date/time extracted from file
PlanckR1<- cams$Info$PlanckR1 # Planck R1 constant for camera
PlanckB<- cams$Info$PlanckB # Planck B constant for camera
PlanckF<- cams$Info$PlanckF # Planck F constant for camera
PlanckO<- cams$Info$PlanckO # Planck O constant for camera
PlanckR2<- cams$Info$PlanckR2 # Planck R2 constant for camera
ATA1<- cams$Info$AtmosphericTransAlpha1 # Atmospheric Transmittance Alpha 1
ATA2<- cams$Info$AtmosphericTransAlpha2 # Atmospheric Transmittance Alpha 2
ATB1<- cams$Info$AtmosphericTransBeta1 # Atmospheric Transmittance Beta 1
ATB2<- cams$Info$AtmosphericTransBeta2 # Atmospheric Transmittance Beta 2
ATX<- cams$Info$AtmosphericTransX # Atmospheric Transmittance X
OD<- cams$Info$ObjectDistance # object distance in metres
FD<- cams$Info$FocusDistance # focus distance in metres
ReflT<- cams$Info$ReflectedApparentTemperature # Reflected apparent temperature
AtmosT<- cams$Info$AtmosphericTemperature # Atmospheric temperature
IRWinT<- cams$Info$IRWindowTemperature # IR Window Temperature
IRWinTran<- cams$Info$IRWindowTransmission # IR Window transparency
RH<- cams$Info$RelativeHumidity # Relative Humidity
h<- cams$Info$RawThermalImageHeight # sensor height (i.e. image height)
w<- cams$Info$RawThermalImageWidth # sensor width (i.e. image width)
temperature<-raw2temp(img, ObjectEmissivity, OD, ReflT, AtmosT, IRWinT, IRWinTran, RH,PlanckR1, PlanckB, PlanckF, PlanckO, PlanckR2,ATA1, ATA2, ATB1, ATB2, ATX) str(temperature) writeFlirBin(as.vector(t(temperature)), templookup=NULL, w=w, h=h, I="", rootname=fn) }
`
How will I be able to tell if a photograph is radiometric or not? Would the picture above be considered radiometric?
trying running this in a terminal window.
exiftool imagename.jpg
I don't see any info in the meta data indicating this is a thermal image. no planck constants. no RawThermalImage meta tags.
exiftool test.jpg ExifTool Version Number : 11.62 File Name : test.jpg Directory : . File Size : 897 kB File Modification Date/Time : 2021:04:30 18:04:42-04:00 File Access Date/Time : 2021:04:30 18:05:31-04:00 File Inode Change Date/Time : 2021:04:30 18:04:50-04:00 File Permissions : rw-r--r-- File Type : JPEG File Type Extension : jpg MIME Type : image/jpeg JFIF Version : 1.02 Exif Byte Order : Big-endian (Motorola, MM) Make : FLIR Systems AB Camera Model Name : FLIR ONE Pro Orientation : Horizontal (normal) X Resolution : 72 Y Resolution : 72 Resolution Unit : inches Software : Common_dll v1.0.0b1 Modify Date : 2021:02:12 16:50:39 Y Cb Cr Positioning : Centered Exif Version : 0221 Date/Time Original : 2021:02:12 16:50:39 Create Date : 2021:02:12 16:50:39 Offset Time : -08:00 Offset Time Original : -08:00 Offset Time Digitized : -08:00 Components Configuration : -, Cr, Cb, Y Subject Distance : 0.15 m Sub Sec Time : 000 Sub Sec Time Original : 000 Sub Sec Time Digitized : 000 Flashpix Version : 0100 Color Space : sRGB Exif Image Width : 1440 Exif Image Height : 1080 Digital Zoom Ratio : 1 Scene Capture Type : Standard Image Unique ID : 00000000000000000000000000000000 Profile CMM Type : Apple Computer Inc. Profile Version : 4.0.0 Profile Class : Input Device Profile Color Space Data : RGB Profile Connection Space : XYZ Profile Date Time : 2016:01:01 00:00:00 Profile File Signature : acsp Primary Platform : Apple Computer Inc. CMM Flags : Not Embedded, Independent Device Manufacturer : Apple Computer Inc. Device Model : Device Attributes : Reflective, Glossy, Positive, Color Rendering Intent : Perceptual Connection Space Illuminant : 0.9642 1 0.82491 Profile Creator : Apple Computer Inc. Profile ID : 547841167c6044a8563ff3f039b0ffa4 Profile Description : Apple Wide Color Sharing Profile Profile Copyright : Copyright Apple Inc., 2016 Media White Point : 0.9642 1 0.8251 A To B2 : (Binary data 29772 bytes, use -b option to extract) Chromatic Adaptation : 1.04781 0.02289 -0.05017 0.02953 0.99051 -0.01706 -0.00925 0.01506 0.75191 A To B0 : (Binary data 29772 bytes, use -b option to extract) A To B1 : (Binary data 29772 bytes, use -b option to extract) Image Width : 1440 Image Height : 1080 Encoding Process : Baseline DCT, Huffman coding Bits Per Sample : 8 Color Components : 3 Y Cb Cr Sub Sampling : YCbCr4:4:4 (1 1) Image Size : 1440x1080 Megapixels : 1.6 Create Date : 2021:02:12 16:50:39.000-08:00 Date/Time Original : 2021:02:12 16:50:39.000-08:00 Modify Date : 2021:02:12 16:50:39.000-08:00
however you captured the image, it was not saved as a radiometric file or it has been altered during transfer. I would not trust the FLIR One Pro to be that accurate if it is welcomed advice.
if used cautiously and calibration checked regularly, it might be ok. but if not properly warmed up every time its used, it could be wildly variable in temperature.
https://tattersalllab.com/2016/03/01/thermal-camera-showdown-flir-one-vs-flir-sc660/
It is possible to import these images. Here is one I took with a FLIR One.
Compare the output of exiftool SampleFLIRONE.jpg
with yours:
ExifTool Version Number : 11.62 File Name : SampleFLIRONE.jpg Directory : . File Size : 258 kB File Modification Date/Time : 2015:05:02 21:00:33-04:00 File Access Date/Time : 2021:04:30 18:14:53-04:00 File Inode Change Date/Time : 2021:04:30 18:15:25-04:00 File Permissions : rw-r--r-- File Type : JPEG File Type Extension : jpg MIME Type : image/jpeg JFIF Version : 1.01 Exif Byte Order : Little-endian (Intel, II) Make : FLIR Systems AB Camera Model Name : Orientation : Unknown (0) X Resolution : 72 Y Resolution : 72 Resolution Unit : inches Software : Modify Date : 2015:05:02 11:40:11 Y Cb Cr Positioning : Centered Exif Version : 0220 Create Date : 2015:05:02 11:40:11 Components Configuration : -, Cr, Cb, Y Subject Distance : 1 m Focal Length : 1.6 mm Image Temperature Max : 213 Image Temperature Min : 213 Flashpix Version : 0100 Color Space : sRGB Exif Image Width : 480 Exif Image Height : 640 Digital Zoom Ratio : 1 Image Unique ID : 8671401E39C591182C3491E6F21CB33D GPS Version ID : 2.2.0.0 GPS Altitude Ref : Above Sea Level Compression : JPEG (old-style) Thumbnail Offset : 2004 Thumbnail Length : 1520 Creator Software : Embedded Image Width : 480 Embedded Image Height : 640 Embedded Image Type : JPG Embedded Image : (Binary data 32360 bytes, use -b option to extract) Emissivity : 0.95 Object Distance : 1.00 m Reflected Apparent Temperature : 20.0 C Atmospheric Temperature : 20.0 C IR Window Temperature : 20.0 C IR Window Transmission : 1.00 Relative Humidity : 50.0 % Planck R1 : 18471.787 Planck B : 1460.9 Planck F : 1 Atmospheric Trans Alpha 1 : 0.006569 Atmospheric Trans Alpha 2 : 0.012620 Atmospheric Trans Beta 1 : -0.002276 Atmospheric Trans Beta 2 : -0.006670 Atmospheric Trans X : 1.900000 Camera Temperature Range Max : 120.0 C Camera Temperature Range Min : -40.0 C Camera Temperature Max Clip : 150.0 C Camera Temperature Min Clip : -60.0 C Camera Temperature Max Warn : 120.0 C Camera Temperature Min Warn : -40.0 C Camera Temperature Max Saturated: 150.0 C Camera Temperature Min Saturated: -60.0 C Camera Model : Camera Part Number : Camera Serial Number : * Camera Software : 1.0.0 Lens Model : FOL2 Lens Part Number : Lens Serial Number : Field Of View : 35.4 deg Filter Model : Filter Part Number : Filter Serial Number : Planck O : -3579 Planck R2 : 0.013332381 Raw Value Range Min : 5043 Raw Value Range Max : 48890 Raw Value Median : 13516 Raw Value Range : 2216 Date/Time Original : 2015:05:02 11:40:11.415-04:00 Focus Step Count : 0 Focus Distance : 2.0 m Frame Rate : 15 Palette Colors : 224 Above Color : 170 128 128 Below Color : 50 128 128 Overflow Color : 67 216 98 Underflow Color : 41 110 240 Isotherm 1 Color : 100 128 128 Isotherm 2 Color : 100 110 240 Palette Method : 0 Palette Stretch : 0 Palette File Name : iron.pal Palette Name : Iron Palette : (Binary data 672 bytes, use -b option to extract) Raw Thermal Image Width : 120 Raw Thermal Image Height : 160 Raw Thermal Image Type : PNG Raw Thermal Image : (Binary data 15482 bytes, use -b option to extract) Real 2 IR : 1.19516634941101 Offset X : +13 Offset Y : +2 PiP X1 : 0 PiP X2 : 119 PiP Y1 : 0 PiP Y2 : 159 GPS Valid : Yes GPS Latitude Ref : North GPS Longitude Ref : West GPS Map Datum : WGS84 Image Width : 480 Image Height : 640 Encoding Process : Baseline DCT, Huffman coding Bits Per Sample : 8 Color Components : 3 Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2) Image Size : 480x640 Megapixels : 0.307 Thumbnail Image : (Binary data 1520 bytes, use -b option to extract) Peak Spectral Sensitivity : 9.8 um
even Flir's own software can't open it as a radiometric image. See how the scale is simply an integer (from 0 - 255: corresponds only to colour, not radiance)
Thank you so much for all the help! We think you are right and the photo was altered during transfer
We think this is a radiometric jpg, are you able to confirm this?
yes most definitely! It's also 2.5 Mb in size compared to the other file. normal jpgs are compressed files, so are small. radiometric jpgs contain the raw data in them so are substantially larger.
Yep, the Planck constants are there. Along with lots of other goodies, including GPS coords (I deleted them).
ExifTool Version Number : 11.62 File Name : 116760844-f0995280-a9ca-11eb-84ac-8940405b64ce.jpeg Directory : . File Size : 2.4 MB File Modification Date/Time : 2021:04:30 18:45:59-04:00 File Access Date/Time : 2021:04:30 18:46:08-04:00 File Inode Change Date/Time : 2021:04:30 18:46:01-04:00 File Permissions : rw-r--r-- File Type : JPEG File Type Extension : jpg MIME Type : image/jpeg JFIF Version : 1.01 Exif Byte Order : Little-endian (Intel, II) Make : FLIR Systems AB Camera Model Name : FLIR ONE Pro Orientation : Horizontal (normal) X Resolution : 72 Y Resolution : 72 Resolution Unit : inches Software : Common_dll v1.0.0b1 Modify Date : 2021:04:26 17:39:57 Y Cb Cr Positioning : Centered Exif Version : 0220 Create Date : 2021:04:26 17:39:57 Components Configuration : -, Cr, Cb, Y Subject Distance : 0.31 m Image Temperature Max : 213 Image Temperature Min : 213 Flashpix Version : 0100 Color Space : sRGB Exif Image Width : 1440 Exif Image Height : 1080 Digital Zoom Ratio : 1 Image Unique ID : 00000000000000000000000000000000 GPS Version ID : 2.2.0.0 GPS Altitude Ref : Above Sea Level GPS Img Direction Ref : Magnetic North GPS Img Direction : 0 Compression : JPEG (old-style) Thumbnail Offset : 2042 Thumbnail Length : 3407 Creator Software : Embedded Image Width : 1440 Embedded Image Height : 1080 Embedded Image Type : JPG Embedded Image : (Binary data 339270 bytes, use -b option to extract) Emissivity : 0.90 Object Distance : 0.31 m Reflected Apparent Temperature : 22.0 C Atmospheric Temperature : 20.0 C IR Window Temperature : 25.0 C IR Window Transmission : 0.80 Relative Humidity : 50.0 % Planck R1 : 18022.949 Planck B : 1435 Planck F : 1 Atmospheric Trans Alpha 1 : 0.006569 Atmospheric Trans Alpha 2 : 0.012620 Atmospheric Trans Beta 1 : -0.002276 Atmospheric Trans Beta 2 : -0.006677 Atmospheric Trans X : 1.900000 Camera Temperature Range Max : 120.0 C Camera Temperature Range Min : -40.0 C Camera Temperature Max Clip : 150.0 C Camera Temperature Min Clip : -60.0 C Camera Temperature Max Warn : 120.0 C Camera Temperature Min Warn : -40.0 C Camera Temperature Max Saturated: 150.0 C Camera Temperature Min Saturated: -60.0 C Camera Model : FLIR ONE Pro Camera Part Number : Camera Serial Number : T06JCG0006E Camera Software : Lens Model : Lens Part Number : Lens Serial Number : No Lens Field Of View : 0.0 deg Filter Model : Filter Part Number : Filter Serial Number : Planck O : -2276 Planck R2 : 0.0125 Raw Value Range Min : 4 Raw Value Range Max : 65535 Raw Value Median : 13744 Raw Value Range : 2368 Date/Time Original : 2021:04:27 00:39:57.000+00:00 Focus Step Count : 0 Focus Distance : 2.0 m Frame Rate : 0 Palette Colors : 224 Above Color : 170 128 128 Below Color : 50 128 128 Overflow Color : 67 216 98 Underflow Color : 41 110 240 Isotherm 1 Color : 100 128 128 Isotherm 2 Color : 100 110 240 Palette Method : 0 Palette Stretch : 0 Palette Name : Iron Palette : (Binary data 672 bytes, use -b option to extract) Raw Thermal Image Width : 640 Raw Thermal Image Height : 480 Raw Thermal Image Type : PNG Raw Thermal Image : (Binary data 191851 bytes, use -b option to extract) Real 2 IR : 1.24745607376099 Offset X : -10 Offset Y : -42 PiP X1 : 0 PiP X2 : 639 PiP Y1 : 0 PiP Y2 : 479 GPS Valid : Yes GPS Latitude Ref : North GPS Longitude Ref : West GPS Map Datum : WGS84 Image Width : 1440 Image Height : 1080 Encoding Process : Baseline DCT, Huffman coding Bits Per Sample : 8 Color Components : 3 Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2) Image Size : 1440x1080 Megapixels : 1.6 Thumbnail Image : (Binary data 3407 bytes, use -b option to extract) Peak Spectral Sensitivity : 10.0 um
i confirm I can load it into ImageJ using ThermimageJ (my other open source tool on github). It should load into R using Thermimage. Not sure what you need to do in R with the image, but hopefully you'll have success.
See these 3 lines in the meta data:
Raw Thermal Image Width : 640 Raw Thermal Image Height : 480 Raw Thermal Image Type : PNG
They indicate that the raw data hidden in the jpg is stored in a PNG format and is 640 x 480 pixels. I doubt the microbolometer sensor detecting radiance is 640 x 480. FLIR tends to upsample these images on the consumer grade cameras, giving a false sense of image size. The sensor is probably 160 x 120 if I recall from the specs.
Awesome, thanks again! I really appreciate it. We were converting the images to raw images in R, and then planned to analyze in ImageJ with ThermimageJ. Are you suggesting we could bypass the R conversion and load the radiometric photo directly into ImageJ to analyze the thermal data? We are hoping to extract mean body temperature and max body temperature, as well as any regions of interest that are one standard deviation above the mean body temp.
glad to help! Nice to see some biological images.
ThermimageJ is a bit trickier to get all the software components installed and working (perl, exiftool, ffmpeg - this might be optional if you aren't doing thermal videos). But I do have the ability to convert hold folders of jpgs with 1 or 2 clicks in ThermimageJ.
However if you're already comfortable in R and would prefer to see your code, then I suggest you do the R imports, run the maths using raw2temp function, then export the images however you like. You could use my old writeBin() instruction or alternatively, export your final temperature data using the write.csv function and save to a .csv or .txt file. ImageJ can open "text image" files. And when you import it, the temperature data will equal the pixel intensity.
Thank you so much! We will let you know how it goes. Have a wonderful rest of your day!
happy to walk you through it if you want to set up a zoom chat sometime. if so, send me an email. Good Luck!
Hello! I hope you are doing well. I have been trying to work on a project using your code for the past few months, and both me and my peer have encountered an issue and couldn't find someone to reach out to in order to fix it. I have attached numbered photos of the code (1 is first, then 2, then 3), and the error/where it occurs. The code is erroring in the code for "readflirJPG()", specifically where it states cams$Info$RawThermalImageType == "TIFF" . I know this code works for others, so I am just reaching out to see if you have any suggestions on what may be causing this to not work correctly, considering your close relationship with the code. Thank you so much for your time!
![4(readflirjpg)](https://user-images.githubusercontent.com/77945349/116755337-21738a80-a9bf-11eb-818f-2d2c136c8925.png)