Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

Image stitching camera translation

$
0
0
Hello, I need some help with image stitching aerial images from UAV. Since OpenCV natively does not support translation, just rotation, I'd like to extend structrure CalcRotation from modules/stitching/src/motion_estimators.cpp (or, better, write a new structure) to support rotation. The original CalcRotation structure is: struct CalcRotation { CalcRotation(int _num_images, const std::vector&_pairwise_matches, std::vector&_cameras) : num_images(_num_images), pairwise_matches(&_pairwise_matches[0]), cameras(&_cameras[0]) {} void operator ()(const GraphEdge &edge) { int pair_idx = edge.from * num_images + edge.to; Mat_ K_from = Mat::eye(3, 3, CV_64F); K_from(0,0) = cameras[edge.from].focal; K_from(1,1) = cameras[edge.from].focal * cameras[edge.from].aspect; K_from(0,2) = cameras[edge.from].ppx; K_from(1,2) = cameras[edge.from].ppy; Mat_ K_to = Mat::eye(3, 3, CV_64F); K_to(0,0) = cameras[edge.to].focal; K_to(1,1) = cameras[edge.to].focal * cameras[edge.to].aspect; K_to(0,2) = cameras[edge.to].ppx; K_to(1,2) = cameras[edge.to].ppy; Mat R = K_from.inv() * pairwise_matches[pair_idx].H.inv() * K_to; cameras[edge.to].R = cameras[edge.from].R * R; } int num_images; const MatchesInfo* pairwise_matches; CameraParams* cameras; }; I'd like to make something like: Mat t = // translation formula here cameras[edge.to].t = cameras[edge.from].t + t; // or something different if this is not correct Of course, if any of you thinks this way of achieveing translation is bad idea, feel free to post your ideas. Thanks in advance!

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>