Table of Contents

Class GPCForest5

Namespace
OpenCvSharp.OptFlow
Assembly
OpenCvSharp.dll

Class for computing the correspondences between two images using the Global Patch Collider (GPC) algorithm.

public class GPCForest5 : Algorithm, IDisposable
Inheritance
GPCForest5
Implements
Inherited Members

Remarks

This wraps cv::optflow::GPCForest<T>, a C++ template class, with a single fixed explicit instantiation at T = 5 (matching what upstream OpenCV's own samples/tests universally hardcode).

Methods

Create()

Creates an empty GPC forest of 5 trees.

public static GPCForest5 Create()

Returns

GPCForest5

FindCorrespondences(InputArray, InputArray, out Point[], out Point[], GPCMatchingParams?)

Finds correspondences between two images using the trained forest.

public void FindCorrespondences(InputArray imgFrom, InputArray imgTo, out Point[] pointsFrom, out Point[] pointsTo, GPCMatchingParams? matchingParams = null)

Parameters

imgFrom InputArray

First image in a sequence (3-channel).

imgTo InputArray

Second image in a sequence (3-channel).

pointsFrom Point[]

Coordinates in imgFrom of each found correspondence.

pointsTo Point[]

Corresponding coordinates in imgTo, parallel to pointsFrom.

matchingParams GPCMatchingParams

Additional matching parameters for fine-tuning. Uses the native defaults when null.

Train(GPCTrainingSamples, GPCTrainingParams?)

Trains the forest using one sample set for every tree. Consider using the overload taking image/ground-truth-flow triples instead for better quality.

public void Train(GPCTrainingSamples samples, GPCTrainingParams? trainingParams = null)

Parameters

samples GPCTrainingSamples

Training samples, e.g. obtained via Create(IEnumerable<Mat>, IEnumerable<Mat>, IEnumerable<Mat>, GPCDescType).

trainingParams GPCTrainingParams

Training parameters. Uses the native defaults when null.

Train(IEnumerable<Mat>, IEnumerable<Mat>, IEnumerable<Mat>, GPCTrainingParams?)

Trains the forest using individual samples extracted for each tree from the given image pairs and ground-truth flow. Generally produces better quality than the single-sample-set overload.

public void Train(IEnumerable<Mat> imagesFrom, IEnumerable<Mat> imagesTo, IEnumerable<Mat> gt, GPCTrainingParams? trainingParams = null)

Parameters

imagesFrom IEnumerable<Mat>

First images of the image pairs.

imagesTo IEnumerable<Mat>

Second images of the image pairs.

gt IEnumerable<Mat>

Ground-truth flow for each image pair.

trainingParams GPCTrainingParams

Training parameters. Uses the native defaults when null.