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
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
imgFromInputArrayFirst image in a sequence (3-channel).
imgToInputArraySecond image in a sequence (3-channel).
pointsFromPoint[]Coordinates in
imgFromof each found correspondence.pointsToPoint[]Corresponding coordinates in
imgTo, parallel topointsFrom.matchingParamsGPCMatchingParamsAdditional 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
samplesGPCTrainingSamplesTraining samples, e.g. obtained via Create(IEnumerable<Mat>, IEnumerable<Mat>, IEnumerable<Mat>, GPCDescType).
trainingParamsGPCTrainingParamsTraining 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
imagesFromIEnumerable<Mat>First images of the image pairs.
imagesToIEnumerable<Mat>Second images of the image pairs.
gtIEnumerable<Mat>Ground-truth flow for each image pair.
trainingParamsGPCTrainingParamsTraining parameters. Uses the native defaults when null.