verslag.tex 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. \documentclass[a4paper]{article}
  2. \usepackage{hyperref}
  3. \title{Using local binary patterns to read license plates in photographs}
  4. % Paragraph indentation
  5. \setlength{\parindent}{0pt}
  6. \setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
  7. \begin{document}
  8. \maketitle
  9. \section*{Project members}
  10. Gijs van der Voort\\
  11. Richard Torenvliet\\
  12. Jayke Meijer\\
  13. Tadde\"us Kroes\\
  14. Fabi\'en Tesselaar
  15. \tableofcontents
  16. \setcounter{secnumdepth}{1}
  17. \section{Problem description}
  18. License plates are used for uniquely identifying motorized vehicles and are
  19. made to be read by humans from great distances and in all kinds of weather
  20. conditions.
  21. Reading license plates with a computer is much more difficult. Our dataset
  22. contains photographs of license plates from various angles and distances. This
  23. means that not only do we have to implement a method to read the actual
  24. characters, but also have to determine the location of the license plate and
  25. its transformation due to different angles.
  26. We will focus our research on reading the transformed characters on the
  27. license plate, of which we know where the letters are located. This is because
  28. Microsoft recently published a new and effective method to find the location of
  29. text in an image.
  30. Determining what character we are looking at will be done by using Local Binary
  31. Patterns. The main goal of our research is finding out how effective LBPs are in
  32. classifying characters on a licenseplate.
  33. In short our program must be able to do the following:
  34. \begin{enumerate}
  35. \item Use perspective transformation to obtain an upfront view of license
  36. plate.
  37. \item Reduce noise where possible.
  38. \item Extract each character using the location points in the info file.
  39. \item Transform character to a normal form.
  40. \item Create a local binary pattern histogram vector.
  41. \item Match the found vector with a learning set.
  42. \end{enumerate}
  43. \section{Solutions}
  44. Now that the problem is defined, the next step is stating our basic solutions. This will
  45. come in a few steps as well.
  46. \subsection{Transformation}
  47. A simple perspective transformation will be sufficient to transform and resize
  48. the plate to a normalized format. The corner positions of license plates in the
  49. dataset are supplied together with the dataset.
  50. \subsection{Reducing noise}
  51. Small amounts of noise will probably be suppressed by usage of a Gaussian
  52. filter. A real problem occurs in very dirty license plates, where branches and
  53. dirt over a letter could radically change the local binary pattern. A question
  54. we can ask ourselves here, is whether we want to concentrate ourselves on these
  55. exceptional cases. By law, license plates have to be readable. Therefore, we
  56. will first direct our attention at getting a higher score in the 'regular' test
  57. set before addressing these cases. Considered the fact that the LBP algorithm
  58. divides a letter into a lot of cells, there is a good change that a great
  59. number of cells will still match the learning set, and thus still return the
  60. correct character as a best match. Therefore, we expect the algorithm to be
  61. very robust when dealing with noisy images.
  62. \subsection{Extracting a letter}
  63. Because we are already given the locations of the characters, we only need to
  64. transform those locations using the same perspective transformation used to
  65. create a front facing license plate. The next step is to transform the
  66. characters to a normalized manner. The size of the letter W is used as a
  67. standard to normalize the width of all the characters, because W is the widest
  68. character of the alphabet. We plan to also normalize the height of characters,
  69. the best manner for this is still to be determined.
  70. \begin{enumerate}
  71. \item Crop the image in such a way that the character precisely fits the
  72. image.
  73. \item Scale the image to a standard height.
  74. \item Extend the image on either the left or right side to a certain width.
  75. \end{enumerate}
  76. The resulting image will always have the same size, the character contained
  77. will always be of the same height, and the character will alway be positioned
  78. at either the left of right side of the image.
  79. \subsection{Local binary patterns}
  80. Once we have separate digits and characters, we intent to use Local Binary
  81. Patterns to determine what character or digit we are dealing with. Local Binary
  82. Patters are a way to classify a texture based on the distribution of edge
  83. directions in the image. Since letters on a license plate consist mainly of
  84. straight lines and simple curves, LBP should be suited to identify these.
  85. To our knowledge, LBP has yet not been used in this manner before. Therefore,
  86. it will be the first thing to implement, to see if it lives up to the
  87. expectations. When the proof of concept is there, it can be used in the final
  88. program.
  89. Important to note is that due to the normalization of characters before
  90. applying LBP. Therefore, no further normalization is needed on the histograms.
  91. Given the LBP of a character, a Support Vector Machine can be used to classify
  92. the character to a character in a learning set. The SVM uses
  93. \subsection{Matching the database}
  94. Given the LBP of a character, a Support Vector Machine can be used to classify
  95. the character to a character in a learning set. The SVM uses the collection of
  96. histograms of an image as a feature vector. The SVM can be trained with a
  97. subsection of the given dataset called the ''Learning set''. Once trained, the
  98. entire classifier can be saved as a Pickle object\footnote{See
  99. \url{http://docs.python.org/library/pickle.html}} for later usage.
  100. \section{Implementation}
  101. In this section we will describe our implementations in more detail, explaining
  102. choices we made.
  103. \subsection*{Licenseplate retrieval}
  104. In order to retrieve the license plate from the entire image, we need to perform
  105. a perspective transformation. However, to do this, we need to know the
  106. coordinates of the four corners of the licenseplate. For our dataset, this is
  107. stored in XML files. So, the first step is to read these XML files.
  108. \paragraph*{XML reader}
  109. \paragraph*{Perspective transformation}
  110. Once we retrieved the cornerpoints of the licenseplate, we feed those to a
  111. module that extracts the (warped) licenseplate from the original image, and
  112. creates a new image where the licenseplate is cut out, and is transformed to a
  113. rectangle.
  114. \subsection*{Noise reduction}
  115. The image contains a lot of noise, both from camera errors due to dark noise etc.,
  116. as from dirt on the license plate. In this case, noise therefor means any unwanted
  117. difference in color from the surrounding pixels.
  118. \paragraph*{Camera noise and small amounts of dirt}
  119. The dirt on the licenseplate can be of different sizes. We can reduce the smaller
  120. amounts of dirt in the same way as we reduce normal noise, by applying a gaussian
  121. blur to the image. This is the next step in our program.\\
  122. \\
  123. The gaussian filter we use comes from the \texttt{scipy.ndimage} module. We use
  124. this function instead of our own function, because the standard functions are
  125. most likely more optimized then our own implementation, and speed is an important
  126. factor in this application.
  127. \paragraph*{Larger amounts of dirt}
  128. Larger amounts of dirt are not going to be resolved by using a Gaussian filter.
  129. We rely on one of the characteristics of the Local Binary Pattern, only looking at
  130. the difference between two pixels, to take care of these problems.\\
  131. Because there will probably always be a difference between the characters and the
  132. dirt, and the fact that the characters are very black, the shape of the characters
  133. will still be conserved in the LBP, even if there is dirt surrounding the character.
  134. \subsection*{Character retrieval}
  135. The retrieval of the character is done the same as the retrieval of the license
  136. plate, by using a perspective transformation. The location of the characters on the
  137. licenseplate is also available in de XML file, so this is parsed from that as well.
  138. \subsection*{Creating Local Binary Patterns and feature vector}
  139. \subsection*{Classification}
  140. \section{Finding parameters}
  141. Now that we have a functioning system, we need to tune it to work properly for
  142. license plates. This means we need to find the parameters. Throughout the program
  143. we have a number of parameters for which no standard choice is available. These
  144. parameters are:\\
  145. \\
  146. \begin{tabular}{l|l}
  147. Parameter & Description\\
  148. \hline
  149. $\sigma$ & The size of the gaussian blur.\\
  150. \emph{cell size} & The size of a cell for which a histogram of LBPs will be generated.
  151. \end{tabular}
  152. \section{Conclusion}
  153. \end{document}