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

Multiple Errors Loading SEQ File #63

Open
leo-hstone opened this issue Jan 26, 2022 · 10 comments
Open

Multiple Errors Loading SEQ File #63

leo-hstone opened this issue Jan 26, 2022 · 10 comments

Comments

@leo-hstone
Copy link

Hi everybody,

I am new to python and thermal imaging. I hope this error is trivial an can be resolved easily.

I recorded a .seq file with a T420 FLIR Camera. Running ython .\flirpy\scripts\split_seqs --width 320 --height 240 in the folder produced the following output:
error.log

Unfortunately I am not experienced enough to debug the error myself. It seems to be some problem with the meta data. After playing around with the cli arguments I managed to create the .txt files in the raw folder. All meta data listed there is correct.

Can you guide me in the right direction to fix this or is it an error with the general code? If needed I can supply the relevant files, but I would prefer to send them privately.

@leo-hstone
Copy link
Author

After playing a bit around with the python files, I can conclude, that the problem is probably the seq.py file.

import numpy as np
from flirpy.io.seq import Seq
import matplotlib.pyplot as plt

#test = Seq("testrec1.seq", height=320, width=240) #as soon as supplied, error!
test = Seq("testrec1.seq")
print (len(test))

file0 = test[0]
file0.get_meta() # prints fine!

rad_image = file0.get_radiometric_image()
plt.imshow(rad_image) # looks great!

file1 = test[1] #test last file
print(file1.get_meta()) # prints same error!

Any help welcome!

@jveitchmichaelis
Copy link
Contributor

Any idea what the difference between your two frames are? e.g. test[0] works but test[1] doesn't?

@leo-hstone
Copy link
Author

leo-hstone commented Jan 26, 2022

As it is a video, I hope it is just the timestamp.

Edit 1: I see that I never checked or asked myself if flirpy can handly video .seq files - does it?
Edit 2: I created the video seq file with "Flir Tools+" Desktop application. And thanks for the quick reply!

@jveitchmichaelis
Copy link
Contributor

jveitchmichaelis commented Jan 26, 2022

A SEQ is just a series of frames encoded as FFF files - it's basically a stack of images in a single file. So there isn't really a difference between a single frame SEQ and a multi-frame SEQ. What Flirpy does is (1) try to locate the boundaries between FFF files (this is straightforward and seems robust) and then (2) decode the file to get the image and metadata out.

I'd suggest rolling back to an earlier release of flirpy and see if that helps (e.g. 0.1 or 0.2). There might be API changes, but the split script in the repo should work. Older versions of flirpy used Exiftool to do the splitting and that seemed more reliable - Flirpy will first split the SEQ into a folder full of "raw" FFF files and then it will use Exiftool to convert them.

You could try extracting the frame (e.g. test[1]), writing it to a file (e..g "test.fff") and seeing if Exiftool can read it.

This is kind of a longstanding issue that I've not had time to fix - basically the current SEQ decoder seems to bug out with the endian-ness of certain files. It seems that SEQ files made by different cameras are not identical, which is annoying.

@leo-hstone
Copy link
Author

I will check and try! Thank you very much for your tool and help :)

@leo-hstone
Copy link
Author

leo-hstone commented Feb 14, 2022

Update: I discovered that FLIR released a python API: https://flir.custhelp.com/app/answers/detail/a_id/3504/~/getting-started-with-flir-science-file-sdk-for-python

It can be installed without any license. During install I had to contact support - they told me to use replace the file setup.py from the downloaded package to the one on the bottom of the page linked above. With this fix the install worked fine.

Maybe this is an option for other users with incompatible seq files :)

@jveitchmichaelis
Copy link
Contributor

jveitchmichaelis commented Feb 14, 2022

Interesting, perhaps this is something we could include as an option with flirpy. Do you know what the license terms are?

Ah so you need the SDK for this, and it seems this isn't free? (2k EUR or so)

The FLIR Science Camera SDK is available to purchase via the FLIR Website where you will receive an email with download instructions. You can also purchase with a camera and receive a card with download instructions in the package. 

I'm glad you found a solution though, hopefully in the future we can bring support to more cameras within flirpy.

@leo-hstone
Copy link
Author

leo-hstone commented Apr 19, 2022

You can actually just download it here and use it (just create an account with a temp email): https://flir.custhelp.com/app/account/fl_download_software

I did not have to enter any licenses. Of course I don't know if one can include it in any 3rd party packages but it seems like it is usable standalone.

@jveitchmichaelis
Copy link
Contributor

jveitchmichaelis commented Apr 19, 2022

Thanks, I'll take a look - which package is it?

For example we could just import it in flirpy and ask the user to install it in their python environment. Then I don't think we'd need to worry about licensing, we just call functions from the SDK.

@leo-hstone
Copy link
Author

This sounds like a good idea! The provided examples give a good introduction to the API package.

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

No branches or pull requests

2 participants