Reputation: 7299
I am trying to develop an LPR system using Aforge.net
,i want to apply a filter on my image as you can see here :
Bitmap a = new Bitmap(@"C:\Users\Public\Pictures\Sample Pictures\1.png");
SobelEdgeDetector filter = new SobelEdgeDetector();
filter.ApplyInPlace(a);
pictureBox1.Image = a;
but after running i got this error:
Source pixel format is not supported by the filter.
I am so new in aforge.net.
Upvotes: 2
Views: 9022
Reputation: 15981
As you can see from this API documentation page, the SobolEdgeDetector
filter only supports 8bpp grayscale images.
To apply the filter, you therefore need to convert your image to 8bpp and grayscale first, for example like this:
Bitmap a = AForge.Imaging.Image.Clone(
new Bitmap(@"C:\Users\Public\Pictures\Sample Pictures\1.png"),
PixelFormat.Format8bppIndexed);
AForge.Imaging.Image.SetGrayscalePalette(a);
Upvotes: 10