ImageMan.Net Version 3 Summer 2012 Release
GetMonochromeBlackPixelCount(ImImage,Rectangle) Method
See Also  Example Send Feedback
DTI.ImageMan Namespace > Analyze Class > GetMonochromeBlackPixelCount Method : GetMonochromeBlackPixelCount(ImImage,Rectangle) Method





img
ImImage to Process
area
Area of the Image to Process

Glossary Item Box

Get The Total Monochrome Black Pixel Count for the area passed in.

Syntax

Visual Basic (Declaration) 
Public Overloads Shared Function GetMonochromeBlackPixelCount( _
   ByVal img As ImImage, _
   ByVal area As System.Drawing.Rectangle _
) As System.Integer
Visual Basic (Usage)Copy Code
Dim img As ImImage
Dim area As System.Drawing.Rectangle
Dim value As System.Integer
 
value = Analyze.GetMonochromeBlackPixelCount(img, area)
C# 
public static System.int GetMonochromeBlackPixelCount( 
   ImImage img,
   System.Drawing.Rectangle area
)
JScript 
public static function GetMonochromeBlackPixelCount( 
   img : ImImage,
   area : System.Drawing.Rectangle
) : System.int;
Managed Extensions for C++ 
public: static System.int GetMonochromeBlackPixelCount( 
   ImImage* img,
   System.Drawing.Rectangle area
) 
C++/CLI 
public:
static System.int GetMonochromeBlackPixelCount( 
   ImImage^ img,
   System.Drawing.Rectangle area
) 

Parameters

img
ImImage to Process
area
Area of the Image to Process

Return Value

longpixel count for image area passed in.

Remarks

This function returns a total count of all the black pixels in the image area passed in.

The following managed cpp code calculates the ratio of black pixels to white pixels in a value between 0 and 1.0:
int pixels = GetMonochromeBlackPixelCount(img, System::Drawing::Rectangle(0, 0, img->Width, img->Height));
float pixelRatio = (float)pixels / (float)(img->Width * img->Height);

Example

The following managed cpp code calculates the ratio of black pixels to white pixels in a value between 0 and 1.0:
C#Copy Code
int pixels = GetMonochromeBlackPixelCount(img, System::Drawing::Rectangle(0, 0, img->Width, img->Height));
float pixelRatio = (float)pixels / (float)(img->Width * img->Height);

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

© 2014 Data Techniques, Inc. All Rights Reserved.