I'm using OpenCV 2.4 to convert a video into a long (narrow) mosaic. This is my first time using OpenCV, but so far I've managed the following with some success:
- Get frames from video.
- Get keypoint descriptors using SIFT.
- Sort out the outliers using RANSAC
- Find the homography matrix.
The issue is when I apply the homography matrix to one of the frames/images and try and generate the mosaic. Sometimes I get an error complaining that the size of the destination matrix for warpPerspective() is too small. To get around this I guess an overly large size to make sure the result fits in. However, after a copy of frames have been joined together I have a huge image which is mostly black. So my question is, how can I do this in a smart way? How can I calculate the size of the destination matrix I'll need for the mosaic BEFORE I pass it to warpPerspective()? I've been trying things with ROI/Rect but I'm not really sure what I'm doing with that.
If you have any suggestions I'd be eternally grateful.