Matlab Code for Study of Gaussian Filter

MATLAB CODE:

%%%%%%%%%%%%% The main.m file  %%%%%%%%%%%%%%%
clear;
% Parameters of the Gaussian filter:
n1=10;sigma1=3;n2=10;sigma2=3;theta1=0;
% The amplitude of the noise:
noise=0.1;

[w,map]=gifread('lena.gif');             
x=ind2gray(w,map);
filter1=d2gauss(n1,sigma1,n2,sigma2,theta);
x_rand=noise*randn(size(x));
y=x+x_rand;
f1=conv2(x,filter1,'same');
rf1=conv2(y,filter1,'same');
figure(1);
subplot(2,2,1);imagesc(x);
subplot(2,2,2);imagesc(y);
subplot(2,2,3);imagesc(f1);
subplot(2,2,4);imagesc(rf1);
colormap(gray);
%%%%%%%%%%%%%% End of the main.m file %%%%%%%%%%%%%%%


%%%%%%% The functions used in the main.m file %%%%%%%
% Function "d2gauss.m":
% This function returns a 2D Gaussian filter with size n1*n2; theta is
% the angle that the filter rotated counter clockwise; and sigma1 and sigma2
% are the standard deviation of the gaussian functions.
function h = d2gauss(n1,std1,n2,std2,theta)
r=[cos(theta) -sin(theta);
   sin(theta)  cos(theta)];
for i = 1 : n2
    for j = 1 : n1
        u = r * [j-(n1+1)/2 i-(n2+1)/2]';
        h(i,j) = gauss(u(1),std1)*gauss(u(2),std2);
    end
end
h = h / sqrt(sum(sum(h.*h)));

% Function "gauss.m":
function y = gauss(x,std)
y = exp(-x^2/(2*std^2)) / (std*sqrt(2*pi));
%%%%%%%%%%%%%% end of the functions %%%%%%%%%%%%%%%%

OUTPUT
Fig: Smoothing nonnoisy Image

Fig: Noise Cancelling


Contact:
Mr. Roshan P. Helonde
Mobile: +91-7276355704
WhatsApp: +91-7276355704

Email: roshanphelonde@rediffmail.com
Share:

Matlab Code for Image Thresholding

This program show the effect of thresholding. The output are four subfigures shown in the same figure:

MATLAB CODE:

%%%%%%%%%%%%% The main.m file %%%%%%%%%%%%%%
clear;
% Threshold level parameter alfa:
alfa=0.1;% less than 1/3

[x,map]=gifread('lena.gif');
ix=ind2gray(x,map);
I_max=max(max(ix));
I_min=min(min(ix));
level1=alfa*(I_max-I_min)+I_min;
level2=2*level1;
level3=3*level1;
thix1=max(ix,level1.*ones(size(ix)));
thix2=max(ix,level2.*ones(size(ix)));
thix3=max(ix,level3.*ones(size(ix)));
figure(1);colormap(gray);
subplot(2,2,1);imagesc(ix);title('lena');
subplot(2,2,2);imagesc(thix1);title('threshold one alfa');
subplot(2,2,3);imagesc(thix2);title('threshold two alfa');
subplot(2,2,4);imagesc(thix3);title('threshold three alfa');
%%%%%%%%%%%%% End of the main.m file %%%%%%%%%%%%%%

OUTPUT:


Contact:
Mr. Roshan P. Helonde
Mobile: +91-7276355704
WhatsApp: +91-7276355704
Email: roshanphelonde@rediffmail.com
Share:

Matlab Code for Browse file in MATLAB

% Here, example source code for browse image file from any where, then show the image.
close all
clear all
%-----------------------------------
[F,PathName,FilterIndex] = uigetfile({'*.*','All Files(*.*)'}, 'Select your File ');
loadimage = strcat(PathName,F);
input = importdata(loadimage);
%------------ Display --------------
figure()
image(input); axis off
title('Original image');

Contact:
Mr. Roshan P. Helonde
Mobile: +91-7276355704
WhatsApp: +91-7276355704
Email: roshanphelonde@rediffmail.com
Share:

Matlab Code for Linear Regression and R Square in MATLAB



%Here, sample code for linear regression and R square calculation

close all

clear all

%---------- generate x-data and y-data ---------

x=[1,1.2,1.53,1.64,2.15,2.36];

y=[151.4,142.9,135.3,116.42,91.9,70.8];

%----------- Linear regression -----------------

p= polyfit(x,y,1);

f= polyval(p,x);

%----------- Call R-square function ------------

r2=Rsquare(x,y,p);





%------------- Plot data -----------------------

figure()

plot(x,y,'*k');hold on

plot(x,f,'-r'); % show linear fit

xlabel('index');

ylabel('Intensity a.u.');

title('Test: Linear regreesion && R-square');

%------- Show y-data on current figure ---------

[row col]=size(y);

for i=1:col

str=num2str(y(i));

text(x(i),y(i),str,'Color',[0 0 1]);

end

%--Show linear equation on current figure -------

m1=num2str(p(1));c1=num2str(p(2));Rsquare1=num2str(r2(1));

text(1.05,80,['y= ',m1,'x+',c1,' , R^2= ',Rsquare1,'.'],'FontSize',10,'FontName','Times New Roman');

save source code in function file

%---------The function return R-square value -------------

%--------- input data ==> x-data, y-data and p-data ----

%--------- output data ==> r2

function [r2]=Rsquare(x,y,p)

Ymeasure=y;

Ycalculate=(p(1)*x)+p(2);

meanY=mean(Ymeasure);

deltaY2=sum((Ycalculate-Ymeasure).^2);

distanceY2=sum((Ymeasure-meanY).^2);

r2=1-(deltaY2/distanceY2);


Contact:
Mr. Roshan P. Helonde
Mobile: +91-7276355704
WhatsApp: +91-7276355704
Email: roshanphelonde@rediffmail.com
Share:

Matlab Code To Apply DWT (Discrete Wavelet Transform) to Image

Explanation: 
              Discrete time wavelet transforms (DWT), which produces multi-scale image decomposition. By employing filtering and sub-sampling, a result in the form of the decomposition image (for classical dyadic approach) is produced, very effectively revealing data redundancy in several scales. A coding principle is then applied in order to compress the data. It superior to Fourier and DCT. It has Discrete Wavelet Transform (DWT) provides a multi resolution image representation and has become one of the most important tools in image analysis and coding over the last two decades. Image compression algorithms based on DWT provide high coding efficiency for natural (smooth) images. As dyadic DWT does not adapt to the various space-frequency properties of images, the energy compaction it achieves is generally not optimal. It has been widely applied and developed in image processing and compression.
          There exist two ways how to implement the computation of the discrete-time wavelet transform. The first approach uses convolution (filtering) with appropriate boundary handling, the second is a fast lifting  approach, a refined  system  of  very  short  filters  which  are  applied  in a way that produces the same result as the first approach, introducing significant computational and memory savings .Lifting  scheme  is  derived  from  a  polyphase  matrix  representation  of  the  wavelet  filters,  a representation  that  is  distinguishing  between  even  and  odd  samples.  Using  the  algorithm  of  filter factoring,  we  split  the  original  filter  into  a  series  of  shorter  filters  (typically  Laurent  polynomials  of first  degree).  Those filters are designed as lifting steps; each step one group of coefficients are lifted(altered) with the help of the other one  (classical dyadic transform always leads to two groups of coefficients, low-pass and high-pass). 
              Since images are two-dimensional signals, we have to extend the scheme to 2D space by applying the transform row and column-wise,respectively(taking separability of the transform  into account).

As a consequence four subbands arise from one level of the transform  –  one low-pass subband containing the coarse approximation of the source image called LL  subband, and three high-pass subbands that exploit image details across different directions – HL for horizontally for vertical and HH for diagonal details. IN the next level of the transform, we use the LL band for further decomposition and replace it with respective four subbands. This forms the decomposition image.

Advantages:
1. DWT has excellent energy compaction capabilities and hence the coding technique must be well-designed to achieve significant image compression.
 2. At low bit rate, DWT avoid the blocking artifacts of DCT.
3. It presents better coding performance.



Syntax:
[cA,cH,cV,cD] = dwt2(X,'wname')
computes the approximation coefficients matrix cA and details coefficients matrices cH, cV, and cD (horizontal, vertical, and diagonal, respectively), obtained by wavelet decomposition of the input matrix X. The 'wname' string contains the wavelet name.

[cA,cH,cV,cD] = dwt2(X,Lo_D,Hi_D)
 computes the two-dimensional wavelet decomposition as above, based on wavelet decomposition filters that you specify.
Lo_D is the decomposition low-pass filter.
Hi_D is the decomposition high-pass filter.
Lo_D and Hi_D must be the same length.

Program & Output:
clc
[file path]=uigetfile('*.*');
a=imread(file);
figure;imshow(a)
[ca ch cv cd]=dwt2(a,'haar');
figure;imshow([(ca/512),ch;cv,cd])
figure;
subplot(2,2,1);imshow(ca/512);title('Approximation')
subplot(2,2,2);imshow(ch);title('Horizontal')
subplot(2,2,3);imshow(cv);title('Vertical')
subplot(2,2,4);imshow(cd);title('Diagonal')

Fig: Barbara Original Image

Fig: Separate Subbands

Fig: Combined Subbands

Contact:
Mr. Roshan P. Helonde
Mobile: +91-7276355704
WhatsApp: +91-7276355704
Email: roshanphelonde@rediffmail.com
Share:

FingerPrint Recognition and Matching Using Image Processing Matlab Project with Source Code

ABSTRACT
                 The popular Biometric used to authenticate a person is Fingerprint which is unique and permanent throughout a person’s life. A minutia matching is widely used for fingerprint recognition and can be classified as ridge ending and ridge bifurcation. In this paper we projected Fingerprint Recognition using Minutia Score Matching method (FRMSM). For Fingerprint thinning, the Block Filter is used, which scans the image at the boundary to preserves the quality of the image and extract the minutiae from the thinned image. Fingerprint is a very vital concept in making us completely unique and can not be altered. It is necessary to recognize fingerprint in proper manner. Here we are trying to recognize the fingerprint image samples by using minute extraction and minute matching techniques. In minute extraction it counts the crossing numbers and from the count it will be classified as normal ridge pixel, termination point and bifurcation point. Then the input finger print data is compared with the template data. This is called as minute matching. 

PROJECT OUTPUT



PROJECT VIDEO

Contact:
Mr. Roshan P. Helonde
Mobile: +91-7276355704
WhatsApp: +91-7276355704
Email: roshanphelonde@rediffmail.com
Share:

Brain Tumor Detection Using Watershed Technique Matlab Project with Source Code

ABSTRACT
             In the field of medical image processing, detection of brain tumor from magnetic resonance image (MRI) brain scan has become one of the most active research. Detection of the tumor is the main objective of the system. Detection plays a critical role in biomedical imaging. In this project, MRI brain image is used to tumor detection process. This system includes test the brain image process, image filtering, morphological operation, Detection of the tumor, Finding Tumor Stage and determination of the tumor location. In this system, morphological operation of watershed technique is applied to detect the tumor. The detailed procedures are implemented using MATLAB. The proposed method extracts the tumor region accurately from the MRI brain image. The experimental results indicate that the proposed method efficiently detected the tumor from the brain image. Watershed Segmentation is the best methods to group pixels of an image on the basis of their intensities. Pixels falling under similar intensities are grouped together. Watershed is a mathematical morphological operating tool. Watershed is normally used for checking output rather than using as an input segmentation technique because it usually suffers from over segmentation and under segmentation. The watershed techniques are useful for segmentation of brain tumor. Image segmentation is based on the division of the image into regions. Division is done on the basis of similar attributes. 

PROJECT OUTPUT


PROJECT VIDEO

Contact:
Mr. Roshan P. Helonde
Mobile: +91-7276355704
WhatsApp: +91-7276355704
Email: roshanphelonde@rediffmail.com
Share:

Target Detection Using Image Processing Matlab Project with Source Code

ABSTRACT
             Target detection using image processing the automatic detection and marking of target objects will improve the efficiency of remote sensing image interpretation.  Target detection refers to the use of high spectral resolution remotely sensed images to map the locations of a target or feature (often a plant species of interest) with a particular spectral or spatial signature. Target detection or feature extraction encompasses a broad range of techniques, including measurements derived from individual bands and more complex methods designed to recognize discrete features by shape, hyperspectral signature, or texture. Targets of interest are often smaller than the pixel size of the image (subpixel target detection) or are mixed with other nontarget cover types within a pixel, requiring techniques such as spectral mixture analysis to detect the target species. Hyperspectral images are useful in target detection because they contain a large contiguous set of spectral bands, often numbering in the hundreds to thousands, and provide large quantities of high spectral resolution data. Using a hyperspectral image, the spectral properties of the target, such as contrast, variability, similarity and discriminability, can be used to detect targets at the subpixel level. The user specifies spectral endmembers, which are the reflectance spectra of the “pure” targets that occur across the landscape, and image processing software is used to characterize the extent of the target across the landscape. The selection of spectral endmembers is similar to the idea of identifying training areas in supervised classification, but the spectral endmember can then be used at a subpixel level to detect the species of interest. Spectral endmembers are often generated in the field using a field spectroradiometer. Then the image is processed using classification algorithms to detect the locations of the target species.

PROJECT OUTPUT


PROJECT VIDEO

Contact:
Mr. Roshan P. Helonde
Mobile: +91-7276355704
WhatsApp: +91-7276355704
Email: roshanphelonde@rediffmail.com
Share:

Contact Us

Name

Email *

Message *

Blog Archive

Popular posts