how to saving image of quadtree from axes

1 visualización (últimos 30 días)
Elsya Nurul Aini
Elsya Nurul Aini el 29 de Feb. de 2012
Dear all,
I have a problem in saving quadtree image from gui axes.
I've written this code to calculate quadtree decomposition
qt = qtdecomp(im,t);
blocks = repmat(uint8(0),size(qt));
for dim = [512 256 128 64 32 16 8 4 2 1];
numblocks = length(find(qt==dim));
if (numblocks > 0)
values = repmat(uint8(1),[dim dim numblocks]);
values(2:dim,2:dim,:) = 0;
blocks = qtsetblk(blocks,qt,dim,values);
end
end
blocks(end,1:end) = 1;
blocks(1:end,end) = 1;
hold on;
axes(handles.quadtree); % axes for displaying quadtree image in gui Matlab
imshow(blocks,[]);
Then, i wanna save the image by calling this function
function save_Callback(hObject, eventdata, handles)
% hObject handle to simpan (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
ImQuadtree = getimage(handles.quadtree);% getting image from quadtree axes
[nm_file,nm_dir] = uiputfile({'*.jpg';'*.bmp';'*.png';'*.tif';'*.*'},'Saving Quadtree Image');
if isequal(nm_file,[])
msgbox('The Image is not Stored!','Warning','warn');
elseif isequal(ImQuadtree,[])
msgbox('There is no image to stored!','Warning','warn');
else
imwrite(ImQuadtree,strcat(nm_dir,nm_file));
msgbox('Quadtree Image Successfully Stored','Save','help');
end
The problem is when the image is successfully saved, the image result is a black image. There is no block on these image. So, how i can save the image block??

Respuesta aceptada

Chandra Kurniawan
Chandra Kurniawan el 29 de Feb. de 2012
Hi, Elsya
please try to add this line
ImQuadtree = 255*ImQuadtree;
after line :
ImQuadtree = getimage(handles.quadtree);% getting image from quadtree axes
in your 'save_Callback'
I hope this works

Más respuestas (0)

Categorías

Más información sobre Computer Vision with Simulink en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by