mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 14:13:15 +08:00
Merge pull request #17665 from komakai:fix-ios-dynamic-build
This commit is contained in:
commit
4e6a108bda
@ -2,7 +2,7 @@ set(OPENCV_APPLE_BUNDLE_NAME "OpenCV")
|
||||
set(OPENCV_APPLE_BUNDLE_ID "org.opencv")
|
||||
|
||||
if(IOS)
|
||||
if (APPLE_FRAMEWORK AND BUILD_SHARED_LIBS)
|
||||
if (APPLE_FRAMEWORK AND DYNAMIC_PLIST)
|
||||
configure_file("${OpenCV_SOURCE_DIR}/platforms/ios/Info.Dynamic.plist.in"
|
||||
"${CMAKE_BINARY_DIR}/ios/Info.plist")
|
||||
else()
|
||||
|
@ -10,13 +10,14 @@
|
||||
#ifdef __cplusplus
|
||||
#import <vector>
|
||||
#endif
|
||||
#import "CVObjcUtil.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Utility class to wrap a `std::vector<char>`
|
||||
*/
|
||||
@interface ByteVector : NSObject
|
||||
CV_EXPORTS @interface ByteVector : NSObject
|
||||
|
||||
#pragma mark - Constructors
|
||||
|
||||
|
@ -12,6 +12,14 @@ typedef union { float f; int32_t i; } V32;
|
||||
#define DOUBLE_TO_BITS(x) ((V64){ .d = x }).l
|
||||
#define FLOAT_TO_BITS(x) ((V32){ .f = x }).i
|
||||
|
||||
#ifndef CV_EXPORTS
|
||||
#ifdef __cplusplus
|
||||
#define CV_EXPORTS __attribute__ ((visibility ("default")))
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import <vector>
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import <opencv2/opencv.hpp>
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@ -27,7 +29,7 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface Converters : NSObject
|
||||
CV_EXPORTS @interface Converters : NSObject
|
||||
|
||||
+ (Mat*)vector_Point_to_Mat:(NSArray<Point2i*>*)pts NS_SWIFT_NAME(vector_Point_to_Mat(_:));
|
||||
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@ -15,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Utility functions for handling CvType values
|
||||
*/
|
||||
@interface CvType : NSObject
|
||||
CV_EXPORTS @interface CvType : NSObject
|
||||
|
||||
#pragma mark - Type Utility functions
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@ -18,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
* Structure for matching: query descriptor index, train descriptor index, train
|
||||
* image index and distance between descriptors.
|
||||
*/
|
||||
@interface DMatch : NSObject
|
||||
CV_EXPORTS @interface DMatch : NSObject
|
||||
|
||||
/**
|
||||
* Query descriptor index.
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@ -19,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Simple wrapper for a vector of two `double`
|
||||
*/
|
||||
@interface Double2 : NSObject
|
||||
CV_EXPORTS @interface Double2 : NSObject
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
@ -33,11 +35,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
*/
|
||||
@property double v1;
|
||||
|
||||
/**
|
||||
* Third vector element
|
||||
*/
|
||||
@property double v2;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
/**
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@ -19,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Simple wrapper for a vector of three `double`
|
||||
*/
|
||||
@interface Double3 : NSObject
|
||||
CV_EXPORTS @interface Double3 : NSObject
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
|
@ -10,13 +10,14 @@
|
||||
#ifdef __cplusplus
|
||||
#import <vector>
|
||||
#endif
|
||||
#import "CVObjcUtil.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Utility class to wrap a `std::vector<double>`
|
||||
*/
|
||||
@interface DoubleVector : NSObject
|
||||
CV_EXPORTS @interface DoubleVector : NSObject
|
||||
|
||||
#pragma mark - Constructors
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@ -19,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Simple wrapper for a vector of four `float`
|
||||
*/
|
||||
@interface Float4 : NSObject
|
||||
CV_EXPORTS @interface Float4 : NSObject
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@ -19,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Simple wrapper for a vector of six `float`
|
||||
*/
|
||||
@interface Float6 : NSObject
|
||||
CV_EXPORTS @interface Float6 : NSObject
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
|
@ -10,13 +10,14 @@
|
||||
#ifdef __cplusplus
|
||||
#import <vector>
|
||||
#endif
|
||||
#import "CVObjcUtil.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Utility class to wrap a `std::vector<float>`
|
||||
*/
|
||||
@interface FloatVector : NSObject
|
||||
CV_EXPORTS @interface FloatVector : NSObject
|
||||
|
||||
#pragma mark - Constructors
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@ -19,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Simple wrapper for a vector of four `int`
|
||||
*/
|
||||
@interface Int4 : NSObject
|
||||
CV_EXPORTS @interface Int4 : NSObject
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
|
@ -10,13 +10,14 @@
|
||||
#ifdef __cplusplus
|
||||
#import <vector>
|
||||
#endif
|
||||
#import "CVObjcUtil.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Utility class to wrap a `std::vector<int>`
|
||||
*/
|
||||
@interface IntVector : NSObject
|
||||
CV_EXPORTS @interface IntVector : NSObject
|
||||
|
||||
#pragma mark - Constructors
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@ -18,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Object representing a point feature found by one of many available keypoint detectors, such as Harris corner detector, FAST, StarDetector, SURF, SIFT etc.
|
||||
*/
|
||||
@interface KeyPoint : NSObject
|
||||
CV_EXPORTS @interface KeyPoint : NSObject
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@ -23,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* The class Mat represents an n-dimensional dense numerical single-channel or multi-channel array.
|
||||
*/
|
||||
@interface Mat : NSObject
|
||||
CV_EXPORTS @interface Mat : NSObject
|
||||
|
||||
#ifdef __cplusplus
|
||||
@property(readonly) cv::Ptr<cv::Mat> nativePtr;
|
||||
|
@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Mat representation of an array of bytes
|
||||
*/
|
||||
@interface MatOfByte : Mat
|
||||
CV_EXPORTS @interface MatOfByte : Mat
|
||||
|
||||
#pragma mark - Constructors
|
||||
|
||||
|
@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Mat representation of an array of DMatch objects
|
||||
*/
|
||||
@interface MatOfDMatch : Mat
|
||||
CV_EXPORTS @interface MatOfDMatch : Mat
|
||||
|
||||
#pragma mark - Constructors
|
||||
|
||||
|
@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Mat representation of an array of doubles
|
||||
*/
|
||||
@interface MatOfDouble : Mat
|
||||
CV_EXPORTS @interface MatOfDouble : Mat
|
||||
|
||||
#pragma mark - Constructors
|
||||
|
||||
|
@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Mat representation of an array of floats
|
||||
*/
|
||||
@interface MatOfFloat : Mat
|
||||
CV_EXPORTS @interface MatOfFloat : Mat
|
||||
|
||||
#ifdef __cplusplus
|
||||
- (instancetype)initWithNativeMat:(cv::Mat*)nativeMat;
|
||||
|
@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Mat representation of an array of vectors of four floats
|
||||
*/
|
||||
@interface MatOfFloat4 : Mat
|
||||
CV_EXPORTS @interface MatOfFloat4 : Mat
|
||||
|
||||
#pragma mark - Constructors
|
||||
|
||||
|
@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Mat representation of an array of vectors of six floats
|
||||
*/
|
||||
@interface MatOfFloat6 : Mat
|
||||
CV_EXPORTS @interface MatOfFloat6 : Mat
|
||||
|
||||
#pragma mark - Constructors
|
||||
|
||||
|
@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Mat representation of an array of ints
|
||||
*/
|
||||
@interface MatOfInt : Mat
|
||||
CV_EXPORTS @interface MatOfInt : Mat
|
||||
|
||||
#pragma mark - Constructors
|
||||
|
||||
|
@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Mat representation of an array of vectors of four ints
|
||||
*/
|
||||
@interface MatOfInt4 : Mat
|
||||
CV_EXPORTS @interface MatOfInt4 : Mat
|
||||
|
||||
#pragma mark - Constructors
|
||||
|
||||
|
@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Mat representation of an array of KeyPoint objects
|
||||
*/
|
||||
@interface MatOfKeyPoint : Mat
|
||||
CV_EXPORTS @interface MatOfKeyPoint : Mat
|
||||
|
||||
#pragma mark - Constructors
|
||||
|
||||
|
@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Mat representation of an array of Point2f objects
|
||||
*/
|
||||
@interface MatOfPoint2f : Mat
|
||||
CV_EXPORTS @interface MatOfPoint2f : Mat
|
||||
|
||||
#pragma mark - Constructors
|
||||
|
||||
|
@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
* Mat representation of an array of Point objects
|
||||
*/
|
||||
NS_SWIFT_NAME(MatOfPoint)
|
||||
@interface MatOfPoint2i : Mat
|
||||
CV_EXPORTS @interface MatOfPoint2i : Mat
|
||||
|
||||
#pragma mark - Constructors
|
||||
|
||||
|
@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Mat representation of an array of Point3i objects
|
||||
*/
|
||||
@interface MatOfPoint3 : Mat
|
||||
CV_EXPORTS @interface MatOfPoint3 : Mat
|
||||
|
||||
#pragma mark - Constructors
|
||||
|
||||
|
@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Mat representation of an array of Point3f objects
|
||||
*/
|
||||
@interface MatOfPoint3f : Mat
|
||||
CV_EXPORTS @interface MatOfPoint3f : Mat
|
||||
|
||||
#pragma mark - Constructors
|
||||
|
||||
|
@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Mat representation of an array of Rect2d objects
|
||||
*/
|
||||
@interface MatOfRect2d : Mat
|
||||
CV_EXPORTS @interface MatOfRect2d : Mat
|
||||
|
||||
#pragma mark - Constructors
|
||||
|
||||
|
@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
* Mat representation of an array of Rect objects
|
||||
*/
|
||||
NS_SWIFT_NAME(MatOfRect)
|
||||
@interface MatOfRect2i : Mat
|
||||
CV_EXPORTS @interface MatOfRect2i : Mat
|
||||
|
||||
#pragma mark - Constructors
|
||||
|
||||
|
@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Mat representation of an array of RotatedRect objects
|
||||
*/
|
||||
@interface MatOfRotatedRect : Mat
|
||||
CV_EXPORTS @interface MatOfRotatedRect : Mat
|
||||
|
||||
#pragma mark - Constructors
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@ -19,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Result of operation to determine global minimum and maximum of an array
|
||||
*/
|
||||
@interface MinMaxLocResult : NSObject
|
||||
CV_EXPORTS @interface MinMaxLocResult : NSObject
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@ -19,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Represents a two dimensional point the coordinate values of which are of type `double`
|
||||
*/
|
||||
@interface Point2d : NSObject
|
||||
CV_EXPORTS @interface Point2d : NSObject
|
||||
|
||||
# pragma mark - Properties
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@ -19,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Represents a two dimensional point the coordinate values of which are of type `float`
|
||||
*/
|
||||
@interface Point2f : NSObject
|
||||
CV_EXPORTS @interface Point2f : NSObject
|
||||
|
||||
# pragma mark - Properties
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@ -20,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
* Represents a two dimensional point the coordinate values of which are of type `int`
|
||||
*/
|
||||
NS_SWIFT_NAME(Point)
|
||||
@interface Point2i : NSObject
|
||||
CV_EXPORTS @interface Point2i : NSObject
|
||||
|
||||
# pragma mark - Properties
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@ -19,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Represents a three dimensional point the coordinate values of which are of type `double`
|
||||
*/
|
||||
@interface Point3d : NSObject
|
||||
CV_EXPORTS @interface Point3d : NSObject
|
||||
|
||||
# pragma mark - Properties
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@ -19,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Represents a three dimensional point the coordinate values of which are of type `float`
|
||||
*/
|
||||
@interface Point3f : NSObject
|
||||
CV_EXPORTS @interface Point3f : NSObject
|
||||
|
||||
# pragma mark - Properties
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@ -19,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Represents a three dimensional point the coordinate values of which are of type `int`
|
||||
*/
|
||||
@interface Point3i : NSObject
|
||||
CV_EXPORTS @interface Point3i : NSObject
|
||||
|
||||
# pragma mark - Properties
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@ -17,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Represents a range of dimension indices
|
||||
*/
|
||||
@interface Range : NSObject
|
||||
CV_EXPORTS @interface Range : NSObject
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
@class Point2d;
|
||||
@ -20,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Represents a rectange the coordinate and dimension values of which are of type `double`
|
||||
*/
|
||||
@interface Rect2d : NSObject
|
||||
CV_EXPORTS @interface Rect2d : NSObject
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
@class Point2f;
|
||||
@ -20,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Represents a rectange the coordinate and dimension values of which are of type `float`
|
||||
*/
|
||||
@interface Rect2f : NSObject
|
||||
CV_EXPORTS @interface Rect2f : NSObject
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
@class Point2i;
|
||||
@ -21,7 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
* Represents a rectange the coordinate and dimension values of which are of type `int`
|
||||
*/
|
||||
NS_SWIFT_NAME(Rect)
|
||||
@interface Rect2i : NSObject
|
||||
CV_EXPORTS @interface Rect2i : NSObject
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
@class Point2f;
|
||||
@ -21,7 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Represents a rotated rectangle on a plane
|
||||
*/
|
||||
@interface RotatedRect : NSObject
|
||||
CV_EXPORTS @interface RotatedRect : NSObject
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@ -17,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Represents a four element vector
|
||||
*/
|
||||
@interface Scalar : NSObject
|
||||
CV_EXPORTS @interface Scalar : NSObject
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
@class Point2d;
|
||||
@ -19,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Represents the dimensions of a rectangle the values of which are of type `double`
|
||||
*/
|
||||
@interface Size2d : NSObject
|
||||
CV_EXPORTS @interface Size2d : NSObject
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
@class Point2f;
|
||||
@ -19,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Represents the dimensions of a rectangle the values of which are of type `float`
|
||||
*/
|
||||
@interface Size2f : NSObject
|
||||
CV_EXPORTS @interface Size2f : NSObject
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
@class Point2i;
|
||||
@ -20,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
* Represents the dimensions of a rectangle the values of which are of type `int`
|
||||
*/
|
||||
NS_SWIFT_NAME(Size)
|
||||
@interface Size2i : NSObject
|
||||
CV_EXPORTS @interface Size2i : NSObject
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@ -17,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Class representing termination criteria for iterative algorithms.
|
||||
*/
|
||||
@interface TermCriteria : NSObject
|
||||
CV_EXPORTS @interface TermCriteria : NSObject
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@ -16,7 +18,7 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface Mat (Converters)
|
||||
CV_EXPORTS @interface Mat (Converters)
|
||||
|
||||
-(UIImage*)toUIImage;
|
||||
-(instancetype)initWithUIImage:(UIImage*)image;
|
||||
|
@ -8,13 +8,15 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface Moments : NSObject
|
||||
CV_EXPORTS @interface Moments : NSObject
|
||||
|
||||
@property double m00;
|
||||
@property double m10;
|
||||
|
@ -8,7 +8,7 @@ set(MODULES "$modules")
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
set (CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||
|
||||
set (OBJC_COMPILE_FLAGS "-fobjc-arc -fobjc-weak -fvisibility=hidden -D__OPENCV_BUILD=1")
|
||||
set (OBJC_COMPILE_FLAGS "-fobjc-arc -fobjc-weak -fvisibility=hidden -fPIC -D__OPENCV_BUILD=1")
|
||||
set (SUPPRESS_WARNINGS_FLAGS "-Wno-incomplete-umbrella")
|
||||
set (CMAKE_CXX_FLAGS "$${CMAKE_CXX_FLAGS} $${OBJC_COMPILE_FLAGS} $${SUPPRESS_WARNINGS_FLAGS}")
|
||||
|
||||
|
@ -6,6 +6,8 @@
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
$additionalImports
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@ -18,7 +20,7 @@ $enumDeclarations
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
$docs
|
||||
@interface $objcName : $base
|
||||
CV_EXPORTS @interface $objcName : $base
|
||||
|
||||
$nativePointerHandling
|
||||
|
||||
|
@ -6,6 +6,8 @@
|
||||
#ifdef __cplusplus
|
||||
#import "opencv.hpp"
|
||||
$additionalImports
|
||||
#else
|
||||
#define CV_EXPORTS
|
||||
#endif
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@ -17,7 +19,7 @@ $enumDeclarations
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
$docs
|
||||
@interface $module : $base
|
||||
CV_EXPORTS @interface $module : $base
|
||||
|
||||
$methodDeclarations
|
||||
|
||||
|
@ -8,12 +8,13 @@
|
||||
#import <Accelerate/Accelerate.h>
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
#import <ImageIO/ImageIO.h>
|
||||
#import "CVObjcUtil.h"
|
||||
|
||||
@class Mat;
|
||||
|
||||
@class CvAbstractCamera2;
|
||||
|
||||
@interface CvAbstractCamera2 : NSObject
|
||||
CV_EXPORTS @interface CvAbstractCamera2 : NSObject
|
||||
|
||||
@property UIDeviceOrientation currentDeviceOrientation;
|
||||
@property BOOL cameraAvailable;
|
||||
@ -55,7 +56,7 @@
|
||||
- (void)processImage:(Mat*)image;
|
||||
@end
|
||||
|
||||
@interface CvVideoCamera2 : CvAbstractCamera2<AVCaptureVideoDataOutputSampleBufferDelegate>
|
||||
CV_EXPORTS @interface CvVideoCamera2 : CvAbstractCamera2<AVCaptureVideoDataOutputSampleBufferDelegate>
|
||||
@property (nonatomic, weak) id<CvVideoCameraDelegate2> delegate;
|
||||
@property (nonatomic, assign) BOOL grayscaleMode;
|
||||
@property (nonatomic, assign) BOOL recordVideo;
|
||||
@ -78,7 +79,7 @@
|
||||
- (void)photoCameraCancel:(CvPhotoCamera2*)photoCamera;
|
||||
@end
|
||||
|
||||
@interface CvPhotoCamera2 : CvAbstractCamera2<AVCapturePhotoCaptureDelegate>
|
||||
CV_EXPORTS @interface CvPhotoCamera2 : CvAbstractCamera2<AVCapturePhotoCaptureDelegate>
|
||||
@property (nonatomic, weak) id<CvPhotoCameraDelegate2> delegate;
|
||||
- (void)takePicture;
|
||||
@end
|
||||
|
@ -5,7 +5,7 @@
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>opencv2</string>
|
||||
<string>${FRAMEWORK_NAME}</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${OPENCV_APPLE_BUNDLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
|
@ -49,6 +49,14 @@ def getXCodeMajor():
|
||||
else:
|
||||
raise Exception("Failed to parse Xcode version")
|
||||
|
||||
def getXCodeSetting(var, projectdir):
|
||||
ret = check_output(["xcodebuild", "-showBuildSettings"], cwd = projectdir)
|
||||
m = re.search("\s" + var + " = (.*)", ret)
|
||||
if m:
|
||||
return m.group(1)
|
||||
else:
|
||||
raise Exception("Failed to parse Xcode settings")
|
||||
|
||||
class Builder:
|
||||
def __init__(self, opencv, contrib, dynamic, bitcodedisabled, exclude, disable, enablenonfree, targets, debug, debug_info, framework_name):
|
||||
self.opencv = os.path.abspath(opencv)
|
||||
@ -90,7 +98,7 @@ class Builder:
|
||||
|
||||
xcode_ver = getXCodeMajor()
|
||||
|
||||
if self.dynamic:
|
||||
if self.dynamic and not self.build_objc_wrapper:
|
||||
alltargets = self.targets
|
||||
else:
|
||||
# if we are building a static library, we must build each architecture separately
|
||||
@ -114,8 +122,10 @@ class Builder:
|
||||
cmake_flags.append("-DCMAKE_CXX_FLAGS=-fembed-bitcode")
|
||||
self.buildOne(t[0], t[1], mainBD, cmake_flags)
|
||||
|
||||
if self.dynamic == False:
|
||||
if not self.dynamic:
|
||||
self.mergeLibs(mainBD)
|
||||
elif self.dynamic and self.build_objc_wrapper:
|
||||
self.makeDynamicLib(mainBD)
|
||||
self.makeFramework(outdir, dirs)
|
||||
if self.build_objc_wrapper:
|
||||
print("To run tests call:")
|
||||
@ -153,6 +163,8 @@ class Builder:
|
||||
"-DBUILD_SHARED_LIBS=ON",
|
||||
"-DCMAKE_MACOSX_BUNDLE=ON",
|
||||
"-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED=NO",
|
||||
] if self.dynamic and not self.build_objc_wrapper else []) + ([
|
||||
"-DDYNAMIC_PLIST=ON"
|
||||
] if self.dynamic else []) + ([
|
||||
"-DOPENCV_ENABLE_NONFREE=ON"
|
||||
] if self.enablenonfree else []) + ([
|
||||
@ -160,7 +172,7 @@ class Builder:
|
||||
] if self.debug_info else [])
|
||||
|
||||
if len(self.exclude) > 0:
|
||||
args += ["-DBUILD_opencv_world=OFF"] if not self.dynamic else []
|
||||
args += ["-DBUILD_opencv_world=OFF"] if not (self.dynamic and not self.build_objc_wrapper) else []
|
||||
args += ["-DBUILD_opencv_%s=OFF" % m for m in self.exclude]
|
||||
|
||||
if len(self.disable) > 0:
|
||||
@ -174,15 +186,15 @@ class Builder:
|
||||
"xcodebuild",
|
||||
]
|
||||
|
||||
if self.dynamic:
|
||||
if (self.dynamic or self.build_objc_wrapper) and not self.bitcodedisabled and target == "iPhoneOS":
|
||||
buildcmd.append("BITCODE_GENERATION_MODE=bitcode")
|
||||
|
||||
if self.dynamic and not self.build_objc_wrapper:
|
||||
buildcmd += [
|
||||
"IPHONEOS_DEPLOYMENT_TARGET=" + os.environ['IPHONEOS_DEPLOYMENT_TARGET'],
|
||||
"ONLY_ACTIVE_ARCH=NO",
|
||||
]
|
||||
|
||||
if not self.bitcodedisabled:
|
||||
buildcmd.append("BITCODE_GENERATION_MODE=bitcode")
|
||||
|
||||
for arch in archs:
|
||||
buildcmd.append("-arch")
|
||||
buildcmd.append(arch.lower())
|
||||
@ -198,7 +210,7 @@ class Builder:
|
||||
"-configuration", self.getConfiguration(),
|
||||
"-parallelizeTargets",
|
||||
"-jobs", str(multiprocessing.cpu_count()),
|
||||
] + (["-target","ALL_BUILD"] if self.dynamic else [])
|
||||
] + (["-target","ALL_BUILD"] if self.dynamic and not self.build_objc_wrapper else [])
|
||||
|
||||
return buildcmd
|
||||
|
||||
@ -253,6 +265,32 @@ class Builder:
|
||||
print("Merging libraries:\n\t%s" % "\n\t".join(libs + libs3 + module), file=sys.stderr)
|
||||
execute(["libtool", "-static", "-o", res] + libs + libs3 + module)
|
||||
|
||||
def makeDynamicLib(self, builddir):
|
||||
target = builddir[(builddir.rfind("build-") + 6):]
|
||||
target_platform = target[(target.rfind("-") + 1):]
|
||||
is_device = target_platform == "iphoneos"
|
||||
res = os.path.join(builddir, "install", "lib", self.framework_name + ".framework", self.framework_name)
|
||||
libs = glob.glob(os.path.join(builddir, "install", "lib", "*.a"))
|
||||
module = [os.path.join(builddir, "lib", self.getConfiguration(), self.framework_name + ".framework", self.framework_name)]
|
||||
|
||||
libs3 = glob.glob(os.path.join(builddir, "install", "lib", "3rdparty", "*.a"))
|
||||
|
||||
link_target = target[:target.find("-")] + "-apple-ios" + os.environ['IPHONEOS_DEPLOYMENT_TARGET'] + ("-simulator" if target.endswith("simulator") else "")
|
||||
bitcode_flags = ["-fembed-bitcode", "-Xlinker", "-bitcode_verify"] if is_device and not self.bitcodedisabled else []
|
||||
toolchain_dir = getXCodeSetting("TOOLCHAIN_DIR", builddir)
|
||||
swift_link_dirs = ["-L" + toolchain_dir + "/usr/lib/swift/" + target_platform, "-L/usr/lib/swift"]
|
||||
sdk_dir = getXCodeSetting("SDK_DIR", builddir)
|
||||
execute([
|
||||
"clang++",
|
||||
"-Xlinker", "-rpath",
|
||||
"-Xlinker", "/usr/lib/swift",
|
||||
"-target", link_target,
|
||||
"-isysroot", sdk_dir,
|
||||
"-install_name", ("@executable_path/Frameworks/" + self.framework_name + ".framework/" + self.framework_name) if is_device else res,
|
||||
"-dynamiclib", "-dead_strip", "-fobjc-link-runtime", "-all_load",
|
||||
"-o", res
|
||||
] + swift_link_dirs + bitcode_flags + module + libs + libs3)
|
||||
|
||||
def makeFramework(self, outdir, builddirs):
|
||||
name = self.framework_name
|
||||
|
||||
@ -264,10 +302,8 @@ class Builder:
|
||||
|
||||
if self.dynamic:
|
||||
dstdir = framework_dir
|
||||
libname = name + ".framework/" + name
|
||||
else:
|
||||
dstdir = os.path.join(framework_dir, "Versions", "A")
|
||||
libname = "libopencv_merged.a"
|
||||
|
||||
# copy headers from one of build folders
|
||||
shutil.copytree(os.path.join(builddirs[0], "install", "include", "opencv2"), os.path.join(dstdir, "Headers"))
|
||||
@ -301,7 +337,10 @@ class Builder:
|
||||
os.rename(os.path.join(dirname, filename), os.path.join(dirname, platform_name_map[filestem] + fileext))
|
||||
|
||||
# make universal static lib
|
||||
libs = [os.path.join(d, "lib", self.getConfiguration(), libname) for d in builddirs]
|
||||
if self.dynamic:
|
||||
libs = [os.path.join(d, "install", "lib", name + ".framework", name) for d in builddirs]
|
||||
else:
|
||||
libs = [os.path.join(d, "lib", self.getConfiguration(), "libopencv_merged.a") for d in builddirs]
|
||||
lipocmd = ["lipo", "-create"]
|
||||
lipocmd.extend(libs)
|
||||
lipocmd.extend(["-o", os.path.join(dstdir, name)])
|
||||
@ -412,4 +451,5 @@ if __name__ == "__main__":
|
||||
(iphoneos_archs, "iPhoneOS"),
|
||||
(iphonesimulator_archs, "iPhoneSimulator"),
|
||||
], args.debug, args.debug_info, args.framework_name)
|
||||
|
||||
b.build(args.out)
|
||||
|
Loading…
Reference in New Issue
Block a user