How to use Webread and analyze video
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Life is Wonderful
il 22 Mag 2023
Commentato: Life is Wonderful
il 31 Mag 2023
Hi there,
I am trying to perform webread using the following link,
httpsUrl = 'https://upload.wikimedia.org/wikipedia/en/transcoded/4/4c/Green_and_cyan-green_demonstration_of_frame_rate_control_FRC_4K60.webm/Green_and_cyan-green_demonstration_of_frame_rate_control_FRC_4K60.webm.160p.webm';
imageUrl = strcat(httpsUrl, '/assets/computerVision.jpg');
rgb = webread(imageUrl);
whos rgb
I'd like to analyse the video provided in the link, and I'd like to know whether there is a better way to do it than the existing one.
Thank you
0 Commenti
Risposta accettata
Piyush Patil
il 31 Mag 2023
Hello,
You can follow these steps to perform "webread" and analyze the video from the given link -
1. Download video data from the link using "webread
videoData = webread('https://upload.wikimedia.org/wikipedia/en/transcoded/4/4c/Green_and_cyan-green_demonstration_of_frame_rate_control_FRC_4K60.webm/Green_and_cyan-green_demonstration_of_frame_rate_control_FRC_4K60.webm.160p.webm');
2. Write video data to a file using "fwrite"
fid = fopen('vid_file_name.mp4', 'w');
fwrite(fid, videoData);
fclose(fid);
3. Read the video from the file using "VideoReader"
videoObj = VideoReader('vid_file_name.mp4');
4. Capture and display the video frames using a loop that iterates over all frames in the video
while hasFrame(videoObj)
frame = readFrame(videoObj);
imshow(frame);
end
5. Now you can analyze the frames as needed
Here is the example code -
% Download the video data
videoData = webread('https://upload.wikimedia.org/wikipedia/en/transcoded/4/4c/Green_and_cyan-green_demonstration_of_frame_rate_control_FRC_4K60.webm/Green_and_cyan-green_demonstration_of_frame_rate_control_FRC_4K60.webm.160p.webm');
% Write the video data to a file
fid = fopen('vid_file_name.mp4', 'w');
fwrite(fid, videoData);
fclose(fid);
% Read the video from the file
videoObj = VideoReader('vid_file_name.mp4');
% Capture and display the video frames
while hasFrame(videoObj)
frame = readFrame(videoObj);
imshow(frame);
% Analyze the frames as needed
end
Hope this helps!
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!