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;
}