libraries to CAPTURE panorama in iOS 6 [closed]

2019-01-08 06:48发布

问题:

There are a lot of ways and libraries to show panorama picture in iOS, Although there is a panorama feature in the built-in camera there is no way to use it within an app.

Is there any library I can use to capture a panorama image?

Thanks!

回答1:

These people might sell you a license for a c++ library. Their code goes into the brilliant Autostich app available in the App Store.

Autostitch is based on SIFT image feature detection. SIFT and many other techniques are available in the openCv c++ library. A pre built iOS framework is available from that site.

update

OpenCV has a Stitcher class with mounds of documentation...

OpenCV Stitching pipline

OpenCV Stitcher class

"High level image stitcher. It’s possible to use this class without being aware of the entire stitching pipeline. However, to be able to achieve higher stitching stability and quality of the final images at least being familiar with the theory is recommended (see Stitching pipline )."

update 2

If you haven't used openCV before, the first hurdle is to get the library compiled and installed into your project. Can be tricky, see my questions and answers here (getting openCV installed and working) and here (an example how to keep c++ code separate from objective-c, with sample github project).

When you have openCV working, this should be the quickest way to get started with your query:

Stitcher::stitch(InputArray images, OutputArray pano)

Parameters:
images – Input images.
pano – Final pano.

Then to speed it up - if you have them - provide regions of interest rects (indicating where photos overlap)

Stitcher::stitch(InputArray images, const std::vector<std::vector<Rect>>& rois, OutputArray pano)  

You can dig into the stitching pipeline to optimise many details of the process, but this should be enough to get you started.

If you look in the samples/cpp folder of the openCV distro, you will see a couple of stitching examples, stitching.cpp and stitching_detailed.cpp.

To provide the input images you will want to hook up with the camera and design a decent user interface to assist the user in taking the right kind of pictures (eg with good overlaps).

If you want to look at an existing project using openCV, here is one for android that claims to do what you are after - different platform, but the principles will be the same (using a java interface into the same libraries). Take a look especially at PanoActivity.java.

update 3
I've uploaded a very basic sample to github. I'm impressed how good a job it does, without any optimising or tweaking. It stitches the sample photos in my github project almost as well as the Autostitch app.

update 4 some time later... I've made a new sample project updated for use with Swift and Cocoapods