Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Added support for InfiRay's IJPEG images #184

Closed
wants to merge 5 commits into from
Closed

[WIP] Added support for InfiRay's IJPEG images #184

wants to merge 5 commits into from

Conversation

socram8888
Copy link

Please beware this is my first time coding in Perl, and I am not familiar with the codebase. However I've tried to make it as simmilar to the existing codebase as possible.

InfiRay's thermal imaging cameras generate JPEGs with a plethora of metadata embedded in multiple APPx segments.

These are:

  • APP2: IJPEG version header (ijpeg_version)
  • APP3 (multiple in chunks up to 0xFFFE in size): combined IR+thermal+visible data
  • APP4: ? (fact_temp_param_version)
  • APP5: Environment temperature (env_temp)
  • APP6: ? (mix_type)
  • APP7: camera settings (work_mode)
  • APP8: ? (isothermal_max)
  • APP9: IR/visible light sensor data, such as model, firmware, serial number... (ir_manufacturer)

Names in parentheses are the names assigned by the P2 Pro APK com.infisense.ijpeglibrary.IJpegBean class.

So far, it seems that some data in these headers is wrong. Namely, in the only supported header so far, the version header, the blob sizes are right but the image height and bpp are not (it lists a height of 384 and 8bpp, while the correct are 192 and 16bpp). Not sure if I should warn or correct this data before printing.

The meaning of some fields is not clear either (ie "image org type"). Not sure what to make of these.

All temperatures (including the raw temperature data blob) are stored in a 64th of a kelvin. Thus to convert a stored temperature value to a kelvin one just needs to multiply by 64.

Sample images:
1675855475642
laptop - copia

@boardhead
Copy link
Contributor

Wow, I'm impressed! I will add your update with only minor changes to the next release (12.56), which I expect to be within a day or so.

  • Phil

@socram8888
Copy link
Author

Please note this is a WIP - I'll try to add all the APPx segments I can!

@boardhead
Copy link
Contributor

I understand. WIP is fine.

I'm thinking of using the Condition "$$self{Make} eq 'Infisense'" instead of changing FileType and using that in the ProcessJPEG logic. I think the FileType should stay as JPEG unless you have a compelling reason to change it. (Do they use a .jpg extension? -- your samples seem to have this.)

Also, I'm wondering if the module name should be Infisense instead of InfiRay? Which has broader scope?

@socram8888
Copy link
Author

Yes, they use a .jpg extension. I can change it no problem. I was concerned that using Infisense could cause some issues if the manufacturer released some other software with the same maker, specially given there's no magic or signature in the sections (other than the first one) to tell if the decoded data makes sense.

Regarding InfiSense and InfiRay - I think Infisense is just their old brand name. My camera is branded InfiSense and has a link to the nonworking website www.infisense.cn, so I guess they abandoned that name.

@boardhead
Copy link
Contributor

boardhead commented Feb 9, 2023

OK, we'll go with InfiRay then. And if they are abandoning Infisense then I think we should go with your original logic to key off the APP2 IJPEG segment, but I'll set an internal flag rather than meddle with the FileType variable.

I plan to make a release tomorrow that includes your 3 commits so far. Please wait until the new version is released and apply any future pull requests to that. I'll make the changes that I mentioned as will as a few other small tweaks.

Thanks.

  • Phil

@socram8888
Copy link
Author

socram8888 commented Feb 9, 2023

I was setting the FileType because that's what I had seen being done for JPS (stereo JPEG), but my initial idea was indeed just using a variable. I've updated the code to do that in 12bb4d6.

I'm not sure if I should also add the rest of the IJPEG structures to %Image::ExifTool::JPEG::Main, specially because I cannot add any Condition based on APPx signatures.

EDIT: I've just read you'd be merging this today. I'll stop making any changes now, until that new version is released.

@boardhead
Copy link
Contributor

I'm releasing 12.56 now, but it doesn't include the last 2 commits. I'll close this pull request and you can make any further changes to the new version.

Thanks.

@boardhead boardhead closed this Feb 9, 2023
@socram8888 socram8888 deleted the infiray branch February 10, 2023 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants