I've made GUI with GUIDE which makes RGB image into binary image. Before I change the RGB image into binary image, I read the image from another axes not from folder.
%read multiple image at once and showed it in multiple axes
[files,folder,FilterIndex] = uigetfile('*.jpg*','MultiSelect','on');handles.img=cell(1,numel(files));for ifile = 1:numel(files) filename=fullfile(folder,files{ifile}); img=imread(filename); ax = findall(gcf,'type','axes','tag',sprintf('axes%d',ifile)); imshow(img,'Parent',ax); handles.img{ifile} = img;endguidata(hObject,handles);%change RGB image in axes1 into binary image
proses=guidata(gcbo);D=get(proses.citraasli,'Userdata'); abu=rgb2gray(D); cb=imclearborder(abu); thresh=graythresh(cb);b=im2bw(cb,thresh); bw=bwareaopen(b,60); bwfill=imfill(bw,'holes'); [c,num]=bwlabel(bwfill,8);for i=1:1:num axesName=sprintf('axes%d',i); ax=handles.(axesName); imshow((c==i),'Parent',ax);endguidata(hObject,handles);
This command works properly in another GUI program, but it gives that following error:
??? Error using ==> rgb2gray>parse_inputs at 82MAP must be a m x 3 array.Error in ==> rgb2gray at 35X = parse_inputs(varargin{:});Error in ==> guikedelaizulfa>ekstrakfitur_Callback at 1127abu=rgb2gray(D);Error in ==> gui_mainfcn at 96 feval(varargin{:});Error in ==> guikedelaizulfa at 42 gui_mainfcn(gui_State, varargin{:});Error in ==>@(hObject,eventdata)guikedelaizulfa('ekstrakfitur_Callback',hObject,eventdata,guidata(hObject))??? Error while evaluating uicontrol Callback>>
I've checked the image is RGB image, and i can't find the problem to fix it. If somebody knows how to fix it, please help me! Thank you!
Best Answer