예제 #1
0
 /// <summary>
 /// Extracts text regions from image
 /// </summary>
 /// <param name="image">Source image where text blocks needs to be extracted from. Should be CV_8UC3 (color)</param>
 /// <param name="er_filter1">Extremal Region Filter for the 1st stage classifier of N&M algorithm [Neumann12]</param>
 /// <param name="er_filter2">Extremal Region Filter for the 2nd stage classifier of N&M algorithm [Neumann12]</param>
 /// <param name="regions">Output list of regions with text</param>
 public static void DetectRegions(InputArray image, ERFilter er_filter1, ERFilter er_filter2, out Point[][] regions)
 {
     using (var vecRegions = new VectorOfVectorPoint())
     {
         NativeMethods.text_detectRegions(image.CvPtr, er_filter1.CvPtr, er_filter2.CvPtr, vecRegions.CvPtr);
         regions = vecRegions.ToArray();
     }
 }
예제 #2
0
파일: MSER.cs 프로젝트: 180D-FW-2020/Team13
        /// <summary>
        /// 
        /// </summary>
        /// <param name="image"></param>
        /// <param name="msers"></param>
        /// <param name="bboxes"></param>
        public virtual void DetectRegions(
            InputArray image, out Point[][] msers, out Rect[] bboxes)
        {
            if (disposed)
                throw new ObjectDisposedException(GetType().Name);
            if (image == null)
                throw new ArgumentNullException("nameof(image)");
            image.ThrowIfDisposed();

            using (var msersVec = new VectorOfVectorPoint())
            using (var bboxesVec = new VectorOfRect())
            {
                NativeMethods.features2d_MSER_detectRegions(
                    ptr, image.CvPtr, msersVec.CvPtr, bboxesVec.CvPtr);
                msers = msersVec.ToArray();
                bboxes = bboxesVec.ToArray();
            }

            GC.KeepAlive(image);
        }
예제 #3
0
        /// <summary>
        /// Detect MSER regions
        /// </summary>
        /// <param name="image">input image (8UC1, 8UC3 or 8UC4, must be greater or equal than 3x3)</param>
        /// <param name="msers">resulting list of point sets</param>
        /// <param name="bboxes">resulting bounding boxes</param>
        public virtual void DetectRegions(
            InputArray image, out Point[][] msers, out Rect[] bboxes)
        {
            ThrowIfDisposed();
            if (image == null)
            {
                throw new ArgumentNullException(nameof(image));
            }
            image.ThrowIfDisposed();

            using (var msersVec = new VectorOfVectorPoint())
                using (var bboxesVec = new VectorOfRect())
                {
                    NativeMethods.HandleException(
                        NativeMethods.features2d_MSER_detectRegions(
                            ptr, image.CvPtr, msersVec.CvPtr, bboxesVec.CvPtr));
                    GC.KeepAlive(this);
                    msers  = msersVec.ToArray();
                    bboxes = bboxesVec.ToArray();
                }

            GC.KeepAlive(image);
        }