Documentation Batch 9

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 N.PRABHUKIRAN (Y08IT095) (Y08IT083) N.MURALI T.RAJARAO (Y08IT086) (Y08IT115) Under the Estimated Guidance Of Mr.RADHE SYAM .V DEPARTMENT OF INFORMATION TECHNOLOGY V.R.SIDDHARTHA ENGINEERING COLLEGE (AUTONOMOUS) VIJAYAWADA-520007 MARCH-2011

Transcript of Documentation Batch 9

8/4/2019 Documentation Batch 9

http://slidepdf.com/reader/full/documentation-batch-9 1/14

COMPARASION OF EDGE DETECTION TECHNIQUES ON

NUMBER PLATE RECOGNITION OF VEHICLE IMAGEA 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 N.PRABHUKIRAN

(Y08IT095) (Y08IT083)

N.MURALI T.RAJARAO

(Y08IT086) (Y08IT115)

Under the Estimated Guidance Of 

Mr.RADHE SYAM .V

DEPARTMENT OF INFORMATION TECHNOLOGY

V.R.SIDDHARTHA ENGINEERING COLLEGE

(AUTONOMOUS)

VIJAYAWADA-520007

MARCH-2011

8/4/2019 Documentation Batch 9

http://slidepdf.com/reader/full/documentation-batch-9 2/14

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 IMAGE”is being

submitted by“P.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 Mr.RADHE SYAM.V Dr.A.KOTESWARAO

INCHARGE MINIPROJECTS PROJECT GUIDE HEAD OF THE DEPARTMENT

DATE: DATE: DATE:

 

8/4/2019 Documentation Batch 9

http://slidepdf.com/reader/full/documentation-batch-9 3/14

 

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.

8/4/2019 Documentation Batch 9

http://slidepdf.com/reader/full/documentation-batch-9 4/14

Table of Contents page no

1. Abstract 1

2. Introduction 1

3. State Of Art Proposed 2

4. Proposed method & Implementation 2

4.1 edge detection 2

4.2 phase correlation 3

4.2.1 main method 3

4.2.2 phase correlation function 4

5. Result

5.1 edge detection outputs 7

5.2 phase correlation values 9

6. Conclusion 10

7. Bibliography 11

8/4/2019 Documentation Batch 9

http://slidepdf.com/reader/full/documentation-batch-9 5/14

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, SobelAlgorithm 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 

8/4/2019 Documentation Batch 9

http://slidepdf.com/reader/full/documentation-batch-9 6/14

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 number 

Numberplate detected tp tn

  Number plate not detected fn 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

8/4/2019 Documentation Batch 9

http://slidepdf.com/reader/full/documentation-batch-9 7/14

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 ) ) {

7. fprintf( stderr, "Both images must have equal width and

height!\n" );

8.   return 1;

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 */12.

IplImage *poc = cvCreateImage( cvSize( tpl->width, tpl->height ),

13.IPL_DEPTH_64F, 1 );

14.

15. /* get phase correlation of input images */

16.phase_correlation( ref, tpl, poc );

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.

8/4/2019 Documentation Batch 9

http://slidepdf.com/reader/full/documentation-batch-9 8/14

18. /* find the maximum value and its location */

19.CvPoint minloc, maxloc;

20.double minval, maxval;

21.cvMinMaxLoc( poc, &minval, &maxval, &minloc, &maxloc, 0 );

22.

23. /* print it */

24.fprintf( stdout,

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

26.

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( 0 );

34.

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 thefunction. Also setup the pointers to copy the images to FFTW input and vice versa.

1.void phase_correlation( IplImage *ref, IplImage *tpl, IplImage *poc )

2. {

3.  int i, j, k;

4.  double tmp;

5.

6.  /* get image properties */

7.  int width = ref->width;

8/4/2019 Documentation Batch 9

http://slidepdf.com/reader/full/documentation-batch-9 9/14

8.  int height = ref->height;

9.  int step = ref->widthStep;

10.  int fft_size = width * height;

11.

12.  /* setup pointers to images */

13.uchar *ref_data = ( uchar* ) ref->imageData;

14.uchar *tpl_data = ( uchar* ) tpl->imageData;

15.  double  *poc_data = ( double* )poc->imageData;

16.

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. fftw_complex *res

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

21.

22.  /* setup FFTW plans */

23. fftw_plan

fft_img1 = fftw_plan_dft_1d( width * height, img1, img1, FFTW_FORWARD, FFTW_ESTIMATE );

24. fftw_plan

fft_img2 = fftw_plan_dft_1d( width * height, img2, img2, FFTW_FORWARD, FFTW_ESTIMATE );

25. fftw_plan

ifft_res = fftw_plan_dft_1d( width * height, res, res, FFTW_BACKWARD, FFTW_ESTIMATE );

26.

27.  /* load images' data to FFTW input */

28.  for( i = 0, k = 0 ; i < height ; i++ ) {

29.  for( j = 0 ; j < width ; j++, k++ ) {

30. img1[k][0] = ( double )ref_data[i * step + j];

31. img1[k][1] = 0.0;

32.

33. img2[k][0] = ( double )tpl_data[i * step + j];

34. img2[k][1] = 0.0;

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 */

8/4/2019 Documentation Batch 9

http://slidepdf.com/reader/full/documentation-batch-9 10/14

39. fftw_execute( fft_img1 );

40.

41.  /* obtain the FFT of img2 */

42. fftw_execute( fft_img2 );

43.

44.  /* obtain the cross power spectrum */

45.  for( i = 0; i < fft_size ; i++ ) {

46. res[i][0] = ( img2[i][0] * img1[i][0] ) - ( img2[i][1] * ( -img1[i][1] ) );

47. res[i][1] = ( img2[i][0] * ( -img1[i][1] ) ) + ( img2[i][1] * img1[i][0] );

48.

49.  /* obtain the FFT of img1 */

50.fftw_execute( fft_img1 );

51.

52.  /* obtain the FFT of img2 */

53.fftw_execute( fft_img2 );

54.

55.  /* obtain the cross power spectrum */

56.  for( i = 0; i < fft_size ; i++ ) {

57.res[i][0] = ( img2[i][0] * img1[i][0] ) - ( img2[i][1] * ( -img1[i][1] ) );

58.res[i][1] = ( img2[i][0] * ( -img1[i][1] ) ) + ( img2[i][1] * img1[i][0] );

59.

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

61.

62.res[i][0] /= tmp;

63.res[i][1] /= tmp;

64.  }

65.

66.  /* obtain the phase correlation array */

67.fftw_execute(ifft_res);

68.

69.  /* normalize and copy to result image */

70.  for( i = 0 ; i < fft_size ; i++ ) {

71.poc_data[i] = res[i][0] / ( double )fft_size;

72.  }

73.

 Now all we have to do is just free memory and return to main function.

63.  /* deallocate FFTW arrays and plans */

64.fftw_destroy_plan( fft_img1 );

65. fftw_destroy_plan( fft_img2 );

66.fftw_destroy_plan( ifft_res );

67.fftw_free( img1 );

68.fftw_free( img2 );

69.fftw_free( res );

70. }

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

its location from this result.

8/4/2019 Documentation Batch 9

http://slidepdf.com/reader/full/documentation-batch-9 11/14

5 Result

5.1Stage 1 :edge detection results

Binary image

Cannay

Sobel

8/4/2019 Documentation Batch 9

http://slidepdf.com/reader/full/documentation-batch-9 12/14

Robert

Laplace

8/4/2019 Documentation Batch 9

http://slidepdf.com/reader/full/documentation-batch-9 13/14

5.2Phase correlations

Following are the phase correlation values of each technique

s.no Edge detection method Correlation

Value

Displacement

Value(x,y)

1 Cannay 0.0291 (6,12)

2 Sobel 0.0197 (5,16)

3 Robort 0.0201 (3,29)

4 Laplace 0.0309 (16,522)

 

8/4/2019 Documentation Batch 9

http://slidepdf.com/reader/full/documentation-batch-9 14/14

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 arelatively 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