/// <summary>
 /// Release the unmanaged memory associated with this object.
 /// </summary>
 protected override void DisposeObject()
 {
     if (_ptr != IntPtr.Zero)
     {
         XimgprocInvoke.cveStructuredEdgeDetectionRelease(ref _ptr);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Release the unmanaged memory associated with this object.
 /// </summary>
 protected override void DisposeObject()
 {
     if (_ptr != IntPtr.Zero)
     {
         XimgprocInvoke.cveGraphSegmentationRelease(ref _ptr);
     }
 }
 /// <summary>
 /// Release the unmanaged memory associated with this object.
 /// </summary>
 protected override void DisposeObject()
 {
     if (_ptr != IntPtr.Zero)
     {
         XimgprocInvoke.cveSuperpixelSEEDSRelease(ref _ptr);
     }
 }
 /// <summary>
 /// Release the unmanaged memory associated with this object
 /// </summary>
 protected override void DisposeObject()
 {
     if (_ptr != IntPtr.Zero)
     {
         XimgprocInvoke.cveDTFilterRelease(ref _ptr);
     }
 }
 /// <summary>
 /// Produce domain transform filtering operation on source image.
 /// </summary>
 /// <param name="src">Filtering image with unsigned 8-bit or floating-point 32-bit depth and up to 4 channels.</param>
 /// <param name="dst">Destination image.</param>
 /// <param name="dDepth">Optional depth of the output image. dDepth can be set to Default, which will be equivalent to src.depth().</param>
 public void Filter(IInputArray src, IOutputArray dst, DepthType dDepth = DepthType.Default)
 {
     using (InputArray iaSrc = src.GetInputArray())
         using (OutputArray oaDst = dst.GetOutputArray())
         {
             XimgprocInvoke.cveDTFilterFilter(_ptr, iaSrc, oaDst, dDepth);
         }
 }
 /// <summary>
 /// The function initializes a SuperpixelSEEDS object for the input image.
 /// </summary>
 /// <param name="imageWidth">Image width</param>
 /// <param name="imageHeight">Image height</param>
 /// <param name="imageChannels">Number of channels of the image.</param>
 /// <param name="numSuperpixels">Desired number of superpixels. Note that the actual number may be smaller due to restrictions (depending on the image size and num_levels). Use getNumberOfSuperpixels() to get the actual number.</param>
 /// <param name="numLevels">Number of block levels. The more levels, the more accurate is the segmentation, but needs more memory and CPU time.</param>
 /// <param name="prior">Enable 3x3 shape smoothing term if >0. A larger value leads to smoother shapes. prior must be in the range [0, 5].</param>
 /// <param name="histogramBins">Number of histogram bins.</param>
 /// <param name="doubleStep">If true, iterate each block level twice for higher accuracy.</param>
 public SupperpixelSEEDS(int imageWidth, int imageHeight, int imageChannels,
                         int numSuperpixels, int numLevels, int prior,
                         int histogramBins,
                         bool doubleStep)
 {
     _ptr = XimgprocInvoke.cveSuperpixelSEEDSCreate(
         imageWidth, imageHeight, imageChannels,
         numSuperpixels, numLevels, prior,
         histogramBins, doubleStep);
 }
 /// <summary>
 /// Create instance of DTFilter and produce initialization routines.
 /// </summary>
 /// <param name="guide">Guided image (used to build transformed distance, which describes edge structure of guided image).</param>
 /// <param name="sigmaSpatial">Parameter in the original article, it's similar to the sigma in the coordinate space into bilateralFilter.</param>
 /// <param name="sigmaColor">Parameter in the original article, it's similar to the sigma in the color space into bilateralFilter.</param>
 /// <param name="mode">One form three modes DTF_NC, DTF_RF and DTF_IC which corresponds to three modes for filtering 2D signals in the article.</param>
 /// <param name="numIters">Optional number of iterations used for filtering, 3 is quite enough.</param>
 public DTFilter(IInputArray guide, double sigmaSpatial, double sigmaColor, Mode mode = Mode.NC, int numIters = 3)
 {
     using (InputArray iaGuide = guide.GetInputArray())
         _ptr = XimgprocInvoke.cveDTFilterCreate(iaGuide, sigmaSpatial, sigmaColor, mode, numIters);
 }
 /// <summary>
 /// Create a default RFFeatureGetter
 /// </summary>
 public RFFeatureGetter()
 {
     _ptr = XimgprocInvoke.cveRFFeatureGetterCreate();
 }
 /// <summary>
 /// The function detects edges in src and draw them to dst. The algorithm underlies this function is much more robust to texture presence, than common approaches, e.g. Sobel
 /// </summary>
 /// <param name="src">source image (RGB, float, in [0;1]) to detect edges</param>
 /// <param name="dst">destination image (grayscale, float, in [0;1]) where edges are drawn</param>
 public void DetectEdges(Mat src, Mat dst)
 {
     XimgprocInvoke.cveStructuredEdgeDetectionDetectEdges(_ptr, src, dst);
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="model">name of the file where the model is stored</param>
 /// <param name="howToGetFeatures">optional object inheriting from RFFeatureGetter. You need it only if you would like to train your own forest, pass NULL otherwise</param>
 public StructuredEdgeDetection(String model, RFFeatureGetter howToGetFeatures)
 {
     using (CvString sModel = new CvString(model))
         _ptr = XimgprocInvoke.cveStructuredEdgeDetectionCreate(sModel, howToGetFeatures);
 }
Beispiel #11
0
 /// <summary>
 /// Creates a graph based segmentor.
 /// </summary>
 /// <param name="sigma">The sigma parameter, used to smooth image</param>
 /// <param name="k">The k parameter of the algorithm</param>
 /// <param name="minSize">The minimum size of segments</param>
 public GraphSegmentation(double sigma = 0.5, float k = 300, int minSize = 100)
 {
     _ptr = XimgprocInvoke.cveGraphSegmentationCreate(sigma, k, minSize);
 }
 /// <summary>
 /// Returns the mask of the superpixel segmentation stored in SuperpixelSEEDS object.
 /// </summary>
 /// <param name="image">Return: CV_8UC1 image mask where -1 indicates that the pixel is a superpixel border, and 0 otherwise.</param>
 /// <param name="thickLine">If false, the border is only one pixel wide, otherwise all pixels at the border are masked.</param>
 public void GetLabelContourMask(IOutputArray image, bool thickLine = false)
 {
     using (OutputArray oaImage = image.GetOutputArray())
         XimgprocInvoke.cveSuperpixelSEEDSGetLabelContourMask(_ptr, oaImage, thickLine);
 }
 /// <summary>
 /// Returns the segmentation labeling of the image.
 /// Each label represents a superpixel, and each pixel is assigned to one superpixel label.
 /// </summary>
 /// <param name="labels">Return: A CV_32UC1 integer array containing the labels of the superpixel segmentation. The labels are in the range [0, NumberOfSuperpixels].</param>
 public void GetLabels(IOutputArray labels)
 {
     using (OutputArray oaLabels = labels.GetOutputArray())
         XimgprocInvoke.cveSuperpixelSEEDSGetLabels(_ptr, oaLabels);
 }
Beispiel #14
0
 /// <summary>
 /// Calculates the superpixel segmentation on a given image with the initialized parameters in the SuperpixelSLIC object.
 /// This function can be called again without the need of initializing the algorithm with createSuperpixelSLIC(). This save the computational cost of allocating memory for all the structures of the algorithm.
 /// </summary>
 /// <param name="numIterations">Number of iterations. Higher number improves the result.</param>
 public void Iterate(int numIterations = 10)
 {
     XimgprocInvoke.cveSuperpixelSLICIterate(_ptr, numIterations);
 }
Beispiel #15
0
 /// <summary>
 /// The function initializes a SuperpixelSLIC object for the input image. It sets the parameters of choosed superpixel algorithm, which are: region_size and ruler. It preallocate some buffers for future computing iterations over the given image.
 /// </summary>
 /// <param name="image">Image to segment</param>
 /// <param name="algorithm">Chooses the algorithm variant to use</param>
 /// <param name="regionSize">Chooses an average superpixel size measured in pixels</param>
 /// <param name="ruler">Chooses the enforcement of superpixel smoothness factor of superpixel</param>
 public SupperpixelSLIC(IInputArray image, Algorithm algorithm, int regionSize, float ruler)
 {
     using (InputArray iaImage = image.GetInputArray())
         _ptr = XimgprocInvoke.cveSuperpixelSLICCreate(iaImage, algorithm, regionSize, ruler);
 }
Beispiel #16
0
 /// <summary>
 /// Segment an image and store output in dst.
 /// </summary>
 /// <param name="src">The input image. Any number of channel (1 (Eg: Gray), 3 (Eg: RGB), 4 (Eg: RGB-D)) can be provided</param>
 /// <param name="dst">The output segmentation. It's a CV_32SC1 Mat with the same number of cols and rows as input image, with an unique, sequential, id for each pixel.</param>
 public void ProcessImage(IInputArray src, IOutputArray dst)
 {
     using (InputArray iaSrc = src.GetInputArray())
         using (OutputArray oaDst = dst.GetOutputArray())
             XimgprocInvoke.cveGraphSegmentationProcessImage(_ptr, iaSrc, oaDst);
 }
 /// <summary>
 /// Calculates the superpixel segmentation on a given image with the initialized parameters in the SuperpixelSEEDS object.
 /// </summary>
 /// <remarks>This function can be called again for other images without the need of initializing the algorithm with createSuperpixelSEEDS(). This save the computational cost of allocating memory for all the structures of the algorithm.</remarks>
 /// <param name="img">Input image. Supported formats: CV_8U, CV_16U, CV_32F. Image size &amp; number of channels must match with the initialized image size &amp; channels with the function createSuperpixelSEEDS(). It should be in HSV or Lab color space. Lab is a bit better, but also slower.</param>
 /// <param name="numIterations">Number of pixel level iterations. Higher number improves the result.</param>
 public void Iterate(IInputArray img, int numIterations = 4)
 {
     using (InputArray iaImg = img.GetInputArray())
         XimgprocInvoke.cveSuperpixelSEEDSIterate(_ptr, iaImg, numIterations);
 }
 /// <summary>
 /// The function initializes a SuperpixelLSC object for the input image.
 /// </summary>
 /// <param name="image">Image to segment</param>
 /// <param name="regionSize">Chooses an average superpixel size measured in pixels</param>
 /// <param name="ratio">Chooses the enforcement of superpixel compactness factor of superpixel</param>
 public SuperpixelLSC(IInputArray image, int regionSize, float ratio)
 {
     using (InputArray iaImage = image.GetInputArray())
         _ptr = XimgprocInvoke.cveSuperpixelLSCCreate(iaImage, regionSize, ratio);
 }