Esempio n. 1
0
        public CVImage DrawContours()
        {
            CVImage grayscaled = (this.Channels == 1 ? this : this.ToGrayscale());

            __CvMemStoragePtr storage = PInvoke.cvCreateMemStorage(0);
            __CvSeqPtr        first_contour;
            CVImage           result = new CVImage(this.Width, this.Height, CVDepth.Depth8U, 3);

            unsafe
            {
                int num_contours = PInvoke.cvFindContours(
                    grayscaled.Internal,
                    storage,
                    out first_contour,
                    sizeof(__CvContour),
                    CV_RETR.CV_RETR_EXTERNAL,
                    CV_CHAIN.CV_CHAIN_APPROX_SIMPLE,
                    new __CvPoint(0, 0)
                    );

                // Makes an output image and draw contours:
                __CvSeq *cont = first_contour.ToPointer();

                for (; (cont = cont->_cvSequenceFields.__cvTreeNodeFields.h_next.ToPointer()) != null;)
                {
                    PInvoke.cvDrawContours(result.Array, new __CvSeqPtr(cont), new __CvScalar(255, 0, 0), new __CvScalar(0, 0, 0), 0, (int)CVGlobalConsts.CV_FILLED);
                    CVUtils.CheckLastError();
                }
            }

            PInvoke.cvReleaseMemStorage(ref storage);
            CVUtils.CheckLastError();
            return(result);
        }
Esempio n. 2
0
 internal static extern void cvPyrSegmentation(__CvImagePtr src, __CvImagePtr dst, __CvMemStoragePtr storage, __CvSeqPtr comp, int level, double threshold1, double threshold2);
Esempio n. 3
0
 internal static extern void cvPyrSegmentation(__CvImagePtr src, __CvImagePtr dst, __CvMemStoragePtr storage, __CvSeqPtr comp, int level, double threshold1, double threshold2);
Esempio n. 4
0
 /// <summary>
 /// Retrieves outer and optionally inner boundaries of white (non-zero) connected
 /// components in the black (zero) background
 /// </summary>
 /// <param name="image"></param>
 /// <param name="storage"></param>
 /// <param name="first_contour"></param>
 /// <returns></returns>
 public static int cvFindContours(__CvArrPtr image, __CvMemStoragePtr storage,
     out __CvSeqPtr first_contour)
 {
     unsafe
         {
             return cvFindContours(
                 image, storage, out first_contour, sizeof(__CvContour),
                 CV_RETR.CV_RETR_LIST, CV_CHAIN.CV_CHAIN_APPROX_SIMPLE, new __CvPoint(0, 0));
         }
 }
Esempio n. 5
0
 /// <summary>
 /// Retrieves outer and optionally inner boundaries of white (non-zero) connected
 /// components in the black (zero) background
 /// </summary>
 /// <param name="image"></param>
 /// <param name="storage"></param>
 /// <param name="first_contour"></param>
 /// <param name="header_size"></param>
 /// <param name="mode"></param>
 /// <param name="method"></param>
 /// <returns></returns>
 public static int cvFindContours(__CvArrPtr image, __CvMemStoragePtr storage,
     out __CvSeqPtr first_contour, int header_size)
 {
     return cvFindContours(image, storage, out first_contour, header_size, CV_RETR.CV_RETR_LIST, CV_CHAIN.CV_CHAIN_APPROX_SIMPLE, new __CvPoint(0,0));
 }
Esempio n. 6
0
 /// <summary>
 /// Retrieves outer and optionally inner boundaries of white (non-zero) connected
 /// components in the black (zero) background
 /// </summary>
 /// <param name="image"></param>
 /// <param name="storage"></param>
 /// <param name="first_contour"></param>
 /// <param name="header_size"></param>
 /// <param name="mode"></param>
 /// <param name="method"></param>
 /// <returns></returns>
 public static int cvFindContours(__CvArrPtr image, __CvMemStoragePtr storage,
     out __CvSeqPtr first_contour, int header_size, CV_RETR mode, CV_CHAIN method)
 {
     return cvFindContours(image, storage, out first_contour, header_size, mode, method, new __CvPoint(0,0));
 }
Esempio n. 7
0
 public static extern int cvFindContours(__CvArrPtr image, __CvMemStoragePtr storage,
     out __CvSeqPtr first_contour, int header_size, CV_RETR mode,
     CV_CHAIN method, __CvPoint offset);