OpenCV warpPerspective slow performance

感情迁移 提交于 2019-12-23 10:02:14

问题


In my application:

  1. I track an object.

  2. Get where its corners are coming in this frame.

  3. I find the homography between its corners from last frame and current frame.

  4. Use that homography to do a perspectiveTransform on the corners found in the current frame, to get transformed_corners.

  5. Use the transformed_corners to find the homography between them and the overlay_image.

  6. Apply above homography M to overlay_image, to get what would be called the warped_image using warpPerspective. This is the slow part.

  7. And then using masking operations, I print the warped_image onto the current frame where the object was found.

Now I know after reading this blog article here why warpPerspective is slow.

And I'm getting ~300ms per frame in just the 6th step above, all because of warpPerspective. It's significantly affecting the FPS output of my application. Basically, it went down to 2FPS from 12 FPS without warping on every frame.

Is there any faster alternative to this? It's all done on Android, using NDK r9. What are some fast alternatives, and optimizations to reduce the warp time from 300ms to sub 50ms times?

来源:https://stackoverflow.com/questions/32880842/opencv-warpperspective-slow-performance

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!