detecttechnologies / Thermal-Image-Analysis

Desktop tool for analysis of SEQ/FFF/RJPG thermographs
MIT License
139 stars 40 forks source link

json.decoder.JSONDecodeError #3

Closed Varat7v2 closed 4 years ago

Varat7v2 commented 4 years ago

Hi, I am trying to run the command:

python thermal_analysis.py <flir_image_path>

but its throwing this error:

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

what do I do? Any kind of suggestions will be helpful. Thank you.

rakshith95 commented 4 years ago

Hello @Varat7v2 What version of Python are you using? Did you run pip install -r requirements.txt? What is the flir file you're trying to run with? This error could pop up if the file does not contain the metadata. Try running exiftool <flir_image_path> and post the output here.

Varat7v2 commented 4 years ago

Hi @rakshith95, Yeah I did run requirements.txt and the I am using Python3. Now it seems to be running. But its throwing some warning or error message : [W 200504 12:40:18 CThermal:87] Image seems to be corrupted. And once I select ROI region and enter, Error:ValueError: could not broadcast input array from shape (255,32,3) into shape (67,32,3) pops up. How can I solve this error?

Actually my objective is to measure temperature at the selected ROI region. Any kind of suggestions, references will be helpful to me. Thank you.

rakshith95 commented 4 years ago

Yeah, it can be done with the Draw Areas tool. Give me a couple of hours, I'll add more detailed documentation on how to use it.

Varat7v2 commented 4 years ago

Yeah sure. Thank you very much.

still same broadcast input array shape problem is occurring with any of the options you have provided.

rakshith95 commented 4 years ago

@Varat7v2 Sorry for the delay, I was caught up with something else. I've uploaded an Instructions Manual in the repo wiki.

still same broadcast input array shape problem is occurring with any of the options you have provided.

What input file are you using? Can you post the exif output here?

Varat7v2 commented 4 years ago

@rakshith95 Thank you for uploading the instructions. This is the output of exiftool

ExifTool Version Number : 10.80 File Name : flir_test.jpg Directory : /home/varat/Desktop/test_flir File Size : 222 kB File Modification Date/Time : 2020:05:04 11:35:11+05:30 File Access Date/Time : 2020:05:04 12:36:19+05:30 File Inode Change Date/Time : 2020:05:04 11:39:07+05:30 File Permissions : rw-rw-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 : 2014:08:25 16:34:16 Y Cb Cr Positioning : Centered Exif Version : 0220 Create Date : 2014:08:25 16:34:16 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 : 527 Exif Image Height : 395 Digital Zoom Ratio : 1 Image Unique ID : 5DC0081B4058719A9AC19767825D6855 Compression : JPEG (old-style) Thumbnail Offset : 1848 Thumbnail Length : 2075 Creator Software : Embedded Image Width : 640 Embedded Image Height : 480 Embedded Image Type : JPG Embedded Image : (Binary data 37786 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 : 16760.967 Planck B : 1431.7 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 : 46.1 deg Filter Model : Filter Part Number : Filter Serial Number : Planck O : -3643 Planck R2 : 0.013450708 Raw Value Median : 14980 Raw Value Range : 1768 Date/Time Original : 2014:08:25 21:34:16.490+00: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 : 160 Raw Thermal Image Height : 120 Raw Thermal Image Type : PNG Raw Thermal Image : (Binary data 18224 bytes, use -b option to extract) Real 2 IR : 1.21348178386688 Offset X : +17 Offset Y : -33 PiP X1 : 0 PiP X2 : 159 PiP Y1 : 0 PiP Y2 : 119 GPS Map Datum : Image Width : 527 Image Height : 395 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 : 527x395 Megapixels : 0.208 Peak Spectral Sensitivity : 10.0 um Thumbnail Image : (Binary data 2075 bytes, use -b option to extract)

rakshith95 commented 4 years ago

Okay, thank you. Not able to find anything wrong with it. Can you post the error log when you run it?

Varat7v2 commented 4 years ago

Hey @rakshith95 I am using PureThermal 2 - FLIR Lepton camera for thermal imaging. But when I capture the image, lot of meta-data are missing. How can I capture image or use my camera to make it compatible with thermal imaging? When I run exiftool <on-my-image> its just showing the following details:

ExifTool Version Number : 10.80 File Name : my_photo-1.jpg Directory : . File Size : 5.7 kB File Modification Date/Time : 2020:05:04 20:28:10+05:30 File Access Date/Time : 2020:05:04 20:28:47+05:30 File Inode Change Date/Time : 2020:05:04 20:28:10+05:30 File Permissions : rw-rw-r-- File Type : JPEG File Type Extension : jpg MIME Type : image/jpeg JFIF Version : 1.02 Resolution Unit : inches X Resolution : 120 Y Resolution : 120 Image Width : 160 Image Height : 120 Encoding Process : Baseline DCT, Huffman coding Bits Per Sample : 8 Color Components : 3 Y Cb Cr Sub Sampling : YCbCr4:2:2 (2 1) Image Size : 160x120 Megapixels : 0.019

rakshith95 commented 4 years ago

I'm not sure about the FLIR Lepton. You can check the product specifications if it gives the raw sensor values (some cameras don't). If it does, it's probably some setting you'll have to change, but I don't have much of an idea about this.

rakshith95 commented 4 years ago

Hello @Varat7v2 , if your issue is solved, can I close this?

Varat7v2 commented 4 years ago

Hi @rakshith95 I could not get temperature yet from FLIR Lepton 3.0. According to its datasheet its output is 14 bit raw data. Keeping all the values constant as mentioned in CThermal.py, how can I get PR1, PR2, PB, PF, and PO for my camera? Have you worked on FLIR Lepton 3.0?

If this camera does not work with Thermal_Image_Analysis, you can close this issue.

Thank you very much for your help.

rakshith95 commented 4 years ago

If it outputs the raw values, you should be able to use this package. You might have to change something in the capture settings however, because in the previous comment you posted, the file does not seem to contain the raw sensor values. I have not worked with the FLIR Lepton, but maybe you can post to the FLIR forums/customer support and check

rakshith95 commented 4 years ago

@Varat7v2 maybe this thread would be of use to you

Varat7v2 commented 4 years ago

Thank you. Sure I will go through that thread. I have posted in their forum also, but there is no any respond till now.

In CThermal.py, we require lot of parameters that are obtained from exiftool right, in context of mine, I am not getting those parameters as this camera is very basic one which will output only temperature response in terms of some 14bit data (might be like thermistor which respond temperature variation by its resistance difference).

And regarding capture settings, how can I do that? I was using guvcview to capture camera but it does not have any such settings facility.

rakshith95 commented 4 years ago

In CThermal.py, we require lot of parameters that are obtained from exiftool right, in context of mine, I am not getting those parameters as this camera is very basic one which will output only temperature response in terms of some 14bit data (might be like thermistor which respond temperature variation by its resistance difference).

If you directly get only the temperature array, I'll have to make some changes to the codes for that compatibility. Maybe I can add that option in a while, but I'll need some data to test it out.

And regarding capture settings, how can I do that? I was using guvcview to capture camera but it does not have any such settings facility.

Sorry, I can't help you here. I don't know about the Lepton

Varat7v2 commented 4 years ago

Please let me know if you update your code.

Thank you @rakshith95 .

rakshith95 commented 4 years ago

Closing this

rakshith95 commented 2 years ago

If you directly get only the temperature array, I'll have to make some changes to the codes for that compatibility. Maybe I can add that option in a while, but I'll need some data to test it out.

@rsnk96 if you guys are adding features, consider this as well. Could be useful, although things like emissivity correction won't work.