OpenPano | Automatic Panorama Stitching From Scratch | Computer Vision library
kandi X-RAY | OpenPano Summary
kandi X-RAY | OpenPano Summary
OpenPano is a panorama stitching program written in C++ from scratch (without any vision libraries). It mainly follows the routine described in the paper Automatic Panoramic Image Stitching using Invariant Features, which is also the one used by AutoStitch.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of OpenPano
OpenPano Key Features
OpenPano Examples and Code Snippets
Community Discussions
Trending Discussions on OpenPano
QUESTION
I'm looking for a good panorama stitching library for text. I tried OpenCV and OpenPano. They both work good on regular photos, but fail on text. For example I need to stitch the following 3 images:
The images have about 45% overlapping between each other.
If there's an option to make one of the mentioned libraries work good on text images, instead of finding another library, that would be great.
- I need the library to work on linux arm.
ANSWER
Answered 2017-Aug-14 at 07:53OpenPano fails at stitching text because it cannot retrieve enough feature points (or keypoints) to do the stitching process.
Text stitching doesn't need a matching method that is robust to rotations but only to translations. OpenCV conveniently offers such a function. It is called : Template Matching.
The solution I will develop is based on this OpenCV's feature.
PipelineI will now explain the main steps of my solution (for further details, please have a look at the code provided bellow).
Matching processIn order to match two consecutive images (done in the matchImages
function, see code bellow):
- We create a template image by taking 45% (
H_templ_ratio
) of the first image as depicted bellow:
This step is done in my code by the function genTemplate
.
- We add black margins to the second image (where we want to find the template). This step is necessary if the text is not aligned in the input images (this is the case on these sample images though). Here is what the image looks like after the margin process. As you can see, the margins are only needed bellow and above the image:
The template image could theoretically be found anywhere in this margined image. This process is done in the addBlackMargins
function.
- We apply a canny filter on both the template image and the image where we want to find it (done inside the
Mat2Edges
function). This will add robustness to the matching process. Here is an example:
- We match the template with the image using
matchTemplate
and we retrieve the best match location with theminMaxLoc
function.
This step consists in calculating the size of the final matrix where we will stitch all the images together. This is particularly needed if all the input images don't have the same height.
This step is done inside the calcFinalImgSize
function. I won't get into to much details here because even though it looks a bit complex (for me at least), this is only simple maths (additions, subtractions, multiplications). Take a pen and paper if you want to understand the formulas.
Once we have the match locations for each input images, we only have to do simple maths to copy the input images in the right spot of the final image. Again, I recommend you to check the code for implementation details (see stitchImages
function).
Here is the result with your input images:
As you can see, the result is not "pixel perfect" but it should be good enough for OCR.
And here is another result with input images of different heights:
Code (Python)My program is written in Python and uses cv2
(OpenCV) and numpy
modules. However it can be ported (easily) in other languages such as C++, Java and C#.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install OpenPano
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page