MATLAB: Overlay a scale bar over a running movie

image analysisimage processingscale bar

Hi,
I have a GUI (made with GUIDE) in which an image sequence stored as a movie container is displayed inside an axes. The displayed movie is actually made of 2 movies, an original movie concatenated with a filtered movie. I made another GUI which opens on the press of a button, allowing the user to draw a scale bar with customizable length, color and location. I use a"line" graphics object to draw the scale bar, which works very well on the current frame in the movie. Since the line is a graphics object I guess we can store it as selected and use the handles inside the while loop, but when I do this only the handle to the line object is displayed in the workspace (eg. 180.223…) and not the scale bar on the movie.
I can't figure out how to get the scale bar still visible as the movie is playing without having to define it inside the loop. I do have the handles to the line, but I can't keep it displayed over the movie. I thought of using set(handles.ScaleBar,'HandleVisibility','on') but in vain.
Here is a simplified part of the code used to display the movie. Any clue would be really appreciated. Thanks.
while frame <= TotalTFrameNumber
if frame == 0 || frame == TotalTFrameNumber % Boundary conditions...
frame = 1; % i.e first frame
end
hold on
imshow(mov(frame).cdata,'parent',gca) % Display the current
frame in the axes.
%%%%This is where I would like to display the line/scale bar.
handles.ScaleBar = line(...); % It only displays the handles in the
workspace instead of actually drawing the line
hold off
drawnow
frame = frame +1;
if MovieIsPlaying == false % Stop condition, which stops the movie running
on the press of a button.
break;
end
end

Best Answer

Did you try the movie() function instead of imshow()?