Click or drag to resize
Ranorex

ImagingProcessingPreprocess Method (Bitmap, Boolean, Boolean, Boolean, Double, Double)

Preprocesses the specified image by converting it to a grayscale image, detecting object edges, thresholding, and/or resizing/scaling it.

Namespace:  Ranorex
Assembly:  Ranorex.Core (in Ranorex.Core.dll) Version: 12.7.4-git.38314c06
Syntax
public static Bitmap Preprocess(
	Bitmap image,
	bool grayscale,
	bool edges,
	bool threshold,
	double scaleWidth,
	double scaleHeight
)

Parameters

image
Type: System.DrawingBitmap
An image.
grayscale
Type: SystemBoolean
If true and image is not already a grayscale image, converts the image to a grayscale image (see ConvertRgbToGrayscaleImage(Bitmap)).
edges
Type: SystemBoolean
If true, tries to detect object edges in the image (see DetectEdges(Bitmap)).
threshold
Type: SystemBoolean
If true, a threshold (128) is applied to the image (see Threshold(Bitmap, Byte)).
scaleWidth
Type: SystemDouble
If not equal to 1.0, the width of the image will be scaled using the specified factor (see Resize(Bitmap, Double, Double)).
scaleHeight
Type: SystemDouble
If not equal to 1.0, the height of the image will be scaled using the specified factor (see Resize(Bitmap, Double, Double)).

Return Value

Type: Bitmap
The preprocessed image.
Exceptions
ExceptionCondition
ArgumentNullExceptionIf image is null.
ArgumentExceptionIf the input image is not a grayscale image, needs to be converted to such, and cannot be converted to Format24bppRgb pixel format (i.e. if it is no color image in a 32 bit format).
See Also