How to capture frames from video and display & compare those frames to detect edge detection ??

Hi all,
I am new to MATLAB and want to capture video continuously and from that i want some frames to compare and want to detect the edge but i am not able to do this because when i ws capturing the video at that same time the video trigger can not increses it's value .
It is possible to capture the images or frames from video that is actually snapshot and display that snapshot or plot the different frames in one plot with the use of subplot ??
here is the code which i m trying and go into infinite loop. please help me out with this.
clc; clear; close all; vid = videoinput('winvideo'); preview(vid); get(vid); start(vid); while(vid.FramesAcquired<=10) vid.FramesPerTrigger = 9; vid.ReturnedColorspace = 'grayscale'; img1=getdata(vid); subplot(2,1,1); imshow(img1); set(gcf, 'Position', get(0,'Screensize')); img2= fullfile(pwd, 'try1.jpg'); imwrite(img1,img2); subplot(2,1,2); imshow(img2); frm1=getsnapshot(vid); pause(2); frm2=getsnapshot(vid); subplot(2,2,1); imshow(frm1); subplot(2,2,2); imshow(frm2); end delete(img2);

 Accepted Answer

Use your own counter instead of vid.FramesAcquired.

2 Comments

can you help me with this i have tried but it will create infinite loop for MATLAB ..
numberOfFramesProcessed = 0;
while numberOfFramesProcessed <= 10
% Your code goes here. Then increment:
numberOfFramesProcessed = numberOfFramesProcessed + 1;
end

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!