开发者

cvFindExtrinsicCameraParams2() error on iPhone 4

I'm getting an error in OpenCV (v1.1,2.0,2.2) when using the cvFindE开发者_StackOverflowxtrinsicCameraParams2() 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?)


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜