【发布时间】:2011-06-10 13:29:27
【问题描述】:
我正在处理非常大的图像,但我收到一个异常通知我“无法分配 991623040 字节”
我有 64 位 Win7 和 8GB 内存。小于1GB的时候失败不是很可笑吗?
我该如何解决这个问题?
public bresenhamCircle()
{
if (path != null) //path is a string represents the file path
{
using (IplImage orgImg = new IplImage(rc.imgeYolu, LoadMode.GrayScale))
{
if (rc.sekizBit)
{
orgImg.ToBitmap();
}
else
{
//binary image
}
using (IplImage imgLabel = new IplImage(orgImg.Size, BitDepth.F32, 1))
{
using (CvBlobs blobs = new CvBlobs())
{
uint result = blobs.Label(orgImg, imgLabel);
blobs.FilterByArea(10, 130);
}
}
}
}
else
{
throw new Exception("smtg..");
}
}
我在这一行收到错误消息: 使用 (IplImage imgLabel = new IplImage(orgImg.Size, BitDepth.F32, 1))
【问题讨论】:
-
让我们看看产生这个错误的代码。还要注意你使用的是什么版本的opencv。
-
using (IplImage imgLabel = new IplImage(orgImg.Size, BitDepth.F32, 1)) 这一行会产生错误。 orgImage 大小为 18000x13000,使用以下代码从文件中定义:IplImage orgImg = new IplImage(path, LoadMode.GrayScale) OpenCV 版本为 2.2
-
编辑您的原始帖子并将代码放入代码块中。
标签: .net opencv out-of-memory