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

Can't (?) show frames #5

Closed
mirceaciu opened this issue Dec 8, 2017 · 10 comments
Closed

Can't (?) show frames #5

mirceaciu opened this issue Dec 8, 2017 · 10 comments

Comments

@mirceaciu
Copy link

The output video for me is blank.

If I do cv2.imshow("face", image) it won't show any windows.
If i do cv2.imwrite("frames/%s.jpg" % time.time(), image) i can see that frames are being processed, inference time cost is ~0.42.

Tested on Ubuntu 16 machine with no GPU.
Is GPU a requirement?

@yeephycho
Copy link
Owner

yeephycho commented Dec 11, 2017

Hi there,
A GPU is not a must as long as you can run tensorflow framework.
This project read a video file and output a video file, please refer to the code for detail and you can change by your will to support the camera application etc.

With regards!

@mirceaciu
Copy link
Author

the output video is blank

@z362194037
Copy link

@mirceaciu do you solve this problem? I meet this too

@johanna-codes
Copy link

@mirceaciu, @z362194037: I can't explain why, but in my case It worked well only when input video is in mp4 format and output video in avi format. Hope it can help you.

@z362194037
Copy link

@johanna-codes which opencv version do you use?

@mirceaciu
Copy link
Author

I did use .mp4 as input and .avi as output.Compiled OpenCv version is 3.2.0

@johanna-codes
Copy link

@z362194037 I'm using OpenCV version 3.1.0

@z362194037
Copy link

@mirceaciu change the dimension to your .mp4 file in tensorflow-face-detection.py line46 get work

@mirceaciu
Copy link
Author

Setting the output video dimensions same as the camera's input solves the output write problem.

Would be nice to make it work with cv2.imwrite, but i guess this runs in some kind of multi thread so this might not be possible.

@kaisark
Copy link

kaisark commented Jan 17, 2019

@mirceaciu @yeephycho If you are using opencv (built with fmpeg) to write video output, you need to pay attention to the following:

  1. output video frame is same dimensions (w,h) as input video frame

  2. Your system supports the codec (e.g. XVID, MJPG) you are using

  3. frame rate of output matches input frame rate or processing frame rate (for decent results)

  4. The file name extension (e.g. avi, mp4) of the output must be supported by ffmpeg and the system. AVI seems to work out of the box on Ubuntu systems.

    if out is None:
    [h, w] = image.shape[:2]
    fps=8
    fourcc = cv2.VideoWriter_fourcc(*'XVID')
    out = cv2.VideoWriter('./media/test_out.avi', fourcc, fps, (w, h))

fd-tf-mask-computervision gif-downsized_large

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

5 participants