opencvsharp imfill [closed]

asked 2013-04-30 08:23:53 -0500

mehtap gravatar image

hi,I've been looking around the internet to find a proper imfill function (as the one in Matlab) but working in C# with OpenCVSharp.I found for opencv (C++) and ı convert it to opncvsharp.But it is not work.Please help me.Here is my code:

      public static IplImage imfill(IplImage src)
             {
            CvScalar white=Cv.RGB(255, 255, 255);

            IplImage dst = Cv.CreateImage(src.GetSize(), BitDepth.F64, 3);
            IplImage gray = Cv.CreateImage(src.GetSize(), BitDepth.U8, 1);
            Cv.CvtColor(src, gray, ColorConversion.BgrToGray);
            CvMemStorage storage = new CvMemStorage(0);
            CvSeq<CvPoint> contour;

            //Cv.FindContours(gray, storage, out contour, CvContour.SizeOf);
            Cv.FindContours(gray, storage, out contour, CvContour.SizeOf,
                 ContourRetrieval.List, ContourChain.ApproxSimple,
                                                new CvPoint(0, 0));

            while (contour != null)
            {
                Cv.DrawContours(gray, contour, white, white, 0, Cv.FILLED, LineType.AntiAlias);

                CvInvoke.cvDrawContours(gray, contour, white, white, 0, -1, LineType.AntiAlias, CvPoint(0, 0));
                contour = contour.HNext;
            }
           IplImage bin_imgFilled = Cv.CreateImage(src.GetSize(), BitDepth.U8, 1);
            Cv.InRangeS(dst,white, white, bin_imgFilled);
            using (new CvWindow("likely_skin", bin_imgFilled))
            {
                Cv.WaitKey();
            }
            return bin_imgFilled;
        }
edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant by StevenPuttemans
close date 2013-04-30 08:32:54.595603

Comments

I will close this topic. As possible to read in the FAQ you should only address problems on this Q&A forum that address OpenCV problems related to the original packages that are support. If you decide to use a wrapper library to be able to use the functionality in C#, you should address proper places for the solution.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-30 08:31:57 -0500 )edit