LeoDJ / P2Pro-Viewer

A viewer and API for the InfiRay P2 Pro thermal camera module
MIT License
171 stars 22 forks source link

RAW Data #1

Open julled opened 1 year ago

julled commented 1 year ago

Hi @LeoDJ , i really appreciate your work on getting this sensor interfaced! Do you know if its possible to get the raw data from the sensor ? So instead of receiving RGB or any other HOTCOLD encoded images? Thank you!

LeoDJ commented 1 year ago

Yes, it's possible. I've already found out how the radiometry data is transmitted and encoded.

I'm currently working on the basic viewer implementation first and plan to also do a small write-up once I'm done with that.

tl;dr If you open the UVC video stream with the second resolution profile, the lower half of the image contains the raw values. As far as I can tell, it's not truly the raw sensor readings, but already temperature data. The camera seems to do most of the processing internally, but that's fine by me.

julled commented 1 year ago

Cool, thanks for this info and your work! If the temperature is a uncompressed image and is just a linear scaling of the raw data then its totally fine. Context: For me its important to get the RAW data to do proper FlatFieldCorrection of the images when changing the lens or putting the camera in mountings with thermal ambient noise. This way its usable for computer vision algorithms.

LeoDJ commented 1 year ago

There appear to be calibration routines for exactly that in the camera firmware itself too. At least I've stumbled over promisingly named commands to trigger a calibration during the initial reverse engineering of the app. I'll try to document all commands at a later date.

Additionally there seems to be the possibility to configure the image stream source. And if I interpret it correctly, that might include the raw ADC values. I haven't tried either commands yet. (Partly because I don't want to potentially brick my P2 Pro, before I'm confident I have a complete and working backup of its configuration)

But if you want to integrate the module in a more serious project, maybe take a look at the InfiRay Tiny1-B/Tiny1-C sensor modules. It's basically the same components that are inside the P2 Pro and I've heard you can request the SDK for it from InfiRay. (I didn't request the SDK myself, because I try to keep the reverse engineering as clean-room as possible)

julled commented 1 year ago

Great to hear there is raw data and other things possible in the firmware! And totally understandable you dont want to risk your module.

I found the SDK for the Tiny1-C available from the excellent eevblog forum thread, someone just uploaded it:

https://drive.google.com/drive/folders/1ilGgWSxOK-QcDlMyTLcZdKiNAn_ifQes

Maybe this also helps you here? THere are examples for linux and windows.