Hi,
I am using the VLIB library's "Create Connected Components List" on an image to extract information about blobs.
I'm building on the VLIB_testConnectedComponents.c example, and got everything to work with my own 32-bit packed binary converted image (in a small size).
The problem comes when I increase the size of my image. Already at sizes over 64x225 pixels, the VLIB_createConnectedComponentsList returns an error, and for sizes over 200x200 the execution won't even start.
I have lowered the maxBytesRequired, as recommended, to around 32000. This seems to be the max size that VLIB_initConnectedComponentsList accepts.
Cut to the chase: I need to analyse a large image (over 320x320 pixels), but VLIB_createConnectedComponentsList keeps returning != 0 (which is equal to error).
Here's the crucial part of the code:
#define DDR2HEAP 0
#define MINBLOBAREA 50
#define IMAGEWIDTH 320
#define IMAGEHEIGHT 320
#define NUM32BITPACKEDBINARYWORDSperROW IMAGEWIDTH/32
#pragma DATA_SECTION(binary32bitPackedFGMask, "ddr2")
int binary32bitPackedFGMask[IMAGEHEIGHT][NUM32BITPACKEDBINARYWORDSperROW];
...
void main(void)
{
void *pBuf;
VLIB_CCHandle * handle;
VLIB_CC vlibBlob;
...
#define MEM_alloc(x,y,z) malloc(y)
VLIB_calcConnectedComponentsMaxBufferSize(IMAGEWIDTH,IMAGEHEIGHT,MINBLOBAREA,&maxBytesRequired);
//bytesRecommended = maxBytesRequired/2;
bytesRecommended = 32000;
// Manage handle
sizeOfCCHandle = VLIB_GetSizeOfCCHandle();
handle = (VLIB_CCHandle *) MEM_alloc(DDR2HEAP, sizeOfCCHandle, 8);
// Set-up Memory Buffers
pBuf = (void *) MEM_alloc(DDR2HEAP, bytesRecommended, 8);
statusInit = VLIB_initConnectedComponentsList(handle, pBuf, bytesRecommended);
...
//Packing my image correctly to binary32bitPackedFGMask
...
status = VLIB_createConnectedComponentsList(handle,
IMAGEWIDTH,
IMAGEHEIGHT,
(int*)(&binary32bitPackedFGMask[0][0]),
MINBLOBAREA,
1);
if (status != VLIB_NO_ERROR)
printf("\nCreation of Connected Components failed!!!");
...
Why can't the process accept bigger images then 64x225 pixels. Can anybody help me find the bottleneck? Could it be memory usage?
The image is located in extern memory and I'm using CCS 3.3 on a DM6437.
Hope my question makes sense,
Martin