Example #1
0
 /// <summary>
 /// Release the unmanaged memory associated with this object
 /// </summary>
 protected override void DisposeObject()
 {
     if (_needDispose && (_ptr != IntPtr.Zero))
     {
         LinemodInvoke.cveLinemodMatchRelease(ref _ptr);
     }
 }
Example #2
0
 /// <summary>
 /// Release the unmanaged memory associated with this object
 /// </summary>
 protected override void DisposeObject()
 {
     if (_sharedPtr != IntPtr.Zero)
     {
         LinemodInvoke.cveLinemodDetectorRelease(ref _sharedPtr);
         _ptr = IntPtr.Zero;
     }
 }
Example #3
0
 /// <summary>
 /// Add new object template.
 /// </summary>
 /// <param name="sources">Source images, one for each modality.</param>
 /// <param name="classId">Object class ID.</param>
 /// <param name="objectMask">Mask separating object from background.</param>
 /// <param name="boundingBox">Return bounding box of the extracted features.</param>
 /// <returns>Template ID, or -1 if failed to extract a valid template.</returns>
 public int AddTemplate(
     VectorOfMat sources,
     String classId,
     Mat objectMask,
     ref Rectangle boundingBox)
 {
     using (CvString csClassId = new CvString(classId))
     {
         return(LinemodInvoke.cveLinemodDetectorAddTemplate(
                    _ptr,
                    sources,
                    csClassId,
                    objectMask,
                    ref boundingBox));
     }
 }
Example #4
0
 /// <summary>
 /// Detect objects by template matching. Matches globally at the lowest pyramid level, then refines locally stepping up the pyramid.
 /// </summary>
 /// <param name="sources">Source images, one for each modality.</param>
 /// <param name="threshold">Similarity threshold, a percentage between 0 and 100.</param>
 /// <param name="matches">Template matches, sorted by similarity score.</param>
 /// <param name="classIds">If non-empty, only search for the desired object classes.</param>
 /// <param name="quantizedImages">Optionally return vector&lt;Mat&gt; of quantized images.</param>
 /// <param name="masks">The masks for consideration during matching. The masks should be CV_8UC1 where 255 represents a valid pixel. If non-empty, the vector must be the same size as sources. Each element must be empty or the same size as its corresponding source.</param>
 public void Match(
     VectorOfMat sources,
     float threshold,
     VectorOfLinemodMatch matches,
     VectorOfCvString classIds            = null,
     IOutputArrayOfArrays quantizedImages = null,
     VectorOfMat masks = null)
 {
     using (OutputArray oaQuantizedImages =
                quantizedImages == null ? OutputArray.GetEmpty() : quantizedImages.GetOutputArray())
     {
         LinemodInvoke.cveLinemodDetectorMatch(
             _ptr,
             sources,
             threshold,
             matches,
             classIds,
             oaQuantizedImages,
             masks
             );
     }
 }
Example #5
0
 /// <summary>
 /// Create modality by name.
 /// </summary>
 /// <param name="modalityType">The following modality types are supported: "ColorGradient", "DepthNormal"</param>
 public Modality(String modalityType)
 {
     using (CvString csModalityType = new CvString(modalityType))
         _ptr = LinemodInvoke.cveLinemodModalityCreate(csModalityType, ref _sharedPtr);
 }
Example #6
0
 /// <summary>
 /// Create an empty template match result.
 /// </summary>
 public Match()
 {
     _ptr         = LinemodInvoke.cveLinemodMatchCreate();
     _needDispose = true;
 }
Example #7
0
 /// <summary>
 /// Write the detector to file storage
 /// </summary>
 /// <param name="fs">The file storage to write the detector into.</param>
 public void Write(FileStorage fs)
 {
     LinemodInvoke.cveLinemodDetectorWrite(_ptr, fs);
 }
Example #8
0
 /// <summary>
 /// Read the detector from file node
 /// </summary>
 /// <param name="fn">The file node to read the detector from</param>
 public void Read(FileNode fn)
 {
     LinemodInvoke.cveLinemodDetectorRead(_ptr, fn);
 }
Example #9
0
 /// <summary>
 /// Create a detector using LINE-MOD algorithm with color gradients and depth normals. Default parameter settings suitable for VGA images.
 /// </summary>
 public LinemodDetector()
 {
     _ptr = LinemodInvoke.cveLinemodLinemodDetectorCreate(ref _sharedPtr);
 }
Example #10
0
 /// <summary>
 /// Get sampling step T at <paramref name="pyramidLevel"/>.
 /// </summary>
 /// <param name="pyramidLevel">The pyramid level</param>
 /// <returns>Sampling step T</returns>
 public int GetT(int pyramidLevel)
 {
     return(LinemodInvoke.cveLinemodDetectorGetT(_ptr, pyramidLevel));
 }