Is my feature extraction using glcm is true or false? Please!!!
Mostrar comentarios más antiguos
i am doing plant disease detection and classification. i do the following steps:
- preprocessing using median filtering
- image segmentation using color thresholder app in matlab
- feature extraction using GLCM
- classification using SVM
In this, i have done step 3 but i'm not certain it is true. So, i want to check up my code in feature extraction don't call function. How can i check up?(Eg. if i get energy=0.5, how to calculate to get 0.5 by handwritten without using mathlab function?)
My code is given in the following:
% Title : Potato Leaf Disease Detection using SVM
clc
close all
clear all
[filename, pathname] = uigetfile({'*.*';'*.bmp';'*.jpg';'*.gif'},
'Pick a Leaf Image File');
I = imread([pathname,filename]);
I = imresize(I,[256,256]);
%figure, imshow(I); title('Input Leaf Image');
%Preprocessing using median filtering
I1 = rgb2gray(I);
I2 = medfilt2(I1,[3 3]);
imshow(I2);title('Filtered Image');
%%Image Segmentation
%Background Removing using Color Thresholder app
[bw,rgb] = background_removal(I);
%Masking Green_Pixels
mask = (rgb(:,:,2)>rgb(:,:,1))&(rgb(:,:,2)>rgb(:,:,3));
seg_img=bsxfun(@times,rgb,cast(imcomplement(mask),'like',rgb));
imshow(seg_img);
%%Feature Extraction
% Convert to grayscale if image is RGB
img = rgb2gray(seg_img);
% Create the Gray Level Cooccurance Matrices (GLCMs)
glcms = graycomatrix(img);
%Evaluate 10 features from the disease affected region only
% Derive Statistics from GLCM
stats = graycoprops(glcms,'Contrast Correlation Energy Homogeneity');
Contrast = stats.Contrast;
Correlation = stats.Correlation;
Energy = stats.Energy;
Homogeneity = stats.Homogeneity;
Mean = mean2(seg_img);
Standard_Deviation = std2(seg_img);
Entropy = entropy(seg_img);
RMS = mean2(rms(seg_img));
%Skewness = skewness(img)
Kurtosis = kurtosis(double(seg_img(:)));
Skewness = skewness(double(seg_img(:)));
% Put the 10 features in an array
feat_disease = [Contrast,Correlation,Energy,Homogeneity, Mean, Standard_Deviation, Entropy, RMS, Kurtosis, Skewness];
Someone can tell me my code is true or false?
5 comentarios
Image Analyst
el 24 de Jun. de 2018
Looks like the code is false. At least I can't see anything so it can't possibly do anything.
Yoon ThiriZaw
el 24 de Jun. de 2018
Editada: Yoon ThiriZaw
el 24 de Jun. de 2018
Image Analyst
el 24 de Jun. de 2018
Well at least the code is there now (unlike before), but you didn't format it properly because you have not read this link yet. Please read it and fix your formatting.
Yoon ThiriZaw
el 25 de Jun. de 2018
Editada: Image Analyst
el 16 de Oct. de 2018
Image Analyst
el 16 de Oct. de 2018
That would be easier to do if you had attached/uploaded an image!
Respuestas (0)
Categorías
Más información sobre Agriculture en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!