OpenCV stitching in an Objective-C++ wrapper

For working in iOS, OpenCV provides its usual C++ interface that can be invoked from Objective-C++. In recent years, however, Apple has encouraged iOS application developers to use the more versatile Swift language for building applications and forgo Objective-C. Luckily, a bridge between Swift and Objective-C (and Objective-C++) can be easily created, allowing us to invoke Objective-C functions from Swift. Xcode automates much of the process, and creates the necessary glue code.

To start, we create a new file (Command-N) in Xcode and select Cocoa Touch Class, as shown in the following screenshot:

Choose a meaningful name for the file (for example, StitchingWrapper) and make sure to select Objective-C ...

Get Building Computer Vision Projects with OpenCV 4 and C++ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.