0

am trying to apply some pre process functions to the image of cars for my graduation project License plate recognition but i face an issue the picture looks poor

The Orignial image enter image description here

1- Convert to Grayscale.

2- Gaussian Blur with 3x3 or 5x5 filter.

3- Apply Sobel Filter to find vertical edges.

4- Threshold the resultant image to get a binary image.

5- Apply a morphological close operation using suitable structuring element. enter image description here

Question is

How can i optimize the picture to be able to get perfect result in the next steps

private: System::Void btnProcess_Click(System::Object^  sender, System::EventArgs^  e) {

cv::Mat imgOriginalScene;
cv::Mat imgGrayscale;
cv::Mat imgGaussianBlur;
cv::Mat imgCannyEdgeDetection;
cv::Mat imgMorphologyEx;

cv::Mat imgScaled;
cv::Mat imgPlate;
cv::Mat imgAbove;
cv::Mat imgThresh;

if (file_path_temp != nullptr)
{
    IntPtr pointer_temp = Marshal::StringToHGlobalAnsi(file_path_temp);
    const char* input_location = static_cast<const char*>(pointer_temp.ToPointer());
    imgOriginalScene = cv::imread(input_location, CV_LOAD_IMAGE_ANYDEPTH | CV_LOAD_IMAGE_ANYCOLOR);

    Marshal::FreeHGlobal(pointer_temp);


    if (!imgOriginalScene.empty())
    {
        // first step convert the image to the Gray scale image
        cv::cvtColor(imgOriginalScene, imgGrayscale, CV_BGR2GRAY);

        // apply Guassin Blur with 3x3 or 5x5
        cv::GaussianBlur(imgGrayscale, imgGaussianBlur, cv::Size(3,3),0 );
        
        // apply the threshold 
        cv::adaptiveThreshold(imgGaussianBlur, imgThresh, 255.0, CV_ADAPTIVE_THRESH_GAUSSIAN_C, CV_THRESH_BINARY_INV, 19, 9);

        // apply Canny edge detection
        cv::Canny(imgThresh, imgCannyEdgeDetection, 35, 90);

        cv::Mat structuringElement = cv::getStructuringElement(cv::MORPH_ELLIPSE, cv::Size(3, 3));
        cv::morphologyEx(imgCannyEdgeDetection, imgMorphologyEx, cv::MORPH_CLOSE, structuringElement);

        cv::imwrite("temp/temp.bmp", imgMorphologyEx);
        System::Drawing::Graphics^ graphics = PicBoxCar->CreateGraphics();
        System::Drawing::Bitmap^ b = gcnew System::Drawing::Bitmap("temp/temp.bmp");
        System::Drawing::RectangleF rect(0, 0, (float)PicBoxCar->Width, (float)PicBoxCar->Height);
        graphics->DrawImage(b, rect);
        delete b;
    }
}
else {
        MessageBox::Show("Cannot open this image please choose another one !!", "Path:");

}
Community
  • 1
  • 1
messi
  • 1
  • 3
  • why is everyone asking for "best" and "perfect" things here? Don't you think it would be necessary to mention what you acutally want to achieve befor your ask how to make it "perfect"? please read [ask], even if you'd provided any useful information on your actual problem it would still be too broad. why did you pick this appraoch to license plate recognition in the first place? what goal do you have in mind when doing all these preprocessing steps? – Piglet Jan 19 '18 at 11:32
  • @Piglet am try to apply the LPR steps to recognize the arabic characters but i think there are something missing in the 4 steps because the characters not clear well i post my question here cause i dont have experience in this am new and here there are experts .. thanks for comment bro – messi Jan 19 '18 at 12:13
  • your image resolution is too low to expect any useful results given the present noise – Piglet Jan 19 '18 at 12:22
  • what is the minimum resolution and distance to get nice result – messi Jan 19 '18 at 20:28

0 Answers0