2010. 3. 24.

License Plate Recognition (LPR) System





Implemented a License Plate Recognition (LPR) System for automated garage door opener in C++. When metal detector detects a vehicle approaching to a garage door, the microcontroller sends a signal to the camera to take a snap shot of the vehicle, and the program recognises the license plate from the image, and verifies whether the vehicle is registered or not. The system uses OpenCV (Open Source Computer Vision) Library for image processing. The following code is written to reduce noise, when the system is trying to locate the license plate from the image. An 8 x 8 mask will move from upper-left corner to bottom-right corner linearly, and sum up the values within the mask. If the sum is less than threshold value, the system will assume the area is a noise and removes it from the image.



int noiseFilter(IplImage* inputImage) {
  int i, j, x, y;
       double sum;
   int height = inputImage->height;
  int width = inputImage->width;
  int size = 8;
  for (j = 0; j < height - size; j++) {
for (i = 0; i < width - size; i++ ) {
  sum = 0;
  for (x = 0; x < size; x++) {
  sum += cvGet2D(inputImage, j + 0, i + x ).val[0];
                              sum += cvGet2D(inputImage, j + size -1, i + x).val[0];
                      }
  for (y = 0; y < size; y++) {
  sum += cvGet2D(inputImage, j + y, i + 0 ).val[0];
  sum += cvGet2D(inputImage, j + y, i + size - 1).val[0];
                       }
  if(sum <= 0) {
  for (y = j; y < j + size; y++) {
  for (x = i; x < i + size; x++) {
                  cvSet2D(inputImage, y, x, cvScalar(0,0,0,0));
  }
}
}
}
}
   return 0;
}

댓글 없음: