Updating Image within axes on GUI

1 view (last 30 days)
Hi, I have a live video feed in axes1. I'm trying to crop a box from present frame each 1ms and put it in axes 2 so axis two is simulating showing a video of the cropped area. A timer is supposed to control the update. For some reason, after the first iteration of the timer function, it gives an error:
< Error while evaluating TimerFcn for timer 'timer-1'
Reference to non-existent field 'axes2'. >
My timer updating function is
function user_timer_update(src,evt, fig_handle,vid)
global gy;
Rec_Size = [640,360,1000,1000];
handles = guihandles(fig_handle);
axes(handles.axes2);
J = getsnapshot(vid);
J = imcrop(J,Rec_Size);
imshow(J,'Parent',handles.axes2);
gy = gy + 1;
disp(gy);
Please how do I rectify this?? Thanks for the help. I already tried changing the "NextPlot" value to "replace children" and it works but it drastically slows down the live feed in the first axes.

Accepted Answer

Image Analyst
Image Analyst on 30 Nov 2014
You need to place an axes control on your figure called axes2. Because it's missing, that seems to be the problem.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!