EstervQrCode 1.1.1
Library for qr code manipulation
Public Member Functions | Protected Attributes | List of all members
cv::segmentation::IntelligentScissorsMB Class Reference

Intelligent Scissors image segmentation. More...

#include <segmentation.hpp>

Public Member Functions

CV_WRAP IntelligentScissorsMB ()
 
CV_WRAP IntelligentScissorsMBsetWeights (float weight_non_edge, float weight_gradient_direction, float weight_gradient_magnitude)
 Specify weights of feature functions. More...
 
CV_WRAP IntelligentScissorsMBsetGradientMagnitudeMaxLimit (float gradient_magnitude_threshold_max=0.0f)
 Specify gradient magnitude max value threshold. More...
 
CV_WRAP IntelligentScissorsMBsetEdgeFeatureZeroCrossingParameters (float gradient_magnitude_min_value=0.0f)
 Switch to "Laplacian Zero-Crossing" edge feature extractor and specify its parameters. More...
 
CV_WRAP IntelligentScissorsMBsetEdgeFeatureCannyParameters (double threshold1, double threshold2, int apertureSize=3, bool L2gradient=false)
 Switch edge feature extractor to use Canny edge detector. More...
 
CV_WRAP IntelligentScissorsMBapplyImage (InputArray image)
 Specify input image and extract image features. More...
 
CV_WRAP IntelligentScissorsMBapplyImageFeatures (InputArray non_edge, InputArray gradient_direction, InputArray gradient_magnitude, InputArray image=noArray())
 Specify custom features of input image. More...
 
CV_WRAP void buildMap (const Point &sourcePt)
 Prepares a map of optimal paths for the given source point on the image. More...
 
CV_WRAP void getContour (const Point &targetPt, OutputArray contour, bool backward=false) const
 Extracts optimal contour for the given target point on the image. More...
 
Impl * getImpl () const
 

Protected Attributes

std::shared_ptr< Impl > impl
 

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: "Intelligent Scissors for Image Composition" algorithm designed by Eric N. Mortensen and William A. Barrett, Brigham Young University [Mortensen95intelligentscissors]

Constructor & Destructor Documentation

◆ IntelligentScissorsMB()

CV_WRAP cv::segmentation::IntelligentScissorsMB::IntelligentScissorsMB ( )

Member Function Documentation

◆ applyImage()

CV_WRAP IntelligentScissorsMB& cv::segmentation::IntelligentScissorsMB::applyImage ( InputArray  image)

Specify input image and extract image features.

Parameters
imageinput image. Type is CV_8UC1 / CV_8UC3

◆ applyImageFeatures()

CV_WRAP IntelligentScissorsMB& cv::segmentation::IntelligentScissorsMB::applyImageFeatures ( InputArray  non_edge,
InputArray  gradient_direction,
InputArray  gradient_magnitude,
InputArray  image = noArray() 
)

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

CV_WRAP void cv::segmentation::IntelligentScissorsMB::buildMap ( const 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

◆ getContour()

CV_WRAP void cv::segmentation::IntelligentScissorsMB::getContour ( const Point targetPt,
OutputArray  contour,
bool  backward = false 
) const

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

Note
buildMap() must be called before this call
Parameters
targetPtThe target point
[out]contourThe list of pixels which contains optimal path between the source and the target points of the image. Type is CV_32SC2 (compatible with std::vector<Point>)
backwardFlag to indicate reverse order of retrived pixels (use "true" value to fetch points from the target to the source point)

◆ getImpl()

Impl* cv::segmentation::IntelligentScissorsMB::getImpl ( ) const
inline

◆ setEdgeFeatureCannyParameters()

CV_WRAP IntelligentScissorsMB& cv::segmentation::IntelligentScissorsMB::setEdgeFeatureCannyParameters ( double  threshold1,
double  threshold2,
int  apertureSize = 3,
bool  L2gradient = false 
)

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

CV_WRAP IntelligentScissorsMB& cv::segmentation::IntelligentScissorsMB::setEdgeFeatureZeroCrossingParameters ( float  gradient_magnitude_min_value = 0.0f)

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

CV_WRAP IntelligentScissorsMB& cv::segmentation::IntelligentScissorsMB::setGradientMagnitudeMaxLimit ( float  gradient_magnitude_threshold_max = 0.0f)

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 >= 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()

CV_WRAP IntelligentScissorsMB& cv::segmentation::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)

Member Data Documentation

◆ impl

std::shared_ptr<Impl> cv::segmentation::IntelligentScissorsMB::impl
protected

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