how to saving image of quadtree from axes

1 回表示 (過去 30 日間)
Elsya Nurul Aini
Elsya Nurul Aini 2012 年 2 月 29 日
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??

採用された回答

Chandra Kurniawan
Chandra Kurniawan 2012 年 2 月 29 日
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 件のコメント
Elsya Nurul Aini
Elsya Nurul Aini 2012 年 2 月 29 日
Thank you ^_^
It's very usefull =)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeComputer Vision with Simulink についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by