سؤال

In my number plate recognition application(UK number plates) I have done a rectangle detection and I am using several criterion such as width/length ratio of the number plate as well as a minimum width and length of a number plate. I have managed to reduce the non-number plate areas significantly. My last criterion would be to get the number of connected components for each candidate region so that I can verify the true number plate region of the vehicle image which I read this on a research paper.

I am using C# and Aforge.Net library. But how can I use ConnectedComponentsLabeling to obtain the number of connected Components in the number plate?

هل كانت مفيدة؟

المحلول

I'm doing this:

FiltersSequence preOcr = new FiltersSequence(
    Grayscale.CommonAlgorithms.BT709, 
    new BradleyLocalThresholding());

Bitmap grayscale = preOcr.Apply(original);
var labels = new ConnectedComponentsLabeling();
labels.Apply(new Invert().Apply(grayscale));

//Console.WriteLine(labels.ObjectCount);    // Here you go
foreach (var candidate in labels.BlobCounter.GetObjectsInformation())
{
    using (Bitmap symbol = new Bitmap(candidate.Rectangle.Width, 
                                      candidate.Rectangle.Height))
    using (Graphics g2 = Graphics.FromImage(symbol))
    {
        g2.DrawImage(grayscale, 0, 0, candidate.Rectangle, GraphicsUnit.Pixel);
        symbol.Save(String.Format(@"temp\{0}-{1}.jpg",i,++n), ImageFormat.Jpeg);
        // do stuff
    }
}

نصائح أخرى

When you have found the blob corresponding to number plate, then use this blob Image as the input to another instance of blob counter. The result would tell you the number of components within this blob Image.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top