-
Notifications
You must be signed in to change notification settings - Fork 48
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
Tutorial for loading frames #134
Comments
For video capturing, it should be something like this:
|
Hi @codeAC29 , |
Thanks @shrubb. Did you see notice that loading individual frame does not take uniform time? Do you see any reason behind it? |
@codeAC29 As for loading times, the fluctuations are normal when working with camera, especially with a simple webcam. In particular, FPS rate often drops in low light. It should be stable with video files (tested myself). |
Thats weird, because in my case (repo which I have added) fps is fluctuating for videos and not camera and is somewhat periodic; thats why I was wondering if I made any fundamental mistake in my repo. |
Hmm, strange indeed, because I've tested just your script, and didn't have any problems with it. Also, your code seems to be OK. Probably a video file or an FFMPEG issue 😕 |
@codeAC29 it stabilized loading frames from video for me, because I use |
@Edelbert local cv = require 'cv'
require 'cv.videoio'
require 'cv.highgui'
cap = cv.VideoCapture{'/some/movie'}
local ok, frame = cap:read{}
while ok do
-- do something with frame, for example, show it
cv.imshow{'Window by OpenCV', frame}
cv.waitKey{20}
ok = cap:read{frame}
end |
I am using win:valid() here because in case user closes the window in which the frames are being displayed (while grabbing frame from camera or before a video is complete), I want the code to exit.
If you will notice, fps keeps on fluctuating which is mainly because of fluctuation during reading of frames. While loading frames from camera there are no such spikes in fps. @shrubb did you try to load a video, and did it get displayed smoothly for you? |
Yes, as I've said above, I can play videos smoothly with just your script. |
My torch cv is not functioning well. The cap can't open the video file even avi. Can you let me know your torch cv install process exactly? Thanks. |
@junjun16 |
@shrubb I have fixed it. Solution is as follows:
Thanks. |
I have created a simple repo for loading frames using either camera or video. You can also control the resolution of the grabbed frame. This repository can be found
here
.cv
package. Let me know if you all think it is worth adding my repository's link or the whole repository here.-v
option)The text was updated successfully, but these errors were encountered: