I've been working with the contour code in the image processing toolbox trying to get the contours of a thresholded image. I followed all the steps in "demo_application_native_api_contours.c" on how to detect segments->bounding rectangle->trace contours. And since I am working on a larger image region (60x60) than the demo application is, I modified the macro definition of MAX_NUM_RUN_LEN_NODE, MAX_NUM_SEGMENT_HDR and MAX_NUM_CONTOUR_HDR in "adi_contour_mem_alloc.c" to 20 times the original size. I've also allocated 0x1fffff bytes ( 2097151) for pDMA, which I would think is large enough. But every time I come to adi_contour_TraceContour, Contour_Bottom2Top always failed with insufficient memory. It would be greatly appreciated if anyone could help. Thanks!