【发布时间】:2012-03-09 17:33:37
【问题描述】:
以下函数解决了问题,但我不明白如何调用它,尤其是“out List ImgLetters”部分。
public static bool ApplyBlobExtractor (Bitmap SourceImg, int LettersCount, out List<Bitmap> ImgLetters)
{
ImgLetters = null;
ImgLetters = new List<Bitmap> ();
BlobCounter blobCounter = new BlobCounter ();
// Sort order
blobCounter.ObjectsOrder = ObjectsOrder.XY;
blobCounter.ProcessImage (SourceImg);
Blob[] blobs = blobCounter.GetObjects (SourceImg, false);
// Adding images into the image list
UnmanagedImage currentImg;
foreach (Blob blob in blobs)
{
currentImg = blob.Image;
ImgLetters.Add (currentImg.ToManagedImage ());
}
return ImgLetters.Count == LettersCount;
}
现在让我们看看这个:
public static bool ApplyBlobExtractor (Bitmap SourceImg, int LettersCount, out List<Bitmap> ImgLetters)
Bitmap SourceImg - 图片,可以找到 blob 的位置
int LettersCount - 我们要提取的 blob(数字)
列出 ImgLetters - ???
第三个参数有什么作用(如何调用这个函数)?
Bitmap image1 = new Bitmap(@"C:\1.png");
..
ApplyBlobExtractor (image1, 1, ??? )
..
image2.save(@"C:\2.png")
【问题讨论】:
-
但是我已经完成了寻找代码的所有工作。剩下的就是调用函数。你至少能解释一下第三个参数的作用吗,因为我花了几个小时试图解决这个问题.
-
P.S.由于误解,我编辑了问题
标签: c# image save extract blobs