combine binary image
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a code like this
%%function of checkbox: cJalan -------
jalan = get(handles.aJalan, 'Userdata');
[p, l] = size(jalan);
nil = get(handles.cJalan, 'Value');
if nil == 1
jalan;
setappdata(handles.cJalan, 'jalan_', jalan);
else
jalan = zeros(p,l, 'uint8');
setappdata(handles.cJalan, 'jalan_', jalan);
% handles.jalan = jalan;
end
% -----------------------------------------
%%function of checkbox: cSungai
function cSungai_Callback(hObject, eventdata, handles)
sungai = get(handles.aSungai, 'Userdata');
[p, l] = size(sungai);
nil = get(handles.cSungai, 'Value');
if nil == 1
sungai;
setappdata(handles.cSungai, 'sungai_', sungai);
else
sungai = zeros(p,l, 'uint8');
setappdata(handles.cSungai, 'sungai_', sungai);
end
% ---------------------------------------
and 3 checkboxs other. i used them to combine their object, the object of 'cJalan' is 'jalan', and object of 'cSungai' is 'sungai'
each object will be called to combine the objects into a frame.. and i try to used this code to combine them..
to illustrate the problem, u can look this picture http://www.flickr.com/photos/77405333@N03/6791139372/
j = getappdata(handles.cJalan, 'jalan_');
s = getappdata(handles.cSungai, 'sungai_');
l = getappdata(handles.cLapangan, 'lapangan_');
sa = getappdata(handles.cSawah, 'sawah_');
g = getappdata(handles.cGedung, 'gedung_');
gabung = j|s|l|sa|g;
l, sa and g have same code with 2 checkbox others. in this case, 3 checkbox is unchecked.
how I can combine them, although not all axes fully.. do you have any example code with this problem..?? thanks..
0 comentarios
Respuesta aceptada
Chandra Kurniawan
el 9 de Mzo. de 2012
Hi,
I think, first you should check whether the data is empty or not using for-loop.
hnd = {handles.cJalan,handles.cSungai,handles.cLapangan,handles.cSawah,handles.cGedung};
var = {'jalan_','sungai_','lapangan_','sawah_','gedung_'};
% I assume that the images have 256x256 dimension
gabung = logical(zeros([256 256]));
for x = 1 : 5
v{x} = getappdata(hnd{x},var{x});
if ~isempty(v{x})
gabung = gabung | v{x};
end
end
imshow(gabung);
I hope this works!
2 comentarios
Chandra Kurniawan
el 10 de Mzo. de 2012
Please see your question page :
http://www.mathworks.com/matlabcentral/answers/31729-make-history
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!