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 CenterFile Exchange에서 Formatting and Annotation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by