Skip to content
This repository has been archived by the owner on Nov 5, 2020. It is now read-only.

Doesn't show images of cells with index > 29,122 #129

Closed
phidahl opened this issue Feb 21, 2017 · 12 comments
Closed

Doesn't show images of cells with index > 29,122 #129

phidahl opened this issue Feb 21, 2017 · 12 comments

Comments

@phidahl
Copy link
Contributor

phidahl commented Feb 21, 2017

0.7.0dev16 (32 and 64 bit) don't show the image of a cell, if its index is > 29,122.

@paulmueller
Copy link
Member

I do not observe this with Ubuntu. Does this happen on Mac OSx and on Windows?

@phidahl
Copy link
Contributor Author

phidahl commented Feb 21, 2017 via email

@maikherbig
Copy link
Member

It might be a bug of OpenCV. Using imageio (https://pypi.python.org/pypi/imageio) it is possible to get images from larger .avi files

@paulmueller
Copy link
Member

paulmueller commented Jun 7, 2017

@maikherbig
Does imageio load the entire video file into memory or can it access individual frames at a time? If the memory footprint is small and it works with pyinstaller, I would work on migrating to imageio. Could you please share your imageio code here?

@paulmueller
Copy link
Member

paulmueller commented Jun 14, 2017

@maikherbig
I tested imageio, but it seems to have issues seeking through the avi (at least on Ubuntu). Could you please verify the following code on Windows?:

import imageio
import numpy as np

cap = imageio.get_reader("path/to/file.avi")
img0 = cap.get_data(0)
img1 = cap.get_data(2000)
img2 = cap.get_data(0)
assert np.all(img0==img2), "repeatedly reading first frame works"
assert np.all(img1==0), "seeking to a high index results in zero image"

I have implemented a workaround by iterating through the video with steps of 50 frames. But this makes image reading quite slow:
DC-analysis/dclab@995c867

If this problem is not present on Windows, then we could move to imageio. I am starting to think that this is an ffmpeg problem.

@paulmueller
Copy link
Member

We should move to imageio once the new rtdc file format is implemented. Then, we can convert the tdms/avi data to hdf5 in one run and won't have this seeking problem.

@maikherbig
Copy link
Member

@paulmueller
I have tested the code above:

np.all(img0==img2)
Out[9]: True

np.all(img1==0)
Out[10]: False

On windows it seems to work fine. On my machine there is just a window popping up (ffmpeg.win32.exe) anytime the imageio.get_reader function is called.

@paulmueller
Copy link
Member

It looks like the problem I had only appears with avi files that are somehow broken (e.g. VLC player offers to repair something about it).

@paulmueller
Copy link
Member

I removed the OpenCV from ShapeOut. Could you please test the binary:
https://ci.appveyor.com/project/paulmueller/ShapeOut/build/job/x8mgeunt9al0p8ds/artifacts

And let me know if

  • displaying event images and
  • saving event videos (Menu Export Data ->All event images)
    works?

Writing videos with imageio seems to be simpler than with opencv. The output video is now "rawvideo" with the "gray" pixel format.

@maikherbig
Copy link
Member

Displaying event images work, but there is always the ffmpeg-win32-v3.2.4.exe window popping up when a new cell is clicked (very annoying).
Exporting images works. Unfortunately it is not possible anymore to open the file then with VirtualDub (Error: Error reading source from frame 0: Error decompressing frame 0:...the video data is too short). Opening in VLC works just fine. It nicely shows the images of the cells as a video

@paulmueller
Copy link
Member

paulmueller commented Jun 19, 2017

I modified the sp.Popen calls in imageio (imageio/imageio#266). These windows should not appear anymore: https://ci.appveyor.com/project/paulmueller/shapeout/build/1.0.628/job/fsvem025dfbavyjs/artifacts
https://ci.appveyor.com/project/paulmueller/shapeout/build/job/rk7b3h2onsxs3q26/artifacts

[EDIT] @maikherbig I just triggered a new build for the commit above that uses a different pixel format (YUV 4:4:4) in dclab. Maybe that fixes your VirtualDub problem.

@maikherbig
Copy link
Member

I tested it and all problems are solved now :)
No popup windows anymore and there is now support for a variety of video-players.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants