Saving Data from for loop using ginput to create data.

1 visualizzazione (ultimi 30 giorni)
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.

Risposte (0)

Categorie

Scopri di più su Formatting and Annotation in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by