منوچ طوطی منوچ طوطی - 1 month ago 8
C# Question

how to apply AForge.Imaging.Filters even on a Unsupported Image Format

i use Afroge library version 1 like this

FiltersSequence filters = new AForge.Imaging.Filters.FiltersSequence();
filters.Add(new ColorFiltering(
new AForge.IntRange(0, redValue),
new AForge.IntRange(0, grnValue),
new AForge.IntRange(0, bluValue)));
...
filters.Add(new Threshold());
var image = filters.Apply( new Bitmap(pictureBox.Image));


on its version 1 it works well. but now on version 2.2.5 with the same image process gives me unsupported image format exception.
how to apply filters efficiently.

Answer

i Write a new FilterSequance class, by applying required formate setting. i cast the image format, using

 Grayscale.CommonAlgorithms.BT709.Apply(new Bitmap(image));

and then apply the result to the Threshold filter.