MATLAB: Getframe produces greater image

axesbordergetframeImage Processing Toolbox

Hello,
I am using getframe() to read out axes that show an image. For example an 120×90 image. But the image I get from the getframe() function has a size of 121×91. There is a small white border. How can I turn that off? Btw I am showing the image without axis.

Best Answer

I do not understand your explanations. What is "the number of the current frame"? You cannot store a number "in a handle", because a handle is a kind of pointer to a HG object and created by Matlab. You mean a struct called "handle", but this is a confusing formulation. What do you think is stored in handle.frame_xy?
Again, please show us the code. It sounds like you forgot to store the modified handles struct. Then this might help:
function TheButtonCallback(hObject, EventData)
handles = guidata(hObject); % Get handles struct from figure
handles.frame_xy = how ever you obtain it
guidata(hObject, handles); % Store modified struct in the figure
Then the modified handles struct can be obtained by guidata again. If this is your problem, sharing data between callbacks is your main problem, and the extremely confusing decision of TMW to call the struct for storing figure related information "handles". Use the Search field of this forum and look form "share gui" to find many related threads: http://www.mathworks.com/matlabcentral/answers/?term=share+gui