0% found this document useful (0 votes)
19 views

All All: %% Get The File From The Current Folder

This document summarizes an image processing and analysis workflow including: 1. Loading an image, resizing it, and converting it to grayscale. 2. Applying median filtering for preprocessing. 3. Enhancing the image using logarithmic and gamma functions. 4. Segmenting the image using Markov random field modeling. 5. Performing principal component analysis. 6. Calculating the area of segmented regions. 7. Classifying new areas as normal or abnormal using support vector machines.

Uploaded by

jacobgjayaseelan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

All All: %% Get The File From The Current Folder

This document summarizes an image processing and analysis workflow including: 1. Loading an image, resizing it, and converting it to grayscale. 2. Applying median filtering for preprocessing. 3. Enhancing the image using logarithmic and gamma functions. 4. Segmenting the image using Markov random field modeling. 5. Performing principal component analysis. 6. Calculating the area of segmented regions. 7. Classifying new areas as normal or abnormal using support vector machines.

Uploaded by

jacobgjayaseelan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

clc;

clear all;
close all;

%% Get the file from the Current Folder

[f p]=uigetfile('.*')
a=imread([p f])
figure()
imshow(a)
a=imresize(a,[256 256])
a1=rgb2gray(a)

%% Preprocessing Technique using Median filter

B = medfilt2(a1)
figure()
imshow(B)

%% Image Enhancement using lagarithamic Function and Gamma


Functions

b=im2double(B);
z=b; q=b;
[r,c]=size(b);
con=2;
for i=1:r
for j=1:c

z(i,j)=con *log(1+b(i,j));

q(i,j)=con *b(i,j)^0.4;
end
end

figure(); imshow(z); title('logarithmic image');

figure(); imshow(q); title('gamma image');

%% Image segmentation using MRF model

I = z;
class_number=3;
potential=0.5;
maxIter=30;
seg=ICM(I,class_number,potential,maxIter);
figure('name','Image segmentation using MRF model');
imshow(seg,[]);title('MRF segmented result');
colormap jet

%% Principle Component Analysis

[Evalues, Evectors, x_mean]=PCA(I);


figure,imshow(Evectors,[]);title('PCA')

%% Area Calculation

stats = regionprops(a, 'Area');


Area = stats. Area

% save Area6 Area6

% % Svm Classification

load Area1
load Area2
load Area3
load Area4
load Area5
load Area6

T=[Area1; Area2; Area3; Area4; Area5; Area6];


T=abs(T);
C=ones(length(T),1);
C(1:3)=1;
C(3:6)=2;

tst=Area;

svmStruct =
svmtrain(T,C,'kernel_function','rbf','showplot',true);
classes = svmclassify(svmStruct,tst,'showplot',true);

if classes == 1
msgbox('Abnormal');
elseif classes == 2
msgbox('Normal');
end

You might also like