H20T R-JPEG Images
12Next >
27099 42 2020-7-10
Uploading and Loding Picture ...(0/1)
o(^-^)o
JonoMcG
lvl.2
South Africa
Offline

Good day All,

I've been working on trying to decode the R-JPEG images captured by the new DJI Zenmuse H20T thermal camera so that one can extract the temperature information from the images without needing to go through DJI Thermal Analysis Tools.

It seems crazy to me that DJI has not provided any way for a user to even export the actual temperature measurements for each pixel from their software into a different format (like a .csv or .tiff). The DJI Thermal Analysis Tool is extremely basic and very limiting for any proffessional inspection reporting using the thermal images.

I've managed to figure out that the raw thermal sensor values are stored within the APP3 segment of the Jpeg image as 16-bit unsigned integer pixels. I can export this out as a 16-bit .tiff image. However, these values are only the raw sensor values and does not give one the actual temperature measurements (the values in this image range from 18073 - 21222). Whereas when the same image is opened in DJI Thermal Analysis the temperatures range from 7.5°C to 27.7°C (depending on settings for emissivity, distance etc.).


Flir uses a formula like this to convert the raw sensor value to temperature: Temperature (in Kelvin) = (B / Log(R1/(R2*(S+O))+F))
S = 16 Bit Raw sensor value
T = object temperature in Kelvins
R1 = Planck R1 constant
R2 = Planck R2 constant
B = Planck B constant
F= Planck F constant
O = Planck O (offset) constant.
The specific calibration data above can be decoded from the Flir R-JPEG file using ExifTool. The guys there managed to reverse engineer the Flir format.


It seems like there could be some calibration data stored within the APP4 segment of the image. I am hoping that if we can decode this we would be able to use the calibration data to correct the raw sensor values to give actual temperature readings. Unfortunately my experience with reverse engineering binary data is next to nothing. Is there anybody else who has experience or any ideas with how to retrieve the calibration data (and subsequently the temperature info) from within the image?


On another note if DJI Support can give any insight into whether they have any planned support for getting the temperature information out of the image any other non-proprietary format?


I've uploaded the original H20T R-JPEG image as well as the converted raw sensor 16-bit .tiff image to the following OneDrive folder for anyone who wants to download and play around with it: https://hawk62aviation-my.sharepoint.com/:f:/g/personal/jonathan_hawk62aviation_onmicrosoft_com/ErzBhLPJjKpLvljPM6k6d4gBCm6gjeZNPjLBF7LS8_0Vaw
2020-7-10
Use props
rdosdcuatrogmail.com
lvl.1
Spain
Offline

hi JonoMCG unfortunately I have the same problem, DJI's solution is to wait for a terra update.  Have you been able to advance any further on this topic?  Who do you think could help us?
2020-7-10
Use props
rdosdcuatrogmail.com
lvl.1
Spain
Offline

I cant download the image not show link.
2020-7-10
Use props
JonoMcG
lvl.2
South Africa
Offline

I've posted the question on ExifTool's forum: https://exiftool.org/forum/index.php?topic=11401.msg61059#msg61059. They are the ones that managed to decode Flir's R-JPEG images so I'm sure they'd be able to do the same for DJI's R-JPEG images. I haven't had any more luck decoding it myself. Hoping somebody with more experience will jump on board.

Find it very frustrating that DJI would limit the use of their professional thermal camera so much. It's also very misleading to people to openly advertise that it is radiometric without letting people know that you cannot get temperature information out from the images except when looking at the images in their very basic and poorly designed DJI Thermal Analysis Tool.

What exactly did they say about Terra? Are they planning to allow users to convert the images from within Terra or only view them similar to the DJI Thermal Analysis Tool?

I've also updated the link in the previous post. It should work now. If not the images can also be downloaded from my post on ExifTool's forum.
2020-7-10
Use props
rdosdcuatrogmail.com
lvl.1
Spain
Offline

They want to improve DJI thermal analisis tools and add in terra an option to perform orthomosaics.  I count myself as your frustrated.  the camera is awesome and works really well but without being able to export images you cannot get its full potential.
If you want add me to telegram  @SamyNeutron
2020-7-11
Use props
AndreTaps
New
United Kingdom
Offline

Hi Guys,

I can now convert the R-JPEG images to .tiff. You can send me a personal message for more info.

Cheers
2020-11-19
Use props
MW_POE
lvl.2
United States
Offline

We would like to connect with an active developer community for the m300 platform. We need custom software including thermal analysis as you discussed. If interested message me. Let’s start a sub message group perhaps.
2020-11-20
Use props
fans663a4b75
lvl.3
Flight distance : 52 ft
  • >>>
Italy
Offline

Please help me too to convert R-JPG and use into pix4d or metashape.
2020-11-28
Use props
DrMrdalj
lvl.4
Flight distance : 1265978 ft
  • >>>
Serbia
Offline

Would anyone be so kind to share info on exporting M300 RJPG inspection findings in any report other then an screenshot?
2020-12-2
Use props
DrMrdalj
lvl.4
Flight distance : 1265978 ft
  • >>>
Serbia
Offline

I am VERY disappointed with all the software and marketing decisions in Enterpise and Agriculture DJI platforms - H20T “radiometric” capability is the last example... There is no export option in DJI Analysis Tool, there is no TIFF in recording options... in many ways it is step backward from XT2 if you are not exclusively  into security.. Onother great example is that T16 and T20 spraying drones can not import KML or any other external mission geometry (not even plot boundary) and there is no such option even in DJI Terra - all spraying missions has to be drawn by hand in the app or “automatically” in the Terra.... Even when mission is automatically created there is no inspector tool for waypoints, so you can dread the altitude/height of the waypoint...  Then, if you happen to use P4RTK or M210RTKv2 there is full KML support for mapping missions
So many gotchas that seem intentional...
2020-12-2
Use props
JonoMcG
lvl.2
South Africa
Offline

RE: H20T R-JPEG Images

DrMrdalj Posted at 12-2 18:08
I am VERY disappointed with all the software and marketing decisions in Enterpise and Agriculture DJI platforms - H20T “radiometric” capability is the last example... There is no export option in DJI Analysis Tool, there is no TIFF in recording options... in many ways it is step backward from XT2 if you are not exclusively  into security.. Onother great example is that T16 and T20 spraying drones can not import KML or any other external mission geometry (not even plot boundary) and there is no such option even in DJI Terra - all spraying missions has to be drawn by hand in the app or “automatically” in the Terra.... Even when mission is automatically created there is no inspector tool for waypoints, so you can dread the altitude/height of the waypoint...  Then, if you happen to use P4RTK or M210RTKv2 there is full KML support for mapping missions
So many gotchas that seem intentional...

Good day All,

I have created the following  Windows command line tool that I use to convert the DJI R-JPEG images to .tiff temperature images (similar to the FLIR tiff format). The temperatures within the converted tiff images are equal to the pixel value / 10. You can use these images within Agisoft or Pix4D to process radiometric thermal orthophotos.

You can download the utility from the following OneDrive link: DJI H20T command line converter

There's a README file within the folder that gives you instructions on how to run it. It's a bit of a hack but it has been getting the job done for myself. The code is created from reverse engineering DJI's Thermal Analysis Tool. Anyone can read me about the source code / methodology on the following ExifTool forum thread: Exif Tool Forum Thread

Feel free to get the source code and improve the utility from the above Exif Tool Forum.
2020-12-3
Use props
fans48c0c119
lvl.1
Flight distance : 250459 ft
Spain
Offline

JonoMcG Posted at 12-3 09:21
Good day All,

I have created the following  Windows command line tool that I use to convert the DJI R-JPEG images to .tiff temperature images (similar to the FLIR tiff format). The temperatures within the converted tiff images are equal to the pixel value / 10. You can use these images within Agisoft or Pix4D to process radiometric thermal orthophotos.

Hello!

Your tool looks pretty good. I will test it more, but I have a question. Is it possible to convert not just a single picture but a whole folder at the same time?

Thanks in advance!
2020-12-10
Use props
JonoMcG
lvl.2
South Africa
Offline

fans48c0c119 Posted at 12-10 10:09
Hello!

Your tool looks pretty good. I will test it more, but I have a question. Is it possible to convert not just a single picture but a whole folder at the same time?

Not directly using the command line tool at the moment. I use the command line tool within a python script to iterate over a folder of images, exporting out each image individually:

For example:
import subprocess, osdirectory = "." #current folderfor root, dirs, files in os.walk(directory):   for f in files:
      if f.endswith("T.JPG"):
         file_path = os.path.join(root, f)
         p = subprocess.Popen(['C:\dev\Python\DJI_R-JPEG-converter-cmd-tool\dist\main\main.exe', '-o', folders['thermal_tiff'], file_path])
         p.wait()



It wouldn't be difficult to modify the command line script to be able to do this. I don't have time at the moment but anybody else is free to do so and share the modified version. All the python source code is shared on the Exiftool forum: https://exiftool.org/forum/index.php?topic=11401




2020-12-11
Use props
dseguradogmail.com
lvl.1
Flight distance : 1640 ft
Peru
Offline

AndreTaps Posted at 2020-11-19 02:24
Hi Guys,

I can now convert the R-JPEG images to .tiff. You can send me a personal message for more info.

Heyy Andretap!! Can you help me? I need to convert as well the format to .tiff
My email: david@linnaero.com
Thank you so much!!!
2021-1-3
Use props
djiuser_hJNGGpRe8Isr
lvl.1
Australia
Offline

JonoMcG Posted at 2020-12-3 09:21
Good day All,

I have created the following  Windows command line tool that I use to convert the DJI R-JPEG images to .tiff temperature images (similar to the FLIR tiff format). The temperatures within the converted tiff images are equal to the pixel value / 10. You can use these images within Agisoft or Pix4D to process radiometric thermal orthophotos.

Hi Jono,

Thank you for creating this tool! I've just been testing it on my H20T images and have encountered a problem on my end. I ran the code (screenshot attached), and from the input image (screenshot attached) I have generated a blank image (screenshot attached).

Are you able to tell me what I am doing wrong here?

Thanks!

Elie
2021-2-8
Use props
djiuser_hJNGGpRe8Isr
lvl.1
Australia
Offline

EDIT: opened in ArcGIS and can read tiff files. Thanks!
2021-2-8
Use props
djiuser_hJNGGpRe8Isr
lvl.1
Australia
Offline

JonoMcG Posted at 2020-12-11 00:57
Not directly using the command line tool at the moment. I use the command line tool within a python script to iterate over a folder of images, exporting out each image individually:

For example:

Hi Jono,

Your script for extracting temp data from H20T photos has saved my life! I'm trying to use your python script for batch processing folders but can't get it to work for me. I am not too knowledgeable about python, I was wondering if I'd interpreted your code correctly?

import subprocess, osdirectory = "path to "main.exe file" :   for f in files:
      if f.endswith("T.JPG"):
         file_path = os.path.join(root, f)
         p = subprocess.Popen(['path to main.exe file', '-o', folders['thermal_tiff'], path to input photos])
         p.wait()

Is this correct?
2021-2-9
Use props
CHEW_33
lvl.1
Japan
Offline

JonoMcG Posted at 2020-12-3 09:21
Good day All,

I have created the following  Windows command line tool that I use to convert the DJI R-JPEG images to .tiff temperature images (similar to the FLIR tiff format). The temperatures within the converted tiff images are equal to the pixel value / 10. You can use these images within Agisoft or Pix4D to process radiometric thermal orthophotos.

Hi, thank you very much for your efforts. I have tried on using your DJI H20T command line converter but I have been returned with failed execution message. Would you advise me on this error?
2021-3-11
Use props
MMD
lvl.2
Flight distance : 106631 ft
  • >>>
Serbia
Offline

Hello,

I have problem running the script in cmd. When i run the command line i got message "Thiss app can't run on your PC..." can anyone help me with this?
2021-4-20
Use props
Zeke13z
lvl.1
United States
Offline

Hi @JonoMcG!

After seeing your reply to DJI stating the M2EA images were similar to the H20T in their formatting, I was wondering if you had made any changes to the software you have created to accommodate the M2EA?

Second and the reason I'm asking the above question: I downloaded your tool and attempted to use it with the M2EA images and received this error. Would you have any idea what might've caused this?


2021-4-20
Use props
JonoMcG
lvl.2
South Africa
Offline

Zeke13z Posted at 4-20 13:40
Hi @JonoMcG!

After seeing your reply to DJI stating the M2EA images were similar to the H20T in their formatting, I was wondering if you had made any changes to the software you have created to accommodate the M2EA?

Hi, no unfortunately not yet. It looks like the R-JPEG image format stored by the M2EA is of a completely different format to the H20T images. The .dlls used to do the conversion is different and therefore the utility I made won't work on the M2EA (same as the old DJI Thermal Analysis Tool).

DJI has released a new v2 of their Thermal Analysis tool that is compatible with the M2EA. This tool seems to use different .dlls to do the conversion of the M2EA images. If I find the time I might try look into doing some reverse engineering on the v2 Thermal Analysis Tool to see if I can figure out the function calls and parameters that are made to this .dll to be able to convert the M2EA images. If anybody else on this forum has time or experience in reverse engineering I'd appreciate the help..

Alternatively DJI has stated in an email to me that they will make their Thermal SDK (TSDK) compatible with the M2EA images in the future. No timeframe given though. Once they release the Thermal SDK one would be able to do the conversions though and I'd be able to update the utility.
2021-4-26
Use props
JonoMcG
lvl.2
South Africa
Offline

For anyone converting H20T or XTS images and running into issues with my old script: DJI has released a Thermal SDK that makes these conversions fairly easy.. I'd suggest switching to using their official SDK to do conversions to the R-JPEG images for these cameras.

https://forum.dji.com/forum.php?mod=viewthread&tid=230321
2021-4-26
Use props
Zeke13z
lvl.1
United States
Offline

JonoMcG Posted at 4-26 00:24
Hi, no unfortunately not yet. It looks like the R-JPEG image format stored by the M2EA is of a completely different format to the H20T images. The .dlls used to do the conversion is different and therefore the utility I made won't work on the M2EA (same as the old DJI Thermal Analysis Tool).

DJI has released a new v2 of their Thermal Analysis tool that is compatible with the M2EA. This tool seems to use different .dlls to do the conversion of the M2EA images. If I find the time I might try look into doing some reverse engineering on the v2 Thermal Analysis Tool to see if I can figure out the function calls and parameters that are made to this .dll to be able to convert the M2EA images. If anybody else on this forum has time or experience in reverse engineering I'd appreciate the help..

Thanks for the reply Jono. I'm sure I (or other members from here or other groups) would be more than willing to send you some photos if needed.  The work you're doing is incredible for this community.  I'd love to help, but that's unfortunately not my area of expertise.  I will be following.
2021-4-27
Use props
iidancom
lvl.1
Israel
Offline

I am comparing the values I get from the tiff with what DJI therml analysis tools provide and there are significantly different
I can provide the samples
my mail is i@idan.com
Joe
2021-7-18
Use props
djiuser_UDfpmmQJw2DY
lvl.1
France
Offline

Hello everyone,
I need to convert images acquired with my h20t camera but I can't...

I used different scripts but I always have the same result.
I also used the scripts of exiftool forum.

All time, I have a black image in output, would you have an idea to help me? Thanks!
2021-7-23
Use props
djiuser_3D8kpKM33jRl
New
Oman
Offline

JonoMcG Posted at 4-26 00:28
For anyone converting H20T or XTS images and running into issues with my old script: DJI has released a Thermal SDK that makes these conversions fairly easy.. I'd suggest switching to using their official SDK to do conversions to the R-JPEG images for these cameras.

https://forum.dji.com/forum.php?mod=viewthread&tid=230321

Could you please share the link of dji sdk
2021-7-23
Use props
djiuser_kMIg5993HklS
lvl.2
United States
Offline

djiuser_3D8kpKM33jRl Posted at 7-23 03:50
Could you please share the link of dji sdk

https://www.dji.com/downloads/softwares/dji-thermal-sdk
2021-7-23
Use props
Bruno SDS
lvl.2
France
Offline

djiuser_hJNGGpRe8Isr Posted at 2-8 19:37
Hi Jono,

Thank you for creating this tool! I've just been testing it on my H20T images and have encountered a problem on my end. I ran the code (screenshot attached), and from the input image (screenshot attached) I have generated a blank image (screenshot attached). [view_image][view_image][view_image]

Salut, problème similaire pour moi, c'est à dire une belle image noire. C'est vraiment frustrant !
Je désespère de pouvoir utiliser les images en rjpeg de la H20T.
Si quelqu'un à une solution à proposer, j'en serai ravi .

Merci par avance à la communauté
2021-7-25
Use props
Bruno SDS
lvl.2
France
Offline

djiuser_hJNGGpRe8Isr Posted at 2-8 19:37
Hi Jono,

Thank you for creating this tool! I've just been testing it on my H20T images and have encountered a problem on my end. I ran the code (screenshot attached), and from the input image (screenshot attached) I have generated a blank image (screenshot attached). [view_image][view_image][view_image]

Salut,

si tu obtiens cette image noire, c'est tout simplement un Tiff qui n'a pas de prévisualisation. Pour voir si ça fonctionne, ouvre ton fichier sous Qgis ou autre logicel de SIG en mode raster. Nornalement tu devrais obtenir une image en niveau de gris
2021-7-31
Use props
GeoFlow
lvl.1
Germany
Offline

JonoMcG Posted at 4-26 00:28
For anyone converting H20T or XTS images and running into issues with my old script: DJI has released a Thermal SDK that makes these conversions fairly easy.. I'd suggest switching to using their official SDK to do conversions to the R-JPEG images for these cameras.

https://forum.dji.com/forum.php?mod=viewthread&tid=230321

Hi Jono, thanks for the information and your script. But the two things are not comparable. Your script is much better than Thermal SDK from DJI. With Thermal SDK you can't create TIFF files, can you? I always get only an export in RAW format. How do you process these RAW files? Can you simply convert them into a TIFF format? All my post-processing (python) is based on the availability of TIFF files.

2021-8-6
Use props
djiuser_xKUQu5ufzV4i
lvl.1
United States
Offline

Any news on getting SDK to support Mavic 2 Enterprise Advanced?
2021-10-26
Use props
hoss_
lvl.4
Flight distance : 166168 ft
United States
Offline

djiuser_xKUQu5ufzV4i Posted at 10-26 04:36
Any news on getting SDK to support Mavic 2 Enterprise Advanced?

Here is a link to the beta: https://drive.google.com/drive/f ... _b31p1J?usp=sharing
2021-10-27
Use props
Guillaume89
lvl.2
Flight distance : 270476 ft
  • >>>
Martinique
Offline

JonoMcG Posted at 2020-12-3 09:21
Good day All,

I have created the following  Windows command line tool that I use to convert the DJI R-JPEG images to .tiff temperature images (similar to the FLIR tiff format). The temperatures within the converted tiff images are equal to the pixel value / 10. You can use these images within Agisoft or Pix4D to process radiometric thermal orthophotos.

Hi thanks a lot for sharing this tool.

However, when I run this command, the created tiff files does not contain any location information, do you a tip about it ?

Regards,
2021-11-16
Use props
Billa0608
lvl.1
Netherlands
Offline

Hi, I've problem compiling the SDK and the download link for DJI command line tool is not working. Any help would be highly appreciated.

Thanks
2021-12-29
Use props
Mayotte Drones
lvl.2
Flight distance : 925331 ft
  • >>>
France
Offline

Guillaume89 Posted at 2021-11-16 07:38
Hi thanks a lot for sharing this tool.

However, when I run this command, the created tiff files does not contain any location information, do you a tip about it ?

Salut Guillaume,

Tu as trouvé une solution à ton problème ?

Convertir les RJPEG en TIFF pas de soucis mais je perds toutes les données GPS aussi...

Merci pour tes lumières ;-)
2022-1-19
Use props
mac230
lvl.3
Flight distance : 80062 ft

United Kingdom
Offline

https://aetha.global/product/thermoconverter/
2022-1-26
Use props
SpeedyPhire
lvl.2
Flight distance : 164747 ft
Australia
Offline

I have been working on a software package to do the sorts of things you are talking about.  It is designed to analyse a directory full of R-JPEGS and identify the temperature limits which can then be searched using a temperature range the culled set can then be displayed for further analysis.  The code to get float values is:

First load the data into an internal buffer by whatever method you are using, then you call dirp_create_from_rjpeg to set up the dji data structure.

                if (dirp_create_from_rjpeg(_filedata, _filesize, _handle) != DIRP_SUCCESS) {
                        MessageBox::Show(L"Failed to create DIRP Handle.");
                        return DIRP_ERROR_NOT_READY;
                }

Determine the framesize.
                dirp_get_rjpeg_resolution(*_handle, _resolution);
                _framesize = _resolution->height * _resolution->width;  
In reality this is a constant but has been written to allow for change later if required.

Then allocate an array of floats that are the size of the frame:
        if ((_floatdata = (float*) new float[_framesize * sizeof(float)]) == nullptr) {
                                        MessageBox::Show(L"Unable to allocate memory for float data.");
                        return DIRP_ERROR_MALLOC;
                }

Then you can convert to floats by using:
                if (dirp_measure_ex(*_handle, (float*)_floatdata, _framesize * sizeof(float)) != DIRP_SUCCESS) {
                        MessageBox::Show(L"Unable to allocate create float array.");
                        return DIRP_ERROR_NOT_READY;
                }

The above is a bit clunky and will be improved at some point but does the job for now.

If you are interested in my work let me know.

cheers
Paul
2022-1-27
Use props
djiuser_xXMh5LiOKbjM
lvl.1
France
Offline

JonoMcG Posted at 2020-12-3 09:21
Good day All,

I have created the following  Windows command line tool that I use to convert the DJI R-JPEG images to .tiff temperature images (similar to the FLIR tiff format). The temperatures within the converted tiff images are equal to the pixel value / 10. You can use these images within Agisoft or Pix4D to process radiometric thermal orthophotos.

Thank you for creating the program to convert R-JPEG images from the H20T camera to images with temperatures.  I would like to test this program. However the link to the SharePoint doesn't work... I don't understand why.  Would it be possible for you to share the program's link .  Thank you in advance for your help.  
2022-2-4
Use props
sunbox
lvl.2
Japan
Offline

JonoMcG Posted at 2020-12-3 09:21
Good day All,

I have created the following  Windows command line tool that I use to convert the DJI R-JPEG images to .tiff temperature images (similar to the FLIR tiff format). The temperatures within the converted tiff images are equal to the pixel value / 10. You can use these images within Agisoft or Pix4D to process radiometric thermal orthophotos.

hi
i use h20t data in pix4dmapper,but data need convert
this link is lost,could you please update DJI H20T command line converter ?
thanks
2022-2-7
Use props
fansc21abebd
lvl.3
Flight distance : 925010 ft
  • >>>
Belgium
Offline

I can’t make R-JPEG with the M2EA
2022-7-4
Use props
12Next >
Advanced
You need to log in before you can reply Login | Register now

Credit Rules