How to capture video in Octave?
Is there a native way to capture video in Octave ?
In Matlab I'm used to use following (also maybe useful for other people):
a = imaqhwinfo('linuxvideo',1) # or "imaqhwinfo('winvideo',1)" in Windows
a.SupportedFormats # check supported formats
vid = videoinput('linuxvideo', 1, 'YUYV_640x480'); # open video stream with one of supported formats
start(vid); # start processing video
preview(vid); # open preview window
pics = cell(1,20) # create array to store images from video
for i = 1:20
pause(1); # every 1 second ...
pics{i} = getsnapshot(vid); # get video frame and save into corresponding position in array
end
But in Octave none of video related functions work. It is also possible to use Octave bindings for OpenCV to capture video, but I'm primarily looking for more pure and portable way.
Install and load image-acquisition package. For more information, read the Wiki: http://wiki.octave.org/Image_acquisition_package
If other solutions fail, you can try capturing frame by frame. You can use a for loop and add/bind the frames together. aviread is already there to capture frames. Atleast this is how I did when everything else failed.
链接地址: http://www.djcxy.com/p/68898.html下一篇: 如何在Octave中捕捉视频?