LJMUAstroecology / flirpy

Python library to interact with FLIR camera cores
Other
184 stars 54 forks source link

Flir P640 #69

Closed glebpinigin closed 2 years ago

glebpinigin commented 2 years ago

Is there any straightforward way to open .seq files written by Flir P640?

flirpy fails to read camera and lens metadata, however successfully reads radiometric metadata and returns several shifted arrays of pixels before crash. Isn't there any straightforward way to hardcode P640's metadata or do anything else, that could possibly help?

UPD: manually assigning width and height doesn't change anything. After several incorrect outputs Fff.get_image() fails with ValueError: buffer is smaller than requested size and split_seqs script fails with OverflowError: math range error

jveitchmichaelis commented 2 years ago

Hiya sorry for the late reply, the short answer is try an older release of flirpy, or try to extract the file directly with Exiftool?

glebpinigin commented 2 years ago

Hi!

Short answer: extract the file directly with Exiftool

I have tried another solution provided by https://github.com/gtatters/ThermimageBash and it succeeded. There is a perl script that batch process sequence in correct way. As I can guess, this script is calling Exiftool directly. I have tried to open fff files, which were correctly created py this perl script with flirpy and and it resulted in the same issue. They also have an R package. But in case of input/output it is a wrapper over Exiftool, as I understood from code and docs.

Hope my answer is helpful!

jveitchmichaelis commented 2 years ago

Yeah not too surprising. The original version of flirpy also just calls exiftool. The main reason I changed it was that it doesn't offer an easy way to iterate directly over fff files (maybe it does if you call it as a library?). However there is some subtlety in the decoding it seems (due to endianness), so it works for some files and not others.

The simplest approach at this point (as I've mentioned in other issues) would be to roll back flirpy to allow a fallback. But unfortunately I just don't have the time to do this right now.

On Fri, 10 Jun 2022 at 22:42, glebpinigin @.***> wrote:

Hi! I have tried another solution provided by https://github.com/gtatters/ThermimageBash and it succeeded. There is a perl script that batch process sequence in correct way. As I can guess, this script is calling Exiftool directly. I have tried to open fff files, which were correctly created py this perl script with flirpy and and it resulted in the same issue. They also have an R package https://github.com/gtatters/Thermimage. But in case of input/output it is a wrapper over Exiftool, as I understood from code and docs.

Hope my answer is helpful!

— Reply to this email directly, view it on GitHub https://github.com/LJMUAstroecology/flirpy/issues/69#issuecomment-1152724098, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYDMJ63JYHVOM7SCUMH2PDVOOSCBANCNFSM5WR4EQOQ . You are receiving this because you commented.Message ID: @.***>

glebpinigin commented 2 years ago

If I understood everything correctly, iteration over fff files, that are part of sequense, can be solved by saving them as temporary files and iterating over files in file system. I am not sure that it is a good way to process .seq file as a video, but in general that might work. Another thing is that P640 is a completely outdated camera and perhaps not worth it.

jveitchmichaelis commented 2 years ago

Yes and this is exactly how flirpy solved it - split a sequence file into separate FFF files and then deal with them iteratively (since exiftool can also convert to other formats and extract metadata) :)

I don't think it's necessarily a difficult problem, it just requires some time to write a good header decoder (eg as exiftool has). I did try to design flirpy's based on exiftool's code. It's also tricky because the format doesn't seem to be super standard so it requires a lot of file samples to get a universal solution.

On Fri, 10 Jun 2022 at 22:58, glebpinigin @.***> wrote:

If I understood everything correctly, iteration over fff files, that are part of sequense, can be solved by saving them as temporary files and iterating over files in file system. I am not sure that it is a good way to process .seq file as a video, but in general that might work. Another thing is that P640 is a completely outdated camera and perhaps not worth it.

— Reply to this email directly, view it on GitHub https://github.com/LJMUAstroecology/flirpy/issues/69#issuecomment-1152733429, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYDMJZRWXBYVNKZ2C6ZWODVOOT6XANCNFSM5WR4EQOQ . You are receiving this because you commented.Message ID: @.***>