Please help me...i dont know to classify image using RBF in ANN......can anyone help?????i also post my code.....please verify my code..

clc; clear all ; close all; [fname,path]=uigetfile({'*.jpg';'*.png';'*.bmp'},'Select Image'); i=[path,fname]; im=imread(i); figure,imshow(im); title('original image'); img2=rgb2gray(im); img2=imresize(img2,[512 512]); TT = []; cd datbse for i = 1 : 6 str = int2str(i); str = strcat(str,'.jpg'); img = imread(str); [r c p] = size(img); if p==3 img = rgb2gray(img); end img=imresize(img,[200 200]); [irow icol] = size(img); H=fspecial('gaussian'); im1=imfilter(img,H,'replicate'); % thresholding %%%% [m,n]=size(im1); level=graythresh(im1); BW = im2bw(im1,level);
for i=1:m for j=1:n if BW(i,j)==0 NewI(i,j)=im1(i,j); else NewI(i,j)=0; end end end out1=mat2gray(NewI); %% end %% %%%%%%%%%%%%%%%%%%%%%%%%%% % feature extraction using DWT %%% [a h v d] = dwt2(out1,'db3'); s1 = [a h;v d]; [r c] =size(s1); %figure,imshow(s1,[]); [x y]=size(s1); meanim = mean2(s1); stdde=std2(s1); entroppy=entropy(s1); glc=graycomatrix(s1); stats=graycoprops(glc,'Contrast','Correlation','Energy'); disp('F1='); F1=[meanim stdde entroppy stats.Contrast stats.Correlation stats.Energy]; disp(F1); TT = [TT ;F1];
disp('TT='); disp(TT); end cd .. Database_feature=TT; helpdlg('Database loaded sucessfully'); TT=transpose(TT); %% smoothing using guassian filter %%% H=fspecial('gaussian'); im1=imfilter(img2,H,'replicate'); figure,imshow(im1); title('smoothed image using guassian filter') %im1 = rgb2gray(f); handles.im = im1; helpdlg('Test Image Selected'); %% thresholding %%%% [m,n]=size(im1); level=graythresh(im1); BW = im2bw(im1,level); figure,imshow(BW);
for i=1:m for j=1:n if BW(i,j)==0 NewI(i,j)=im1(i,j); else NewI(i,j)=0; end end end out1=mat2gray(NewI); figure,imshow(out1); title('threshold based segmentation'); %%%%%%%%%%%%%%%%%%%%%%%%%%%
%% feature extraction using DWT %%% [a h v d] = dwt2(out1,'db3'); s1 = [a h;v d]; [r c] =size(s1); figure,imshow(s1,[]); [x y]=size(s1); meanim = mean2(s1); stdde=std2(s1); entroppy=entropy(s1); glc=graycomatrix(s1); stats=graycoprops(glc,'Contrast','Correlation','Energy'); F2=[meanim stdde entroppy stats.Contrast stats.Correlation stats.Energy]; disp('F2='); disp(F2); %% end %%%%%%
%%%%classification using ANN %%%%% str1 = 'image';str3 = '.mat'; c1=6; F=TT; for i = 1:c1 name = strcat(str1,num2str(i)); P =F; save(name,'P'); end
Tc=[1 1 1 1 2 2]; SPREAD=1; T=ind2vec(Tc); net=newrbe(P,T,SPREAD);
A = sim(net,P); ANNresult = vec2ind(A); %ANNresult = vec2ind(aa); c=im2bw((im(:,:,1))); cc=imcomplement(c); Eqdist=sum(sum(cc)); result=ANNresult(:,1)*Eqdist; Eqdisttarget=41e4; if result>Eqdisttarget msgbox('BENIGN') else msgbox('MALIGNANT') end

Réponses (0)

Catégories

En savoir plus sur Write C Functions Callable from MATLAB (MEX Files) dans Centre d'aide et File Exchange

Question posée :

le 22 Jan 2015

Community Treasure Hunt

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

Start Hunting!

Translated by