我有一组图像,我通过C循环迭代,我想在它们上计算描述符。代码非常简单:
int main(int argc, char** argv)
{
FILE *arq = NULL;
CImage *cimg=NULL;
Image *mask=NULL;
Image *gt=NULL;
CImage *rmask=NULL;
int maxR, minR, r, relevance;
if (argc != 5)
{
fprintf(stderr,"usage: extraction <image> <region mask> <groundtruth> <curve>\n");
return(1);
}
fprintf(stderr, "\nReading Image");
cimg = ReadCImage(argv[1]);
fprintf(stderr, "\nPasso 2: Reading Segmentation");
mask = ReadImage(argv[2]);
fprintf(stderr, "\nPasso 3: Reading Ground-Truth");
gt = ReadImage(argv[3]);
arq = fopen(argv[4], "a+");
maxR = MaximumValue(mask);
minR = MinimumValue(mask);
for(r=minR; r <= maxR; r++)
{
relevance = isRelevant(gt, mask, r);
rmask = createRegionImage(r, mask, cimg);
Extraction(rmask,relevance,r,arq);
}
fclose(arq);
DestroyCImage(&cimg);
DestroyImage(&mask);
DestroyImage(>);
return(0);
}
换句话说,此代码打开图像文件并寻找此图像的区域。之后,它从每个图像区域中提取一个特征。
我的问题是这个代码适用于除一个(26150)之外的所有图像区域。它返回错误'无法在AllocDoubleArray中分配内存空间'。 gdb输出是
Error:Cannot allocate memory space in in AllocDoubleArray
Program exited with code 0377.
编辑正常,你可以看到
rm ../bin/*
cd ../; make; cd app
make[1]: Entering directory `/home/me/code/descriptor/source'
echo "libtexturedescriptors.a built..."
libtexturedescriptors.a built...
make[1]: Leaving directory /home/me/code/descriptor/source'
gcc -O2 -Wall my_program.c -o ../bin /my_program -I../include -L../lib -ltexturedescriptors -lm
这个区域是否足够我的PC内存?有人之前遇到过这个错误吗?怎么解决呢?