how to saving image of quadtree from axes

1 vue (au cours des 30 derniers jours)
Elsya Nurul Aini
Elsya Nurul Aini le 29 Fév 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??

Réponse acceptée

Chandra Kurniawan
Chandra Kurniawan le 29 Fév 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
  1 commentaire
Elsya Nurul Aini
Elsya Nurul Aini le 29 Fév 2012
Thank you ^_^
It's very usefull =)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Computer Vision with Simulink dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by