Friday 26 June 2015

Detecting Binary (White/Black) Pixels

Hi,
This tutorial will teach, how to identify binary pixels and quantify them in an image.
Selecting Aforge.Imaging dll from Aforge Framework. The desired dll could be obtained from path highlighted in green, as comes with installation of Afroge Framework.

1

Afroge.Imaging namespace added in references.

2

Aforge.Imaging namespace added in code.

3

The code for White image with black text is as below:

4

ImageStatistics class object just required the bitmap to calculate the specified pixels in image. In our case, we are only calculating total pixel and white pixels in whole image.
The code against the Black image with white text is same as above.

5

The output of this program is shown as follow:

6

Total, black and white pixels in each case (White image with black text & Black image with white text) are shown correctly as confirmed through displayed image.
The complete code can be accessed through this link. 

No comments:

Post a Comment