Image Processing Using Matlab
Image Processing Using Matlab
SCIENCE CLUB
PRESENTS
INTRODUCTION TO IMAGE
PROCESSING USING MATLAB
>>
>>
>>
>>
>>
>>
>>
>>
Histogram
Command: ihist(im)
The histogram gives the number of pixels in a picture for a
corresponding pixel value.
Thresholding
Initial image:
Thresholding
>> im= imread(sign.png)
>> im= double(im)
>> im= im/255
>> im2= im>0.7
The im2 is a 2 dimentional
binary matrix of datatype
logical.
Mean filter
>> im=imread('sign.png');
>> imnoisy=imnoise(im,'salt &
pepper',0.1);
>> f=fspecial('average')
f=
0.1111
0.1111
0.1111
0.1111
0.1111
0.1111
0.1111
0.1111
0.1111
>> f1=filter2(f,imnoisy);
>> imshow(uint8(f1))
Median filter
>> med=medfilt2(imnoisy);
>> imshow(med)
Problem solved!!!
Wiener Filter
Command:
>> w= wiener2(imn,[5 5]);
>> imshow(w)
The Weiner Filter is much preferred over Gaussian Filter as the
Gaussian Filter blurs the image.
The Weiner Filter filters out the noise from an image by minimizing
the mean square error.
Concept of Filtering
-1
-1
-1
-1
[x,y]=meshgrid(-128:127,-128:127);
z=sqrt(x.^2+y.^2);
figure, imshow(uint8(z))
zt=(z<20);
figure, imshow(zt)
ztf=fftshift(fft2(zt));
ztf1=log(1+abs(ztf));
m=max(ztf1(:));
figure, imshow(im2uint8(ztf1/m))
Simple Remedy
Edge detection
Colour !!!
>>
im=imread(flowers8.png
);
>> about a
a [uint8] : 426x640x3
(817.9 kB)
>>
squeeze(im(100,200,:))
ans =
208
154
178
R = im(:,:,1);
G = im(:,:,2) ;
B=im(:,:,3);
R=double(R);
G=double(G);
B=double(B);
Y=R+G+B;
r= R./Y ;
g=G./Y ;
b=B./Y;
Chromaticity Classification
In the next step let us use the
command:
>> bin=(r>0.6) & (g<0.4);
What does this do?
Bingo!!!
We just separated the
red portion in the
picture!!!
Lets Play!!!
Green Screen
Colour Segmentation
>> label=bwlabel(C);
>> max(max(label));
>> im1=(label==1);
>> figure, imshow(im1)
>> figure,
imshow(label==6)
>> figure,
imshow(label==10)
for i=1:size(row,1)
x=row(i,1)-sx;
y=col(i,1)-sy;
target(x,y)=A(row(i,1),col(i,1)
);
end
mytitle=strcat('Object
Number:',num2str(j));
figure, imshow(target);
title(mytitle);
end
EUREKA!!!
EUREKA!!!
Result!!!
Sliding Window
Goal!!!
Sliding Window
Text Detection
OCR Scheme
Training
Data
Pre-processing
Pre-processing
Feature
Extraction
Feature
Extraction
Model
Estimation
Classification
Test
Data
Face Detection
Basic Idea: Slide a window across image and evaluate a face
model at every location
Challenges:
Sliding window detector must evaluate tens of thousands of
location/scale combinations
Faces are rare: 010 per image
Face Detection
Face recognition is a visual pattern recognition problem
A face is a three-dimensional object subject to varying
Skin
Segmentation
RGB to YCbCr
RGB to HSV
Threshold to
determine skin
region
Skin
pixels
Multi solution
iterative
template
matching
Classifier
Face/Nonface
Electrons et Photons
Eye Detection!!!
Aye it works!!!
The Approach
Preprocessin
g
Feature
Extraction
Classification
Morphological
Colorometric
Texture
Neural Network
Support Vector Machine (SVM)
Fuzzy Clustering
Voila!!!
Other Uses!!!
Cell count
Quality control in manufacturing
Studying genome and mutation in genes
Autonomous driving vehicle
Lane Detection!!!
Template Matching
Image:
Template:
Template Matching
Template Matching
THANK YOU!!!