Saving Data from for loop using ginput to create data.

1 vue (au cours des 30 derniers jours)
Chris
Chris le 16 Avr 2014
Commenté : Image Analyst le 19 Avr 2014
I am using ginput to select locations of markers in video frames, however when it moves to the next frame it overwrites the data from the previous frame.
obj = VideoReader('Test.mp4'); nFrames=obj.NumberofFrames %nFrames will go in place of 2 in final code to run full length of video.
for k = 1: 2 %fill in the appropriate number this_frame = read(obj, k); thisfig = figure(); thisax = axes('Parent', thisfig); image(this_frame, 'Parent', thisax); title(thisax, sprintf('Frame #%d', k)); [x y] = ginput(3); data=[x y] end I've tried using this also but it gives an error that subscripted assigned indices are mismatched.
data= [] for data(end+1,:)=ginput(1); x=data(k,1) y=data(k,2) end Any help would be greatly appreciated.

Réponses (0)

Catégories

En savoir plus sur Formatting and Annotation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by