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

Error during file compression (OpenCV version issue?) #73

Open
otlichna opened this issue Mar 10, 2020 · 1 comment
Open

Error during file compression (OpenCV version issue?) #73

otlichna opened this issue Mar 10, 2020 · 1 comment

Comments

@otlichna
Copy link

When going through the compression step using an avi file and background subtraction, I get the following error:

20170522_hisAIB_nohisL_nohisC_adp_naive1.avi kept stack Starting video compression.
ERROR:
AttributeError: 'readVideoCapture' object has no attribute 'frame_max'
Traceback (most recent call last):
File "/home/pkidd/Apps/tierpsy-tracker/tierpsy/processing/ProcessWorker.py", line 108, in
ProcessWorker(**args, cmd_original = subprocess.list2cmdline(sys.argv))
File "/home/pkidd/Apps/tierpsy-tracker/tierpsy/processing/ProcessWorker.py", line 38, in init
self.execAllPoints()
File "/home/pkidd/Apps/tierpsy-tracker/tierpsy/processing/ProcessWorker.py", line 66, in execAllPoints
cmd_original = self.cmd_original)
File "/home/pkidd/Apps/tierpsy-tracker/tierpsy/processing/trackProvenance.py", line 28, in execThisPoint
func(**argkws)
File "/home/pkidd/Apps/tierpsy-tracker/tierpsy/analysis/compress/processVideo.py", line 142, in processVideo
compressVideo(video_file, masked_image_file, **compress_vid_param)
File "/home/pkidd/Apps/tierpsy-tracker/tierpsy/analysis/compress/compressVideo.py", line 335, in compressVideo
bg_dataset._v_attrs['save_interval'] = vid.frame_max-vid.first_frame + 1
AttributeError: 'readVideoCapture' object has no attribute 'frame_max'

I get similar errors with other file types as well (eg after converting to TIF).

Because I have a pre-existing Python installation (including OpenCV) that I use for other tasks, I didn't use Anaconda, and just installed from the github source with pip install -e. Many of my packages are different versions than recommended in your requirements.txt, in particular I have OpenCV 4.1.2. So I suspect this is an OpenCV version issue? If there's no easy fix I could create a new environment and setup with Anaconda, but I figured I would check here first. Thanks!

Phil

@ver228 ver228 pinned this issue Mar 12, 2020
@ver228 ver228 unpinned this issue Mar 12, 2020
@ver228
Copy link
Owner

ver228 commented Mar 12, 2020

I am afraid this is really a bug from our part @luigiferiani seems to be the responsable. For the moment the quicker solution is to simply set the flag is_bgnd_subtraction = False . You should be able to do it with the set parameters flag.

A more technical description:

When implemented the reader for loopbio the attributes frame_max and first_frame were added, however this is the only reader that have those attributes so it frames. Since what it is really required in the buggy line is the total number of frames. I will suggest to implement the __len__ method to all the available readers
so the line can be changed to :
bg_dataset._v_attrs['save_interval'] = len(vid)

Any comment about this @luigiferiani

luigiferiani added a commit to luigiferiani/tierpsy-tracker that referenced this issue Dec 3, 2021
* Worm Viewer GUI: clicking on Select Skeletons File now allows the choice of *_featuresN.hdf5, *_features.hdf5, and *_skeletons.hdf5 files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants