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:

Blood Group Detection Using Image Processing Matlab Project with Source Code

ABSTRACT
           Determining of blood types is very important during emergency situation before administering a blood transfusion. Presently, these tests are performed manually by technicians, which can lead to human errors. Determination of the blood types in a short period of time and without human errors is very much essential. A method is developed based on processing of images acquired during the slide test. The image processing techniques such as thresholding and morphological operations are used. The images of the slide test are obtained from the pathological laboratory are processed and the occurrence of agglutination are evaluated. Thus the developed automated method determines the blood type using image processing techniques. The developed method is useful in emergency situation to determine the blood group without human error.
         Before the blood transfusion it is necessary to perform certain tests. One of these tests is the determination of blood type. There are certain emergency situations which due to the risk of patient life, it is necessary to administer blood immediately. The tests currently available require moving the laboratory, it may not be time enough to determine the blood type and is administered blood type O negative considered universal donor and therefore provides less risk of incompatibility. However, despite the risk of incompatibilities be less sometimes that cause death of the patient and it is essential to avoid them. Thus, the ideal would be to determine the blood type of the patient. Secondly, the pre-transfusion tests are performed by technicians, which lead to human errors. Since these human errors can translate into fatal consequences, being one of the most significant causes of fatal blood transfusions is important to automate the procedure of these tests. Various blood type classification, diffusive reflectance, ABO Rh-D blood typing using simple morphological image processing.There is a scope for determining blood types using image processing techniques. Image segmentation algorithm for blood type classification and various image processing parameters are analyzed. Image features, such as color, texture, shape are analyzed. Low quality ancient document images and antibody agent analysis using image processing is explained. The slide test consists of the mixture of one drop of blood and one drop of reagent, being the result interpreted according to the occurrence or not of agglutination. The combination of the occurrence and nonoccurrence of the agglutination determines the blood type of the patient. Thus, the software developed in image processing techniques allows, through an image captured after the procedure of the slide test detect the occurrence of agglutination and consequently the blood type of the patient.

PROJECT OUTPUT



PROJECT VIDEO


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

Matlab Project for Electronic Online Voting Machine (EVM) Using Matlab

ABSTRACT
                    Electronic voting machine is generally used now days in some countries including India for conducting election of government in a country. But the Electronic voting machine has certain disadvantages like illegal voting and insecurity. Hence the concept of online voting system is started in some countries for conducting election. Most of the developed countries have started using online voting system but they are facing some problems in conducting it. Estonia is the only country started conducting the online voting system in national election. But the percentage of voting is only 20% to 30%. Different researchers have designed a online voting system But the system are not so much efficient in terms of accuracy and security. Also the voting system has high error rate. Hence the voting system is not flexible and can be used for specific region only. Biometric authentication is found to be more secure and accurate in certain application. Different biometric authentications like fingerprint, retina etc. can be used in designing an application to enhance the security. As fingerprint of every individual is unique it can be used for designing a voting system. Different fingerprint matching techniques has been discussed considering the FRR ratio.

PROJECT OUTPUT

PROJECT VIDEO

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

Matlab Project with Source Code Contrast Enhancement using Adaptive Gamma Correction With Weighting Distribution Technique

ABSTRACT
                 One of the important techniques in digital image processing is to enhance images. Contrast enhancement is a method that is used to enhance images for viewing process or for further analysis of images. Main idea behind contrast enhancement techniques is to increase contrast and to preserve original brightness of images. In this paper a contrast enhancement technique is proposed that first segments histogram of image recursively and then applies Adaptive Gamma Correction with Weighting Distribution (AGCWD) Technique. The proposed technique is basically an improvement over AGCWD technique and aims to get better contrast enhancement and brightness preservation than AGCWD technique. The image enhancement is one of the significant techniques in digital image processing. It has an important role in various fields where images are to be understood and analyzed. Image enhancement is done on an image to improve its visual effects and quality or to make it more appropriate for further processing by another application. An image can have low contrast or bad quality due to a number of reasons like poor quality of imaging device, adverse external conditions at the time of image acquisition and many more. The contrast enhancement is one of the commonly used image enhancement method
                     Histogram equalization is the traditional technique for contrast enhancement. It basically maps gray levels based on probability distribution of input image. But image obtained by this method can produce undesirable effects in image and also original brightness of image is not preserved. Histogram equalization technique redistributes probability densities. Adaptive Gamma Correction with Weighting Distribution (AGCWD) technique is based on histogram modification method. This technique combines both gamma correction and histogram equalization techniques. Gamma correction is a transform based histogram modification technique that uses a varying parameter γ (gamma). Gamma correction method had problem that unvaried modification results for every image because a predefined value was used for all images. Histogram equalization had problem of under enhancement and over enhancement. So the AGCWD technique removed disadvantages of both gamma correction and Histogram Equalization techniques by combining both techniques and using a weighting function. In this technique gamma correction is applied using normalized cumulative density function (cdf). The AGCWD technique effectively enhances images. To further improve this technique to get better contrast enhancement and better brightness preservation an improvement is proposed in this project. Improvement proposed is based on recursive segmentation of histogram.

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