很高兴无意间看见你的博客,我有个MATLABT图像处理的小问题请教你,请指点,我发上代码你看看。
global S;
L=bwlabel(BW3);
P=imfeature(L,'Area');
S=[P.Area];
helpdlg(num2str(length(S)),'晶体颗粒个数')
function Untitled_13_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_13 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global S;
for i=1:length(S)
if( i<10) Q{i}=[num2str(i) ' ' num2str(S(i))];
else
Q{i}=[num2str(i) ' ' num2str(S(i)) ;
end
end
set(handles.listbox1,'String',Q);