I am trying to get to run fcvTrackLKOpticalFlowu8_v2 using FastCV 1.3. Prior calling this function pyramids has to be created, here is the code:
pyr2 = new fcvPyramidLevel_v2[pyrLevel];
int i = fcvPyramidAllocate_v2( pyr2, dataBufWidth, dataBufHeight, dataBufWidth, 1, pyrLevel, 1);
DPRINTF( "fcvPyramidAllocate_v2 error code: %d \n", i);
i = fcvPyramidCreateu8_v2( (uint8_t*) dataBuf, dataBufWidth, dataBufHeight, dataBufWidth, pyrLevel, pyr2 );
DPRINTF( "fcvPyramidCreateu8_v2 error code: %d \n", i);
Both functions return 0. But fcvPyramidCreateu8_v2 crashes the program with Exception Stack error shown on the hyperterminal.
Any thought?
Problem solved:
Both fcvPyramidCreateu8_v2 and fcvTrackLKOpticalFlowu8_v2 seem to return 0 regardless.
pyr2 has pyrLevel number of layers basically, when it is created with "new".
But during allocation in the fcvPyramidAllocate_v2 the allocateBase was set to 1, which meant an extra layer to be allocated, which created an overflow. So the solution was to give the allocateBase parameter 0 value.
It is interesting that wasn't throwing an exception error if just running fcvPyramidAllocate_v2 (probably it supposed to return that no allocation could make), but the exception was thrown when fcvPyramidCreateu8_v2 was called, when actually the memory space was about to be used.