Table of Contents

Class IntelligentScissorsMB

Namespace
Emgu.CV
Assembly
Emgu.CV.dll

This class is used to find the path (contour) between two points which can be used for image segmentation.

public class IntelligentScissorsMB : UnmanagedObject, IDisposable
Inheritance
IntelligentScissorsMB
Implements
Inherited Members

Constructors

IntelligentScissorsMB()

Create a new Intelligent Scissors for image segmentation.

public IntelligentScissorsMB()

Methods

ApplyImage(IInputArray)

Specify input image and extract image features.

public void ApplyImage(IInputArray image)

Parameters

image IInputArray

The image used for segmentation

ApplyImageFeatures(IInputArray, IInputArray, IInputArray, IInputArray)

Specify custom features of input image.

public void ApplyImageFeatures(IInputArray nonEdge, IInputArray gradientDirection, IInputArray gradientMagnitude, IInputArray image = null)

Parameters

nonEdge IInputArray

Specify cost of non-edge pixels. Type is CV_8UC1. Expected values are {0, 1}.

gradientDirection IInputArray

Specify gradient direction feature. Type is CV_32FC2. Values are expected to be normalized: x^2 + y^2 == 1

gradientMagnitude IInputArray

Specify cost of gradient magnitude function: Type is CV_32FC1. Values should be in range [0, 1].

image IInputArray

Optional parameter. Must be specified if subset of features is specified (non-specified features are calculated internally)

BuildMap(Point)

Prepares a map of optimal paths for the given source point on the image.

public void BuildMap(Point sourcePt)

Parameters

sourcePt Point

The source point used to find the paths

DisposeObject()

Release unmanaged resources

protected override void DisposeObject()

GetContour(Point, IOutputArray, bool)

Extracts optimal contour for the given target point on the image

public void GetContour(Point targetPt, IOutputArray contour, bool backward = false)

Parameters

targetPt Point

The target point

contour IOutputArray

The list of pixels which contains optimal path between the source and the target points of the image. Type is CV_32SC2 (compatible with VectorOfPoint)

backward bool

Flag to indicate reverse order of retrieved pixels (use "true" value to fetch points from the target to the source point)

Remarks

BuildMap() must be called before this call

SetEdgeFeatureCannyParameters(double, double, int, bool)

Switch edge feature extractor to use Canny edge detector.

public void SetEdgeFeatureCannyParameters(double threshold1, double threshold2, int apertureSize = 3, bool L2gradient = false)

Parameters

threshold1 double

First threshold for the hysteresis procedure.

threshold2 double

Second threshold for the hysteresis procedure.

apertureSize int

Aperture size for the Sobel operator.

L2gradient bool

a flag, indicating whether a more accurate L2 norm should be used to calculate the image gradient magnitude ( L2gradient=true ), or whether the default L1 norm is enough ( L2gradient=false ).

Remarks

"Laplacian Zero-Crossing" feature extractor is used by default (following to original article)

SetEdgeFeatureZeroCrossingParameters(float)

Switch to Laplacian Zero-Crossing edge feature extractor and specify its parameters. This feature extractor is used by default according to article. Implementation has additional filtering for regions with low-amplitude noise. This filtering is enabled through parameter of minimal gradient amplitude (use some small value 4, 8, 16).

public void SetEdgeFeatureZeroCrossingParameters(float value)

Parameters

value float

The value

SetGradientMagnitudeMaxLimit(float)

Specify gradient magnitude max value threshold. Zero limit value is used to disable gradient magnitude thresholding (default behavior, as described in original article). Otherwize pixels with gradient magnitude greater than threshold have zero cost.

public void SetGradientMagnitudeMaxLimit(float value)

Parameters

value float

The value

SetWeights(float, float, float)

Specify weights of feature functions. Consider keeping weights normalized (sum of weights equals to 1.0) Discrete dynamic programming (DP) goal is minimization of costs between pixels.

public void SetWeights(float weightNonEdge, float weightGradientDirection, float weightGradientMagnitude)

Parameters

weightNonEdge float

Specify cost of non-edge pixels (default: 0.43f)

weightGradientDirection float

Specify cost of gradient direction function (default: 0.43f)

weightGradientMagnitude float

Specify cost of gradient magnitude function (default: 0.14f)