public void AddModelImage(Mat modelImage) { modelKeyPoints?.Dispose(); modelDescriptors?.Dispose(); modelImageSize = modelImage.Size; FindFeatures(modelImage, out modelKeyPoints, out modelDescriptors); featureMatcher.Clear(); featureMatcher.Add(modelDescriptors); }
/// <summary> /// Train the specified pattern. /// </summary> /// <param name="pattern">Pattern.</param> public void train() { // Store the pattern object // API of cv::DescriptorMatcher is somewhat tricky // First we clear old train data: m_matcher.Clear(); // Then we add vector of descriptors (each descriptors matrix describe one image). // This allows us to perform search across multiple images: List <Mat> descriptors = new List <Mat> (1); descriptors.Add(m_pattern.descriptors.Clone()); m_matcher.Add(descriptors); // After adding train data perform actual train: m_matcher.Train(); }
public void ClearTrainCollection() { _matcher.Clear(); _index = 0; _indexIdMapImage.Clear(); }