OpenCV for Unity 2.6.5
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/4.10.0/index.html ) for the details of the argument of the method.
Loading...
Searching...
No Matches
OpenCVForUnity.ImgprocModule.IntelligentScissorsMB Class Reference

Intelligent Scissors image segmentation. More...

Public Member Functions

 IntelligentScissorsMB ()
 
IntelligentScissorsMB applyImage (Mat image)
 Specify input image and extract image features.
 
IntelligentScissorsMB applyImageFeatures (Mat non_edge, Mat gradient_direction, Mat gradient_magnitude)
 Specify custom features of input image.
 
IntelligentScissorsMB applyImageFeatures (Mat non_edge, Mat gradient_direction, Mat gradient_magnitude, Mat image)
 Specify custom features of input image.
 
void buildMap (in Vec2d sourcePt)
 Prepares a map of optimal paths for the given source point on the image.
 
void buildMap (in(double x, double y) sourcePt)
 Prepares a map of optimal paths for the given source point on the image.
 
void buildMap (Point sourcePt)
 Prepares a map of optimal paths for the given source point on the image.
 
void getContour (in Vec2d targetPt, Mat contour)
 Extracts optimal contour for the given target point on the image.
 
void getContour (in Vec2d targetPt, Mat contour, bool backward)
 Extracts optimal contour for the given target point on the image.
 
void getContour (in(double x, double y) targetPt, Mat contour)
 Extracts optimal contour for the given target point on the image.
 
void getContour (in(double x, double y) targetPt, Mat contour, bool backward)
 Extracts optimal contour for the given target point on the image.
 
void getContour (Point targetPt, Mat contour)
 Extracts optimal contour for the given target point on the image.
 
void getContour (Point targetPt, Mat contour, bool backward)
 Extracts optimal contour for the given target point on the image.
 
IntPtr getNativeObjAddr ()
 
IntelligentScissorsMB setEdgeFeatureCannyParameters (double threshold1, double threshold2)
 Switch edge feature extractor to use Canny edge detector.
 
IntelligentScissorsMB setEdgeFeatureCannyParameters (double threshold1, double threshold2, int apertureSize)
 Switch edge feature extractor to use Canny edge detector.
 
IntelligentScissorsMB setEdgeFeatureCannyParameters (double threshold1, double threshold2, int apertureSize, bool L2gradient)
 Switch edge feature extractor to use Canny edge detector.
 
IntelligentScissorsMB setEdgeFeatureZeroCrossingParameters ()
 Switch to "Laplacian Zero-Crossing" edge feature extractor and specify its parameters.
 
IntelligentScissorsMB setEdgeFeatureZeroCrossingParameters (float gradient_magnitude_min_value)
 Switch to "Laplacian Zero-Crossing" edge feature extractor and specify its parameters.
 
IntelligentScissorsMB setGradientMagnitudeMaxLimit ()
 Specify gradient magnitude max value threshold.
 
IntelligentScissorsMB setGradientMagnitudeMaxLimit (float gradient_magnitude_threshold_max)
 Specify gradient magnitude max value threshold.
 
IntelligentScissorsMB setWeights (float weight_non_edge, float weight_gradient_direction, float weight_gradient_magnitude)
 Specify weights of feature functions.
 
- Public Member Functions inherited from OpenCVForUnity.DisposableObject
void Dispose ()
 
void ThrowIfDisposed ()
 

Static Public Member Functions

static IntelligentScissorsMB __fromPtr__ (IntPtr addr)
 
- Static Public Member Functions inherited from OpenCVForUnity.DisposableObject
static IntPtr ThrowIfNullIntPtr (IntPtr ptr)
 

Protected Member Functions

override void Dispose (bool disposing)
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableOpenCVObject
 DisposableOpenCVObject ()
 
 DisposableOpenCVObject (bool isEnabledDispose)
 
 DisposableOpenCVObject (IntPtr ptr)
 
 DisposableOpenCVObject (IntPtr ptr, bool isEnabledDispose)
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableObject
 DisposableObject ()
 
 DisposableObject (bool isEnabledDispose)
 

Additional Inherited Members

- Package Attributes inherited from OpenCVForUnity.DisposableOpenCVObject
- Properties inherited from OpenCVForUnity.DisposableObject
bool IsDisposed [get, protected set]
 
bool IsEnabledDispose [get, set]
 

Detailed Description

Intelligent Scissors image segmentation.

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

Usage example:

Reference: <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.138.3811&amp;rep=rep1&amp;type=pdf">"Intelligent Scissors for Image Composition"</a> algorithm designed by Eric N. Mortensen and William A. Barrett, Brigham Young University [Mortensen95intelligentscissors]

Constructor & Destructor Documentation

◆ IntelligentScissorsMB()

OpenCVForUnity.ImgprocModule.IntelligentScissorsMB.IntelligentScissorsMB ( )

Member Function Documentation

◆ __fromPtr__()

static IntelligentScissorsMB OpenCVForUnity.ImgprocModule.IntelligentScissorsMB.__fromPtr__ ( IntPtr addr)
static

◆ applyImage()

IntelligentScissorsMB OpenCVForUnity.ImgprocModule.IntelligentScissorsMB.applyImage ( Mat image)

Specify input image and extract image features.

Parameters
imageinput image. Type is #CV_8UC1 / #CV_8UC3

◆ applyImageFeatures() [1/2]

IntelligentScissorsMB OpenCVForUnity.ImgprocModule.IntelligentScissorsMB.applyImageFeatures ( Mat non_edge,
Mat gradient_direction,
Mat gradient_magnitude )

Specify custom features of input image.

Customized advanced variant of applyImage() call.

Parameters
non_edgeSpecify cost of non-edge pixels. Type is CV_8UC1. Expected values are {0, 1}.
gradient_directionSpecify gradient direction feature. Type is CV_32FC2. Values are expected to be normalized: x^2 + y^2 == 1
gradient_magnitudeSpecify cost of gradient magnitude function: Type is CV_32FC1. Values should be in range [0, 1].
imageOptional parameter. Must be specified if subset of features is specified (non-specified features are calculated internally)

◆ applyImageFeatures() [2/2]

IntelligentScissorsMB OpenCVForUnity.ImgprocModule.IntelligentScissorsMB.applyImageFeatures ( Mat non_edge,
Mat gradient_direction,
Mat gradient_magnitude,
Mat image )

Specify custom features of input image.

Customized advanced variant of applyImage() call.

Parameters
non_edgeSpecify cost of non-edge pixels. Type is CV_8UC1. Expected values are {0, 1}.
gradient_directionSpecify gradient direction feature. Type is CV_32FC2. Values are expected to be normalized: x^2 + y^2 == 1
gradient_magnitudeSpecify cost of gradient magnitude function: Type is CV_32FC1. Values should be in range [0, 1].
imageOptional parameter. Must be specified if subset of features is specified (non-specified features are calculated internally)

◆ buildMap() [1/3]

void OpenCVForUnity.ImgprocModule.IntelligentScissorsMB.buildMap ( in Vec2d sourcePt)

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

Note
applyImage() / applyImageFeatures() must be called before this call
Parameters
sourcePtThe source point used to find the paths

◆ buildMap() [2/3]

void OpenCVForUnity.ImgprocModule.IntelligentScissorsMB.buildMap ( in(double x, double y) sourcePt)

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

Note
applyImage() / applyImageFeatures() must be called before this call
Parameters
sourcePtThe source point used to find the paths

◆ buildMap() [3/3]

void OpenCVForUnity.ImgprocModule.IntelligentScissorsMB.buildMap ( Point sourcePt)

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

Note
applyImage() / applyImageFeatures() must be called before this call
Parameters
sourcePtThe source point used to find the paths

◆ Dispose()

override void OpenCVForUnity.ImgprocModule.IntelligentScissorsMB.Dispose ( bool disposing)
protectedvirtual

◆ getContour() [1/6]

void OpenCVForUnity.ImgprocModule.IntelligentScissorsMB.getContour ( in Vec2d targetPt,
Mat contour )

Extracts optimal contour for the given target point on the image.

Note
buildMap() must be called before this call
Parameters
targetPtThe target point
backwardFlag to indicate reverse order of retrived pixels (use "true" value to fetch points from the target to the source point)

◆ getContour() [2/6]

void OpenCVForUnity.ImgprocModule.IntelligentScissorsMB.getContour ( in Vec2d targetPt,
Mat contour,
bool backward )

Extracts optimal contour for the given target point on the image.

Note
buildMap() must be called before this call
Parameters
targetPtThe target point
backwardFlag to indicate reverse order of retrived pixels (use "true" value to fetch points from the target to the source point)

◆ getContour() [3/6]

void OpenCVForUnity.ImgprocModule.IntelligentScissorsMB.getContour ( in(double x, double y) targetPt,
Mat contour )

Extracts optimal contour for the given target point on the image.

Note
buildMap() must be called before this call
Parameters
targetPtThe target point
backwardFlag to indicate reverse order of retrived pixels (use "true" value to fetch points from the target to the source point)

◆ getContour() [4/6]

void OpenCVForUnity.ImgprocModule.IntelligentScissorsMB.getContour ( in(double x, double y) targetPt,
Mat contour,
bool backward )

Extracts optimal contour for the given target point on the image.

Note
buildMap() must be called before this call
Parameters
targetPtThe target point
backwardFlag to indicate reverse order of retrived pixels (use "true" value to fetch points from the target to the source point)

◆ getContour() [5/6]

void OpenCVForUnity.ImgprocModule.IntelligentScissorsMB.getContour ( Point targetPt,
Mat contour )

Extracts optimal contour for the given target point on the image.

Note
buildMap() must be called before this call
Parameters
targetPtThe target point
backwardFlag to indicate reverse order of retrived pixels (use "true" value to fetch points from the target to the source point)

◆ getContour() [6/6]

void OpenCVForUnity.ImgprocModule.IntelligentScissorsMB.getContour ( Point targetPt,
Mat contour,
bool backward )

Extracts optimal contour for the given target point on the image.

Note
buildMap() must be called before this call
Parameters
targetPtThe target point
backwardFlag to indicate reverse order of retrived pixels (use "true" value to fetch points from the target to the source point)

◆ getNativeObjAddr()

IntPtr OpenCVForUnity.ImgprocModule.IntelligentScissorsMB.getNativeObjAddr ( )

◆ setEdgeFeatureCannyParameters() [1/3]

IntelligentScissorsMB OpenCVForUnity.ImgprocModule.IntelligentScissorsMB.setEdgeFeatureCannyParameters ( double threshold1,
double threshold2 )

Switch edge feature extractor to use Canny edge detector.

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

◆ setEdgeFeatureCannyParameters() [2/3]

IntelligentScissorsMB OpenCVForUnity.ImgprocModule.IntelligentScissorsMB.setEdgeFeatureCannyParameters ( double threshold1,
double threshold2,
int apertureSize )

Switch edge feature extractor to use Canny edge detector.

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

◆ setEdgeFeatureCannyParameters() [3/3]

IntelligentScissorsMB OpenCVForUnity.ImgprocModule.IntelligentScissorsMB.setEdgeFeatureCannyParameters ( double threshold1,
double threshold2,
int apertureSize,
bool L2gradient )

Switch edge feature extractor to use Canny edge detector.

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

◆ setEdgeFeatureZeroCrossingParameters() [1/2]

IntelligentScissorsMB OpenCVForUnity.ImgprocModule.IntelligentScissorsMB.setEdgeFeatureZeroCrossingParameters ( )

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).

Note
Current implementation of this feature extractor is based on processing of grayscale images (color image is converted to grayscale image first).
Canny edge detector is a bit slower, but provides better results (especially on color images): use setEdgeFeatureCannyParameters().
Parameters
gradient_magnitude_min_valueMinimal gradient magnitude value for edge pixels (default: 0, check is disabled)

◆ setEdgeFeatureZeroCrossingParameters() [2/2]

IntelligentScissorsMB OpenCVForUnity.ImgprocModule.IntelligentScissorsMB.setEdgeFeatureZeroCrossingParameters ( float gradient_magnitude_min_value)

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).

Note
Current implementation of this feature extractor is based on processing of grayscale images (color image is converted to grayscale image first).
Canny edge detector is a bit slower, but provides better results (especially on color images): use setEdgeFeatureCannyParameters().
Parameters
gradient_magnitude_min_valueMinimal gradient magnitude value for edge pixels (default: 0, check is disabled)

◆ setGradientMagnitudeMaxLimit() [1/2]

IntelligentScissorsMB OpenCVForUnity.ImgprocModule.IntelligentScissorsMB.setGradientMagnitudeMaxLimit ( )

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 &gt;= threshold have zero cost.

Note
Thresholding should be used for images with irregular regions (to avoid stuck on parameters from high-contract areas, like embedded logos).
Parameters
gradient_magnitude_threshold_maxSpecify gradient magnitude max value threshold (default: 0, disabled)

◆ setGradientMagnitudeMaxLimit() [2/2]

IntelligentScissorsMB OpenCVForUnity.ImgprocModule.IntelligentScissorsMB.setGradientMagnitudeMaxLimit ( float gradient_magnitude_threshold_max)

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 &gt;= threshold have zero cost.

Note
Thresholding should be used for images with irregular regions (to avoid stuck on parameters from high-contract areas, like embedded logos).
Parameters
gradient_magnitude_threshold_maxSpecify gradient magnitude max value threshold (default: 0, disabled)

◆ setWeights()

IntelligentScissorsMB OpenCVForUnity.ImgprocModule.IntelligentScissorsMB.setWeights ( float weight_non_edge,
float weight_gradient_direction,
float weight_gradient_magnitude )

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.

Parameters
weight_non_edgeSpecify cost of non-edge pixels (default: 0.43f)
weight_gradient_directionSpecify cost of gradient direction function (default: 0.43f)
weight_gradient_magnitudeSpecify cost of gradient magnitude function (default: 0.14f)

The documentation for this class was generated from the following files: