Saving Data from for loop using ginput to create data.

1 回表示 (過去 30 日間)
Chris
Chris 2014 年 4 月 16 日
コメント済み: Image Analyst 2014 年 4 月 19 日
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.

回答 (0 件)

カテゴリ

Help Center および File ExchangeFormatting and Annotation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by