I am using the videoPlayer function from the Computer Vision tool box. The example script I got from Mathworks is working Ok. I am having a problem saving video
1 次查看(过去 30 天)
显示 更早的评论
The script i am using is based on the Mathworks script videotrafficgmm.m . I have adapted it to my needs and the videoPlayer shows excellent results. I desired to save the movie shown in the video player in .avi or .mp4 format show I can show the results on computers that don't have the Computer Vision toolbox. How can I do this? I have been trying getframe but it wants a current axis not a videoPlayer object
0 个评论
采纳的回答
Ashutosh Prasad
2018-9-3
Hey
You can use the writeVideo function to save the video frame by frame. For instance consider you have a video file 'myVideo.avi', you can run the following code to save the video to a file named 'myNewVideo'.
vidReader = VideoReader('myVideo.avi');
v = VideoWriter('myNewVideo','Archival');
open(v);
while hasFrame(vidReader)
frameRGB = readFrame(vidReader);
frameGray = rgb2gray(frameRGB);
imshow(frameRGB);
writeVideo(v,frameGray)
end
close(v)
Let me know if this solves your problem.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Computer Vision with Simulink 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!