Ejemplo n.º 1
0
 /// <summary>
 /// set the correct path from which the algorithm will load the trained model.
 /// </summary>
 /// <param name="trainingPath"></param>
 public void SetTrainingPath(string trainingPath)
 {
     using (CvString trainingPathStr = new CvString(trainingPath))
     {
         SaliencyInvoke.cveObjectnessBINGSetTrainingPath(_ptr, trainingPathStr);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// dispose
 /// </summary>
 protected override void DisposeObject()
 {
     if (_ptr != IntPtr.Zero)
     {
         SaliencyInvoke.cveSaliencyRelease(ref _ptr);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// constructor
 /// </summary>
 public ObjectnessBING()
 {
     _ptr = SaliencyInvoke.cveObjectnessBINGCreate(
         ref _objectnessPtr,
         ref _saliencyPtr,
         ref _algorithmPtr,
         ref _sharedPtr);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Return the list of the rectangles' objectness value,.
        /// </summary>
        /// <returns></returns>
        public VectorOfFloat GetObjectnessValues()
        {
            //pretty sure that the vector<float> is owned by the saliency object, so we shouldn't dispose it.
            VectorOfFloat vector = new VectorOfFloat();

            SaliencyInvoke.cveObjectnessBINGGetObjectnessValues(_ptr, vector);
            return(vector);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Performs all the operations, according to the specific algorithm created, to obtain the saliency map.
 /// </summary>
 /// <param name="image"></param>
 /// <param name="saliencyMap"></param>
 /// <returns></returns>
 public bool Compute(Mat image, IOutputArray saliencyMap)
 {
     using (var ia = image.GetInputArray())
         using (var oa = saliencyMap.GetOutputArray())
         {
             return(SaliencyInvoke.cveSaliencyComputeSaliency(_ptr, ia, oa));
         }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Performs all the operations and calls all internal functions necessary for the accomplishment of the Binarized normed gradients algorithm.
 /// </summary>
 /// <param name="image"></param>
 /// <param name="boxes"></param>
 /// <returns></returns>
 public bool Compute(Mat image, VectorOfRect boxes)
 {
     using (var ia = image.GetInputArray())
         using (var oa = boxes.GetOutputArray())
         {
             return(SaliencyInvoke.cveSaliencyComputeSaliency(_ptr, ia, oa));
         }
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Return the list of the rectangles' objectness value.
 /// </summary>
 /// <returns>The list of the rectangles' objectness value.</returns>
 public float[] GetObjectnessValues()
 {
     using (VectorOfFloat vector = new VectorOfFloat())
     {
         SaliencyInvoke.cveObjectnessBINGGetObjectnessValues(_ptr, vector);
         return(vector.ToArray());
     }
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Creates a specialized saliency algorithm by its name.
        /// </summary>
        /// <param name="saliencyType"></param>
        protected Saliency(string saliencyType)
        {
            using (CvString saliencyTypeStr = new CvString(saliencyType))
            {
                _ptr = SaliencyInvoke.cveSaliencyCreate(saliencyTypeStr);
            }

            AlgorithmPtr = SaliencyInvoke.cveSaliencyGetAlgorithm(_ptr);
        }
Ejemplo n.º 9
0
 protected override void DisposeObject()
 {
     if (_ptr != IntPtr.Zero)
     {
         SaliencyInvoke.cveStaticSaliencySpectralResidualRelease(ref _ptr);
     }
     _staticSaliencyPtr = IntPtr.Zero;
     _saliencyPtr       = IntPtr.Zero;
     _algorithmPtr      = IntPtr.Zero;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Release the unmanaged memory associated with this object
 /// </summary>
 protected override void DisposeObject()
 {
     if (_ptr != IntPtr.Zero)
     {
         SaliencyInvoke.cveStaticSaliencyFineGrainedRelease(ref _ptr, ref _sharedPtr);
     }
     _staticSaliencyPtr = IntPtr.Zero;
     _saliencyPtr       = IntPtr.Zero;
     _algorithmPtr      = IntPtr.Zero;
 }
Ejemplo n.º 11
0
 protected override void DisposeObject()
 {
     if (_ptr != IntPtr.Zero)
     {
         SaliencyInvoke.cveMotionSaliencyBinWangApr2014Release(ref _ptr);
     }
     _objectnessPtr = IntPtr.Zero;
     _saliencyPtr   = IntPtr.Zero;
     _algorithmPtr  = IntPtr.Zero;
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Release the unmanaged memory associated with this object
 /// </summary>
 protected override void DisposeObject()
 {
     if (_ptr != IntPtr.Zero)
     {
         SaliencyInvoke.cveObjectnessBINGRelease(ref _ptr, ref _sharedPtr);
     }
     _objectnessPtr = IntPtr.Zero;
     _saliencyPtr   = IntPtr.Zero;
     _algorithmPtr  = IntPtr.Zero;
 }
Ejemplo n.º 13
0
 /// <summary>
 /// constructor
 /// </summary>
 public StaticSaliencySpectralResidual()
 {
     _ptr = SaliencyInvoke.cveStaticSaliencySpectralResidualCreate(ref _staticSaliencyPtr, ref _saliencyPtr,
                                                                   ref _algorithmPtr);
 }
Ejemplo n.º 14
0
 /// <summary>
 /// set the correct size (taken from the input image) in the corresponding variables that will be used to size the data structures of the algorithm.
 /// </summary>
 /// <param name="width"></param>
 /// <param name="height"></param>
 public void SetImageSize(int width, int height)
 {
     SaliencyInvoke.cveSaliencyMotionSetImageSize(_ptr, width, height);
 }
Ejemplo n.º 15
0
 /// <summary>
 /// This function allows the correct initialization of all data structures that will be used by the algorithm.
 /// </summary>
 public bool Init( )
 {
     return(SaliencyInvoke.cveMotionSaliencyBinWangApr2014Init(_ptr));
 }
Ejemplo n.º 16
0
 /// <summary>
 /// constructor
 /// </summary>
 public ObjectnessBING()
 {
     _ptr = SaliencyInvoke.cveMotionSaliencyBinWangApr2014Create(ref _objectnessPtr, ref _saliencyPtr,
                                                                 ref _algorithmPtr);
 }
Ejemplo n.º 17
0
 /// <summary>
 /// constructor
 /// </summary>
 public MotionSaliencyBinWangApr2014()
 {
     _ptr = SaliencyInvoke.cveMotionSaliencyBinWangApr2014Create(ref _motionSaliencyPtr, ref _saliencyPtr,
                                                                 ref _algorithmPtr);
 }
Ejemplo n.º 18
0
 /// <summary>
 /// This function allows the correct initialization of all data structures that will be used by the algorithm.
 /// </summary>
 /// <returns></returns>
 public bool Init()
 {
     return(SaliencyInvoke.cveSaliencyMotionInit(_ptr));
 }
Ejemplo n.º 19
0
 /// <summary>
 /// constructor
 /// </summary>
 public StaticSaliencyFineGrained()
 {
     _ptr = SaliencyInvoke.cveStaticSaliencyFineGrainedCreate(ref _staticSaliencyPtr, ref _saliencyPtr,
                                                              ref _algorithmPtr);
 }
Ejemplo n.º 20
0
 /// <summary>
 /// perform a binary map of given saliency map
 /// </summary>
 /// <param name="saliencyMap">the saliency map obtained through one of the specialized algorithms</param>
 /// <param name="binaryMap">the binary map</param>
 /// <returns></returns>
 public bool ComputeBinaryMap(Mat saliencyMap, Mat binaryMap)
 {
     return(SaliencyInvoke.cveSaliencyStaticComputeBinaryMap(_ptr, saliencyMap, binaryMap));
 }