Вы находитесь на странице: 1из 14

COMPARASION OF EDGE DETECTION TECHNIQUES ON NUMBER PLATE RECOGNITION OF VEHICLE IMAGE

A Mini Project Report Submitted to DEPARTMENT OF INFORMATION TECHNOLOGY In partial fulfillment of the requirements for the award of the degree Of BACHELOR OF TECHNOLOGY In INFORMATION TECHNOLOGY By P.HARIRAM PRASAD (Y08IT095) N.MURALI (Y08IT086) Under the Estimated Guidance Of Mr.RADHE SYAM .V N.PRABHUKIRAN (Y08IT083) T.RAJARAO (Y08IT115)

DEPARTMENT OF INFORMATION TECHNOLOGY V.R.SIDDHARTHA ENGINEERING COLLEGE (AUTONOMOUS) VIJAYAWADA-520007 MARCH-2011

VELAGAPUDI RAMAKRISHNA SIDDHARTHA ENGINEERING COLLEGE (AUTONOMOUS)

CERTIFICATE
This is to certify that the project report entitled COMPARASION OF EDGE DETECTION

TECHNIQUES ON NUMBER PLATE RECOGNITION OF VEHICLE IMAGEis being submitted byP.HARIRAM PRASAD (Y08IT095), N.PRABHUKIRAN (Y08IT083), N.MURALI (Y08IT086), T.RAJA RAO (Y08IT115) in partial fulfillment for the award of degree of bachelor of technology in the branch of Information Technology to the Acharya Nagarjuna University is a record of bonafide work carried out by this batch under my guidance and supervision. The results embedded in this project report have not been submitted to any other university or institute for the award of any degree.

Mrs. G.JAYALAKSHMI INCHARGE MINIPROJECTS DATE:

Mr.RADHE SYAM.V Dr.A.KOTESWARAO PROJECT GUIDE HEAD OF THE DEPARTMENT DATE:

DATE:

ACKNOWLEDGEMENT
We owe a great many thanks to a great many people who helped and Supported us during the writing of this book. Our deepest thanks to Lecturer, Mr. V.Radhesyam the Guide of the project for guiding and correcting various documents of our with attention and care. He has taken pain to go through the project and make necessary correction as and when needed. We express my thanks to our mini projects in charge o, Mrs. G.Jayalakshmi for Extending her support. We would also thank I.T Department and our faculty members without whom this project would have been a distant reality. We also extend our heartfelt thanks to our family and well wishers.

Table of Contents

page no

1. Abstract 2. Introduction 3. State Of Art Proposed 4. Proposed method & Implementation 4.1 edge detection 4.2 phase correlation 4.2.1 main method 4.2.2 phase correlation function 5. Result 5.1 edge detection outputs 5.2 phase correlation values 6. Conclusion 7. Bibliography

1 1 2 2 2 3 3 4

7 9 10 11

1.Abstract

Edge detection is a terminology in image processing, referring to algorithms which aim at identifying points in an image at which the brightness changes sharply. Edge detection usually is a preliminary phase in object recognition algorithms, as it may significantly reduce the amount of data to be processed. This report concludes the COMPARISION OF THE EDGE DETECTION ALGORITHMs. The module implements various Edge detection algorithms, among which: Canny Algorithm, Robert Algorithm, Pweitt Algorithm, Sobel Algorithm and Laplace Algorithm. The later part of the project includes the comparison of the edges with their smoothened binary images using the help phase correlation method. The phase correlation method involves the application of fast Fourier transform which one is an external imported Library. The project is implemented using the open source library of opencv with the Microsoft visual studios 2008.the opencv libraries are linked with the visual studios for the requirement .opencv is the collection of methods required for the implementation of image processing techniques developed in c compiling language

2.Introduction
There are many edge detection techniques available .but for the computation of edges we require an efficient method for the further computation and analysis. the edge detection methods can be user further to recognize the number plate from the car plate image, for face recognition ,for authentication of biometric system using image processing For these application we require an efficient edge detection technique. in this application we try to develop an efficient edge detection technique which can be considered for further usage

3.State of art

We applied Sobel operator and have results results from Pewitt operator. Results after Robert operator was applied to the original images

comparison between the ground truth and the threshold image for each frame of the sequence were based on the following values.

Alphanet Numberplate detected Number plate not detected tp fn

number tn fp

From these four quantities the following measures were used. The sensitivity (Se) and specificity (Sp) of the segmentation are then defined as se=tp/(tp+tn) sp=fn/(fn+fp) the image with highest se and sp values are considered as the best method of edge detection.

4.Implementation

4.1Edge detection This module implements several methods of edge detection in digital images, including: 1. 1st order derivatives: Roberts, Prewitt and Sobel . 2. Model fitting: Canny Algorithm. 3. 2nd order derivatives: Laplacian of Gaussian (LoG). the digital images obtained are then applied for phase correlation techniques

4.2Phase correlation

4.2.1 Main Code

To obtain the Phase Correlation of two images, perform these steps:


1. Load two images, f and g. 2. Perform FFT on each image, resulting in F and G 3. Obtain the cross power spectrum using this formula:

where

is the complex conjugate of G.

4. Obtain the phase correlation by performing IFFT on R

The main code performs a very simple task. It loads the reference and template images, call phase_correlation () function and display the result. First, load the template and the reference image. Since Phase Correlation computes 2 equal images, the width and the height of both images need to be checked.

1. /* load reference and template image */ 2. IplImage *ref = cvLoadImage( argv[1], CV_LOAD_IMAGE_GRAYSCALE ); 3. IplImage *tpl = cvLoadImage( argv[2], CV_LOAD_IMAGE_GRAYSCALE ); 4. 5. /* both images' size should be equal */ 6. if( ( tpl->width != ref->width ) || ( tpl->height != ref->height ) ) { fprintf( stderr, "Both images must have equal width and 7. height!\n" ); return 1; 8. 9. }

Next create a new image, poc, for the Phase Correlation result. Then call phase_correlation()function with tpl, ref and poc passed as parameters.
11. /* create a new image, to store phase correlation result */ IplImage *poc = cvCreateImage( cvSize( tpl->width, tpl->height ),

12. 13.
14.

IPL_DEPTH_64F, 1 );

15. /* get phase correlation of input images */ phase_correlation( ref, tpl, poc );

16.
17.

Now that poc contains the result from Phase Correlation, find its maximum value and the location using cvMinMaxLoc. The result then displayed in the command line.

18. /* find the maximum value and its location */ 19. CvPoint minloc, maxloc;

20. double minval, maxval; 21. cvMinMaxLoc( poc, &minval,


22. 23. /* print it */ 24. fprintf( stdout,

&maxval, &minloc, &maxloc, 0 );

25.
26.

"Maxval at (%d, %d) = %2.4f\n", maxloc.x, maxloc.y, maxval );

The last step, display the images and free memory.


27. /* display images and free memory */ 28. cvNamedWindow( "tpl", CV_WINDOW_AUTOSIZE );

29. cvNamedWindow( "ref", CV_WINDOW_AUTOSIZE 30. cvShowImage( "tpl", tpl ); 31. cvShowImage( "ref", ref );
32.

);

33. cvWaitKey(
34.

0 );

35. cvDestroyWindow( "tpl" ); 36. cvDestroyWindow( "ref" ); 37. cvReleaseImage( &tpl ); 38. cvReleaseImage( &ref ); 39. cvReleaseImage( &poc );

In the next section I will explain the phase_correlation() function, line by line. 4.2.2Phase Correlation This function performs Phase Correlation operation. It takes 3 parameters: 1. IplImage *ref: The reference image 2. IplImage *tpl: The template image 3. IplImage *poc: Empty image to store the result To obtain the DFT of the images, I use the FFTW library rather than OpenCV's DFT functions. This will increase the speed since FFTW computes FFT very fast. First get the width and the height of the image. These properties are needed for the rest of the function. Also setup the pointers to copy the images to FFTW input and vice versa.
1.
2. void phase_correlation( IplImage *ref, IplImage *tpl, IplImage *poc ) { int double i, j, k; tmp;

3. 4.
5.

6. 7.

/* get image properties */ int width = ref->width;

8. 9. 10.
11.

int height int step

= ref->height; = ref->widthStep;

int fft_size = width * height;

12. 13. 14. 15.


16.

/* setup pointers to images */ uchar uchar double *ref_data = ( uchar* ) ref->imageData; *tpl_data = ( uchar* ) tpl->imageData; *poc_data = ( double* )poc->imageData;

the function above assumes that the three images have equal width and height. Next initialize some FFTW input/output arrays and plans, load the reference image to img1 and the template image to img2.
17. /* allocate FFTW input and output arrays */

18.
fftw_complex *img1 = ( fftw_complex* )fftw_malloc( sizeof( fftw_complex ) * width * height );

19.
fftw_complex *img2 = ( fftw_complex* )fftw_malloc( sizeof( fftw_complex ) * width * height );

20.
21.

fftw_complex *res = ( fftw_complex* )fftw_malloc( sizeof( fftw_complex ) * width * height );

22. 23.

/* setup FFTW plans */ fftw_plan FFTW_ESTIMATE ); FFTW_ESTIMATE );

fft_img1 = fftw_plan_dft_1d( width * height, img1, img1, FFTW_FORWARD, fftw_plan 24.

25.
26.

fft_img2 = fftw_plan_dft_1d( width * height, img2, img2, FFTW_FORWARD, fftw_plan ifft_res = fftw_plan_dft_1d( width * height, res, res,

FFTW_BACKWARD, FFTW_ESTIMATE );

27. 28. 29. 30. 31.


32.

/* load images' data to FFTW input */ for( i = 0, k = 0 ; i < height ; i++ ) { for( j = 0 ; j < width ; j++, k++ ) { img1[k][0] = ( double )ref_data[i * step + j]; img1[k][1] = 0.0; img2[k][0] = ( double )tpl_data[i * step + j]; img2[k][1] = 0.0; } }

33. 34. 35. 36.


37.

In the listing above res will hold the end result of the phase correlation operation. Next is the heart of this function. It performs Phase Correlation and store the result to poc.
38.
/* obtain the FFT of img1 */

39.
40.

fftw_execute( fft_img1 ); /* obtain the FFT of img2 */ fftw_execute( fft_img2 ); /* obtain the cross power spectrum */ for( i = 0; i < fft_size ; i++ ) { res[i][0] = ( img2[i][0] * img1[i][0] ) - ( img2[i][1] * ( -img1[i][1] ) ); res[i][1] = ( img2[i][0] * ( -img1[i][1] ) ) + ( img2[i][1] * img1[i][0] );
/* obtain the FFT of img1 */ fftw_execute( fft_img1 );

41. 42.
43.

44. 45. 46. 47.


48.

49. 50.
51.

52. 53.
54.

/* obtain the FFT of img2 */ fftw_execute( fft_img2 );

55. 56. 57. 58.


59.

/* obtain the cross power spectrum */ for( i = 0; i < fft_size ; i++ ) { res[i][0] = ( img2[i][0] * img1[i][0] ) - ( img2[i][1] * ( -img1[i][1] ) ); res[i][1] = ( img2[i][0] * ( -img1[i][1] ) ) + ( img2[i][1] * img1[i][0] );

60.
61.

tmp = sqrt( pow( res[i][0], 2.0 ) + pow( res[i][1], 2.0 ) );

62. 63. 64.


65.

res[i][0] /= tmp; res[i][1] /= tmp; }

66. 67.
68.

/* obtain the phase correlation array */ fftw_execute(ifft_res);

69. 70. 71. 72.


73.

/* normalize and copy to result image */ for( i = 0 ; i < fft_size ; i++ ) { poc_data[i] = res[i][0] / ( double )fft_size; }

Now all we have to do is just free memory and return to main function.
63. 64. 65. 66. 67. 68. 69.
70. } /* deallocate FFTW arrays and plans */ fftw_destroy_plan( fft_img1 ); fftw_destroy_plan( fft_img2 ); fftw_destroy_plan( ifft_res ); fftw_free( img1 ); fftw_free( img2 ); fftw_free( res );

The Phase Correlation result is stored in poc. The main code should find the maximum value and its location from this result.

5 Result
5.1Stage 1 :edge detection results Binary image

Cannay

Sobel

Robert

Laplace

5.2Phase correlations Following are the phase correlation values of each technique s.no 1 2 3 4 Edge detection method Cannay Sobel Robort Laplace Correlation Displacement Value Value(x,y) 0.0291 (6,12) 0.0197 0.0201 0.0309 (5,16) (3,29) (16,522)

6.Conclusion The earlier research states that the method with highest correlation value is expected to have lowest noise in it .the method also calculate the displacements of the image pixel from the original pixel values Comparing the result stated above we should consider the method that have a relatively highest correlation value and low displacement values. Observing the above values Cannay is the best edge detection technique.

Bibliography
Books Learning OpenCV--New from O'Reilly: Computer Vision with the OpenCV Library IEEE papers Retinal Vessel Centerline Extraction Using Multiscale Matched Filters, Confidence and Edge Measures Web references www.google.com www.nasharuddin.com www.ieee.orq www.wikipedia.com www.hackchina.com www.willowegaradge.com www.stackoverflow.com www.sourceforge.com

Вам также может понравиться