How to stitch images with differing orientations
I have a set of images collected from a drone that I now want to stitch together. The approach I started going towards is to rotate all the images to the proper orientation, then try to stitch those together. However since the rotated images are no longer rectangular, I have large empty areas with no image data. As expected, these dark areas have caused poor stitching results.
I have seen the api for stitch:
Status stitch (InputArrayOfArrays images, const std::vector< std::vector< Rect > > &rois, OutputArray pano)
I like that there is an "ROI" parameter, however the data type is a "Rect" instead of something like a "RotatedRect" or a mask. So this looks like it won't work either.
The only other approach I can think of is to further crop the image to remove the no-data areas of the image (which would require more images to make up for the lost data).
I am not an expert in OpenCV so I'm looking for some awesome ideas from all you experts. Is there a better way to approach this?
Update for clarification These images are rotated arbitrarily depending on the direction the camera was facing. The orientation may vary on all angles. The worst case scenario is where I'd need to rotate the image to 45 degrees in order to register it with the others.
Have a look at sample stitching_detailed and this post
I am familiar with the first link (the example creation of the pipeline). Is there a specific part you suggest I look at? From what I can gather, I'd have to re-implement various parts of the pipeline to ignore the black pixels. Perhaps it is only the blending, but still wouldn't I need to recreate it?
As for the second link, there seems to be two questions involved. First, the ROI's there are rectangular, so they are different from my case (I want rotated rectangular ROIs. Second, the warping is already working well for me with the stereographic warping method.