Reputation: 83
I'm getting an error in OpenCV (v1.1,2.0,2.2) when using the cvFindExtrinsicCameraParams2() method, it works with an iPhone3GS but falls over when tested on the iPhone4. The error is:
"incorrect checksum for freed object - object was probably modified after being freed"
I ended up converting a whole lot of cvMat types to floats as opposed to doubles which resolved the issue but introduced the result overflowing giving me some strange results.
Does the iPhone4 have a stack limit for doubles?
Anyway - just wondering if anyone has resolved this issue? (also - anyone know of an optimized version?)
Upvotes: 1
Views: 408
Reputation: 93410
I don't know why you had the error, but to answer your question, the stack has a limited size.
On most systems, the size of float
is 4 bytes and double
is 8. So when you use double
to represent your data, you are actually using twice the space you would with float
.
A simple workaround (if you can) is to allocate memory for cvMat on the HEAP instead of the stack. To do this, declare a pointer do cvMat
and allocate space for it using the new operator.
The Thread Management doc states that stack size of the iOS main thread is 1 MB and 512K for secondary threads. You might need to do the core of your processing on the main thread.
Upvotes: 1