├── .DS_Store ├── .gitattributes ├── AppDelegate.swift ├── Assets.xcassets ├── AppIcon.appiconset │ └── Contents.json └── defaultImage.imageset │ ├── Contents.json │ ├── Image-692x692.png │ ├── Image-692x692@2x.png │ └── Image-692x692@3x.png ├── Base.lproj ├── LaunchScreen.storyboard └── Main.storyboard ├── CameraKitSDK.framework ├── CameraKitSDK ├── Headers │ ├── CameraKitSDK.h │ └── DRCameraKit.h ├── Resources │ └── Info.plist └── Versions │ ├── A │ ├── CameraKitSDK │ ├── Headers │ │ ├── CameraKitSDK.h │ │ └── DRCameraKit.h │ └── Resources │ │ └── Info.plist │ └── Current │ ├── CameraKitSDK │ ├── Headers │ ├── CameraKitSDK.h │ └── DRCameraKit.h │ └── Resources │ └── Info.plist ├── CoreML ├── BodyPart.swift ├── CocoPairs.swift ├── Human.swift ├── MobileOpenPose.mlmodel └── PoseEstimatior.swift ├── DoubleControlSDK.framework ├── DoubleControlSDK ├── Headers │ ├── DRDouble.h │ └── DoubleControlSDK.h ├── Resources │ └── Info.plist └── Versions │ ├── A │ ├── DoubleControlSDK │ ├── Headers │ │ ├── DRDouble.h │ │ └── DoubleControlSDK.h │ └── Resources │ │ └── Info.plist │ └── Current │ ├── DoubleControlSDK │ ├── Headers │ ├── DRDouble.h │ └── DoubleControlSDK.h │ └── Resources │ └── Info.plist ├── Info.plist ├── Libraries ├── CoreMLHelpers │ ├── Array.swift │ ├── CVPixelBuffer+Helpers.swift │ ├── MLMultiArray+Image.swift │ ├── Math.swift │ ├── MultiArray.swift │ ├── NonMaxSuppression.swift │ ├── Predictions.swift │ └── UIImage+CVPixelBuffer.swift ├── IteratorTools │ ├── Accumulate.swift │ ├── AnyIterator.swift │ ├── Chain.swift │ ├── Combinations.swift │ ├── Compress.swift │ ├── Counter.swift │ ├── Cycle.swift │ ├── Grouped.swift │ ├── Permutations.swift │ ├── Product.swift │ ├── Reject.swift │ ├── Repeater.swift │ ├── Tee.swift │ └── ZipToLongest.swift └── Upsurge │ ├── 2DTensorSlice.swift │ ├── Arithmetic.swift │ ├── Auxiliary.swift │ ├── Complex.swift │ ├── ComplexArithmetic.swift │ ├── ComplexArray.swift │ ├── ComplexArrayRealSlice.swift │ ├── ComplexArraySlice.swift │ ├── DSP.swift │ ├── Exponential.swift │ ├── FFT.swift │ ├── Hyperbolic.swift │ ├── Interval.swift │ ├── LinearOperators.swift │ ├── LinearType.swift │ ├── Matrix.swift │ ├── MatrixArithmetic.swift │ ├── MatrixSlice.swift │ ├── PointerUtilities.swift │ ├── QuadraticType.swift │ ├── Real.swift │ ├── Sequence.swift │ ├── Span.swift │ ├── Tensor.swift │ ├── TensorSlice.swift │ ├── TensorType.swift │ ├── Trigonometric.swift │ ├── Value.swift │ ├── ValueArray.swift │ └── ValueArraySlice.swift ├── OpenCV ├── OpenCVWrapper.h ├── OpenCVWrapper.mm └── ios_conversions.mm ├── README.md ├── Supporting Files └── monaco.ttf ├── Utils ├── CameraHelper.m ├── CameraTool.swift ├── Collection Extensions.swift └── UIImage + Extensions.swift ├── ViewController.swift ├── demo1.png ├── demo2.png ├── demo3.png ├── demo4.jpg ├── demogif.gif ├── iOSOpenPose Loop Experiments-Bridging-Header.h └── opencv2.framework ├── .DS_Store ├── Headers ├── OpenCV-umbrella.h ├── calib3d.hpp ├── calib3d │ ├── calib3d.hpp │ └── calib3d_c.h ├── core.hpp ├── core │ ├── affine.hpp │ ├── base.hpp │ ├── bufferpool.hpp │ ├── core.hpp │ ├── core_c.h │ ├── cuda.hpp │ ├── cuda.inl.hpp │ ├── cuda_stream_accessor.hpp │ ├── cuda_types.hpp │ ├── cv_cpu_dispatch.h │ ├── cv_cpu_helper.h │ ├── cvdef.h │ ├── cvstd.hpp │ ├── cvstd.inl.hpp │ ├── directx.hpp │ ├── eigen.hpp │ ├── fast_math.hpp │ ├── hal │ │ ├── hal.hpp │ │ ├── interface.h │ │ ├── intrin.hpp │ │ ├── intrin_cpp.hpp │ │ ├── intrin_neon.hpp │ │ ├── intrin_sse.hpp │ │ └── intrin_vsx.hpp │ ├── ippasync.hpp │ ├── mat.hpp │ ├── mat.inl.hpp │ ├── matx.hpp │ ├── neon_utils.hpp │ ├── ocl.hpp │ ├── ocl_genbase.hpp │ ├── opengl.hpp │ ├── operations.hpp │ ├── optim.hpp │ ├── ovx.hpp │ ├── persistence.hpp │ ├── ptr.inl.hpp │ ├── saturate.hpp │ ├── softfloat.hpp │ ├── sse_utils.hpp │ ├── traits.hpp │ ├── types.hpp │ ├── types_c.h │ ├── utility.hpp │ ├── utils │ │ ├── logger.hpp │ │ └── trace.hpp │ ├── va_intel.hpp │ ├── version.hpp │ ├── vsx_utils.hpp │ └── wimage.hpp ├── cvconfig.h ├── dnn.hpp ├── dnn │ ├── all_layers.hpp │ ├── dict.hpp │ ├── dnn.hpp │ ├── dnn.inl.hpp │ ├── layer.details.hpp │ ├── layer.hpp │ └── shape_utils.hpp ├── features2d.hpp ├── features2d │ └── features2d.hpp ├── flann.hpp ├── flann │ ├── all_indices.h │ ├── allocator.h │ ├── any.h │ ├── autotuned_index.h │ ├── composite_index.h │ ├── config.h │ ├── defines.h │ ├── dist.h │ ├── dummy.h │ ├── dynamic_bitset.h │ ├── flann.hpp │ ├── flann_base.hpp │ ├── general.h │ ├── ground_truth.h │ ├── hdf5.h │ ├── heap.h │ ├── hierarchical_clustering_index.h │ ├── index_testing.h │ ├── kdtree_index.h │ ├── kdtree_single_index.h │ ├── kmeans_index.h │ ├── linear_index.h │ ├── logger.h │ ├── lsh_index.h │ ├── lsh_table.h │ ├── matrix.h │ ├── miniflann.hpp │ ├── nn_index.h │ ├── object_factory.h │ ├── params.h │ ├── random.h │ ├── result_set.h │ ├── sampling.h │ ├── saving.h │ ├── simplex_downhill.h │ └── timer.h ├── highgui.hpp ├── highgui │ ├── highgui.hpp │ └── highgui_c.h ├── imgcodecs.hpp ├── imgcodecs │ ├── imgcodecs.hpp │ ├── imgcodecs_c.h │ └── ios.h ├── imgproc.hpp ├── imgproc │ ├── detail │ │ └── distortion_model.hpp │ ├── hal │ │ ├── hal.hpp │ │ └── interface.h │ ├── imgproc.hpp │ ├── imgproc_c.h │ └── types_c.h ├── ml.hpp ├── ml │ └── ml.hpp ├── objdetect.hpp ├── objdetect │ ├── detection_based_tracker.hpp │ ├── objdetect.hpp │ └── objdetect_c.h ├── opencv.hpp ├── opencv_modules.hpp ├── photo.hpp ├── photo │ ├── cuda.hpp │ ├── photo.hpp │ └── photo_c.h ├── shape.hpp ├── shape │ ├── emdL1.hpp │ ├── hist_cost.hpp │ ├── shape.hpp │ ├── shape_distance.hpp │ └── shape_transformer.hpp ├── stitching.hpp ├── stitching │ ├── detail │ │ ├── autocalib.hpp │ │ ├── blenders.hpp │ │ ├── camera.hpp │ │ ├── exposure_compensate.hpp │ │ ├── matchers.hpp │ │ ├── motion_estimators.hpp │ │ ├── seam_finders.hpp │ │ ├── timelapsers.hpp │ │ ├── util.hpp │ │ ├── util_inl.hpp │ │ ├── warpers.hpp │ │ └── warpers_inl.hpp │ └── warpers.hpp ├── video.hpp ├── video │ ├── background_segm.hpp │ ├── tracking.hpp │ ├── tracking_c.h │ └── video.hpp ├── videoio.hpp ├── videoio │ ├── cap_ios.h │ ├── videoio.hpp │ └── videoio_c.h ├── videostab.hpp ├── videostab │ ├── deblurring.hpp │ ├── fast_marching.hpp │ ├── fast_marching_inl.hpp │ ├── frame_source.hpp │ ├── global_motion.hpp │ ├── inpainting.hpp │ ├── log.hpp │ ├── motion_core.hpp │ ├── motion_stabilizing.hpp │ ├── optical_flow.hpp │ ├── outlier_rejection.hpp │ ├── ring_buffer.hpp │ ├── stabilizer.hpp │ └── wobble_suppression.hpp └── world.hpp ├── Info.plist ├── Modules └── module.modulemap └── opencv2 /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/.DS_Store -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | 2 | *.m linguist-language=swift 3 | *.h linguist-language=swift 4 | *.swift linguist-language=swift 5 | *.cpp linguist-language=swift 6 | *.c linguist-language=swift 7 | *.hpp linguist-language=swift 8 | -------------------------------------------------------------------------------- /AppDelegate.swift: -------------------------------------------------------------------------------- 1 | 2 | 3 | import UIKit 4 | 5 | @UIApplicationMain 6 | class AppDelegate: UIResponder, UIApplicationDelegate { 7 | 8 | var window: UIWindow? 9 | 10 | 11 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 12 | // Override point for customization after application launch. 13 | return true 14 | } 15 | 16 | func applicationWillResignActive(_ application: UIApplication) { 17 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 18 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 19 | } 20 | 21 | func applicationDidEnterBackground(_ application: UIApplication) { 22 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 23 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 24 | } 25 | 26 | func applicationWillEnterForeground(_ application: UIApplication) { 27 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 28 | } 29 | 30 | func applicationDidBecomeActive(_ application: UIApplication) { 31 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 32 | } 33 | 34 | func applicationWillTerminate(_ application: UIApplication) { 35 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 36 | } 37 | 38 | 39 | } 40 | 41 | -------------------------------------------------------------------------------- /Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info":{ 3 | "version":1, 4 | "author":"makeappicon" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Assets.xcassets/defaultImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "Image-692x692.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "Image-692x692@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "Image-692x692@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /Assets.xcassets/defaultImage.imageset/Image-692x692.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/Assets.xcassets/defaultImage.imageset/Image-692x692.png -------------------------------------------------------------------------------- /Assets.xcassets/defaultImage.imageset/Image-692x692@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/Assets.xcassets/defaultImage.imageset/Image-692x692@2x.png -------------------------------------------------------------------------------- /Assets.xcassets/defaultImage.imageset/Image-692x692@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/Assets.xcassets/defaultImage.imageset/Image-692x692@3x.png -------------------------------------------------------------------------------- /Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /CameraKitSDK.framework/CameraKitSDK: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/CameraKitSDK.framework/CameraKitSDK -------------------------------------------------------------------------------- /CameraKitSDK.framework/Headers/CameraKitSDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // CameraKitSDK.h 3 | // Double Camera Kit SDK 4 | // 5 | // Created by David Cann on 8/3/13. 6 | // Copyright (c) 2013 Double Robotics, Inc. All rights reserved. 7 | // 8 | 9 | #ifndef Double_Basic_Example_CameraKitSDK_h 10 | #define Double_Basic_Example_CameraKitSDK_h 11 | 12 | #import "DRCameraKit.h" 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /CameraKitSDK.framework/Headers/DRCameraKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // DRCameraKit.h 3 | // Camera Kit SDK 4 | // 5 | // Created by David Cann on 11/12/11. 6 | // Copyright (c) 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | #define kCameraKitSDKVersion @"0.1" 13 | 14 | @class DRCameraKit; 15 | 16 | @protocol DRCameraKitConnectionDelegate 17 | - (void)cameraKitConnectionStatusDidChange:(DRCameraKit *)theKit; 18 | @end 19 | 20 | @protocol DRCameraKitImageDelegate 21 | - (void)cameraKit:(DRCameraKit *)theKit didReceiveImage:(UIImage *)theImage sizeInBytes:(NSInteger)length; 22 | @end 23 | 24 | @protocol DRCameraKitControlDelegate 25 | - (void)cameraKitReceivedStatusUpdate:(DRCameraKit *)theKit; 26 | @end 27 | 28 | typedef struct { 29 | unsigned int reg; 30 | unsigned char value; 31 | } cameraSetting; 32 | 33 | @interface DRCameraKit : NSObject 34 | 35 | extern NSString *const kCameraKitVideoProtocolString; 36 | extern NSString *const kCameraKitControlProtocolString; 37 | 38 | extern const cameraSetting kCameraSettingsFullRes_15FPS[]; 39 | extern const cameraSetting kCameraSettingsFullRes_15FPS_low[]; 40 | extern const cameraSetting kCameraSettings1280x960_30FPS[]; 41 | extern const cameraSetting kCameraSettings640x480_30FPS[]; 42 | extern const cameraSetting kCameraSettings640x480_30FPS_low[]; 43 | extern const cameraSetting kCameraSettings1280x960_15FPS_ISP[]; 44 | extern const cameraSetting kCameraSettings640x480_15FPS_ISP[]; 45 | extern const cameraSetting kCameraSettings640x480_15FPS_ISP_low[]; 46 | 47 | @property (nonatomic, weak) id connectionDelegate; 48 | @property (nonatomic, weak) id imageDelegate; 49 | @property (nonatomic, weak) id controlDelegate; 50 | @property (nonatomic, readonly) BOOL videoIsStreaming; 51 | @property (nonatomic) NSInteger firmwareVersion; 52 | 53 | #pragma mark - Singleton 54 | + (DRCameraKit *)sharedCameraKit; 55 | 56 | #pragma mark - Setup 57 | - (BOOL)isConnected; 58 | - (void)disconnect; 59 | - (void)connectToAccessory:(EAAccessory *)theAccessory; 60 | - (void)startVideo; 61 | - (void)stopVideo; 62 | - (void)setCameraSettingsWithArray:(cameraSetting*)settings; 63 | - (void)setCameraSetting:(unsigned int)reg value:(unsigned char)value; 64 | - (void)startCharging; 65 | - (void)stopCharging; 66 | - (void)setLED:(UIColor*)color; 67 | - (void)fadeLEDtoColor:(UIColor*)color overTime:(NSInteger)millis; 68 | - (void)requestStatus; 69 | - (NSString *)iAPFirmwareVersion; 70 | - (NSString *)iAPSerialNumber; 71 | - (NSString *)iAPHardwareRevision; 72 | - (cameraSetting *)lastCameraSetting; 73 | - (BOOL)needsOverscanCrop; 74 | - (CGSize)sizeForCameraSetting:(cameraSetting *)theSetting; 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /CameraKitSDK.framework/Resources/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/CameraKitSDK.framework/Resources/Info.plist -------------------------------------------------------------------------------- /CameraKitSDK.framework/Versions/A/CameraKitSDK: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/CameraKitSDK.framework/Versions/A/CameraKitSDK -------------------------------------------------------------------------------- /CameraKitSDK.framework/Versions/A/Headers/CameraKitSDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // CameraKitSDK.h 3 | // Double Camera Kit SDK 4 | // 5 | // Created by David Cann on 8/3/13. 6 | // Copyright (c) 2013 Double Robotics, Inc. All rights reserved. 7 | // 8 | 9 | #ifndef Double_Basic_Example_CameraKitSDK_h 10 | #define Double_Basic_Example_CameraKitSDK_h 11 | 12 | #import "DRCameraKit.h" 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /CameraKitSDK.framework/Versions/A/Headers/DRCameraKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // DRCameraKit.h 3 | // Camera Kit SDK 4 | // 5 | // Created by David Cann on 11/12/11. 6 | // Copyright (c) 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | #define kCameraKitSDKVersion @"0.1" 13 | 14 | @class DRCameraKit; 15 | 16 | @protocol DRCameraKitConnectionDelegate 17 | - (void)cameraKitConnectionStatusDidChange:(DRCameraKit *)theKit; 18 | @end 19 | 20 | @protocol DRCameraKitImageDelegate 21 | - (void)cameraKit:(DRCameraKit *)theKit didReceiveImage:(UIImage *)theImage sizeInBytes:(NSInteger)length; 22 | @end 23 | 24 | @protocol DRCameraKitControlDelegate 25 | - (void)cameraKitReceivedStatusUpdate:(DRCameraKit *)theKit; 26 | @end 27 | 28 | typedef struct { 29 | unsigned int reg; 30 | unsigned char value; 31 | } cameraSetting; 32 | 33 | @interface DRCameraKit : NSObject 34 | 35 | extern NSString *const kCameraKitVideoProtocolString; 36 | extern NSString *const kCameraKitControlProtocolString; 37 | 38 | extern const cameraSetting kCameraSettingsFullRes_15FPS[]; 39 | extern const cameraSetting kCameraSettingsFullRes_15FPS_low[]; 40 | extern const cameraSetting kCameraSettings1280x960_30FPS[]; 41 | extern const cameraSetting kCameraSettings640x480_30FPS[]; 42 | extern const cameraSetting kCameraSettings640x480_30FPS_low[]; 43 | extern const cameraSetting kCameraSettings1280x960_15FPS_ISP[]; 44 | extern const cameraSetting kCameraSettings640x480_15FPS_ISP[]; 45 | extern const cameraSetting kCameraSettings640x480_15FPS_ISP_low[]; 46 | 47 | @property (nonatomic, weak) id connectionDelegate; 48 | @property (nonatomic, weak) id imageDelegate; 49 | @property (nonatomic, weak) id controlDelegate; 50 | @property (nonatomic, readonly) BOOL videoIsStreaming; 51 | @property (nonatomic) NSInteger firmwareVersion; 52 | 53 | #pragma mark - Singleton 54 | + (DRCameraKit *)sharedCameraKit; 55 | 56 | #pragma mark - Setup 57 | - (BOOL)isConnected; 58 | - (void)disconnect; 59 | - (void)connectToAccessory:(EAAccessory *)theAccessory; 60 | - (void)startVideo; 61 | - (void)stopVideo; 62 | - (void)setCameraSettingsWithArray:(cameraSetting*)settings; 63 | - (void)setCameraSetting:(unsigned int)reg value:(unsigned char)value; 64 | - (void)startCharging; 65 | - (void)stopCharging; 66 | - (void)setLED:(UIColor*)color; 67 | - (void)fadeLEDtoColor:(UIColor*)color overTime:(NSInteger)millis; 68 | - (void)requestStatus; 69 | - (NSString *)iAPFirmwareVersion; 70 | - (NSString *)iAPSerialNumber; 71 | - (NSString *)iAPHardwareRevision; 72 | - (cameraSetting *)lastCameraSetting; 73 | - (BOOL)needsOverscanCrop; 74 | - (CGSize)sizeForCameraSetting:(cameraSetting *)theSetting; 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /CameraKitSDK.framework/Versions/A/Resources/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/CameraKitSDK.framework/Versions/A/Resources/Info.plist -------------------------------------------------------------------------------- /CameraKitSDK.framework/Versions/Current/CameraKitSDK: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/CameraKitSDK.framework/Versions/Current/CameraKitSDK -------------------------------------------------------------------------------- /CameraKitSDK.framework/Versions/Current/Headers/CameraKitSDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // CameraKitSDK.h 3 | // Double Camera Kit SDK 4 | // 5 | // Created by David Cann on 8/3/13. 6 | // Copyright (c) 2013 Double Robotics, Inc. All rights reserved. 7 | // 8 | 9 | #ifndef Double_Basic_Example_CameraKitSDK_h 10 | #define Double_Basic_Example_CameraKitSDK_h 11 | 12 | #import "DRCameraKit.h" 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /CameraKitSDK.framework/Versions/Current/Headers/DRCameraKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // DRCameraKit.h 3 | // Camera Kit SDK 4 | // 5 | // Created by David Cann on 11/12/11. 6 | // Copyright (c) 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | #define kCameraKitSDKVersion @"0.1" 13 | 14 | @class DRCameraKit; 15 | 16 | @protocol DRCameraKitConnectionDelegate 17 | - (void)cameraKitConnectionStatusDidChange:(DRCameraKit *)theKit; 18 | @end 19 | 20 | @protocol DRCameraKitImageDelegate 21 | - (void)cameraKit:(DRCameraKit *)theKit didReceiveImage:(UIImage *)theImage sizeInBytes:(NSInteger)length; 22 | @end 23 | 24 | @protocol DRCameraKitControlDelegate 25 | - (void)cameraKitReceivedStatusUpdate:(DRCameraKit *)theKit; 26 | @end 27 | 28 | typedef struct { 29 | unsigned int reg; 30 | unsigned char value; 31 | } cameraSetting; 32 | 33 | @interface DRCameraKit : NSObject 34 | 35 | extern NSString *const kCameraKitVideoProtocolString; 36 | extern NSString *const kCameraKitControlProtocolString; 37 | 38 | extern const cameraSetting kCameraSettingsFullRes_15FPS[]; 39 | extern const cameraSetting kCameraSettingsFullRes_15FPS_low[]; 40 | extern const cameraSetting kCameraSettings1280x960_30FPS[]; 41 | extern const cameraSetting kCameraSettings640x480_30FPS[]; 42 | extern const cameraSetting kCameraSettings640x480_30FPS_low[]; 43 | extern const cameraSetting kCameraSettings1280x960_15FPS_ISP[]; 44 | extern const cameraSetting kCameraSettings640x480_15FPS_ISP[]; 45 | extern const cameraSetting kCameraSettings640x480_15FPS_ISP_low[]; 46 | 47 | @property (nonatomic, weak) id connectionDelegate; 48 | @property (nonatomic, weak) id imageDelegate; 49 | @property (nonatomic, weak) id controlDelegate; 50 | @property (nonatomic, readonly) BOOL videoIsStreaming; 51 | @property (nonatomic) NSInteger firmwareVersion; 52 | 53 | #pragma mark - Singleton 54 | + (DRCameraKit *)sharedCameraKit; 55 | 56 | #pragma mark - Setup 57 | - (BOOL)isConnected; 58 | - (void)disconnect; 59 | - (void)connectToAccessory:(EAAccessory *)theAccessory; 60 | - (void)startVideo; 61 | - (void)stopVideo; 62 | - (void)setCameraSettingsWithArray:(cameraSetting*)settings; 63 | - (void)setCameraSetting:(unsigned int)reg value:(unsigned char)value; 64 | - (void)startCharging; 65 | - (void)stopCharging; 66 | - (void)setLED:(UIColor*)color; 67 | - (void)fadeLEDtoColor:(UIColor*)color overTime:(NSInteger)millis; 68 | - (void)requestStatus; 69 | - (NSString *)iAPFirmwareVersion; 70 | - (NSString *)iAPSerialNumber; 71 | - (NSString *)iAPHardwareRevision; 72 | - (cameraSetting *)lastCameraSetting; 73 | - (BOOL)needsOverscanCrop; 74 | - (CGSize)sizeForCameraSetting:(cameraSetting *)theSetting; 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /CameraKitSDK.framework/Versions/Current/Resources/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/CameraKitSDK.framework/Versions/Current/Resources/Info.plist -------------------------------------------------------------------------------- /CoreML/BodyPart.swift: -------------------------------------------------------------------------------- 1 | 2 | 3 | import Foundation 4 | 5 | class BodyPart { 6 | 7 | var uidx: String 8 | var partIdx: Int 9 | var x: CGFloat 10 | var y: CGFloat 11 | var score: Double 12 | 13 | init(_ uidx: String,_ partIdx: Int,_ x: CGFloat,_ y: CGFloat,_ score: Double){ 14 | self.uidx = uidx 15 | self.partIdx = partIdx 16 | self.x = x 17 | self.y = y 18 | self.score = score 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /CoreML/CocoPairs.swift: -------------------------------------------------------------------------------- 1 | 2 | 3 | import Foundation 4 | 5 | 6 | enum CocoPart: Int { 7 | case Nose = 0 8 | case Neck = 1 9 | case RShoulder = 2 10 | case RElbow = 3 11 | case RWrist = 4 12 | case LShoulder = 5 13 | case LElbow = 6 14 | case LWrist = 7 15 | case RHip = 8 16 | case RKnee = 9 17 | case RAnkle = 10 18 | case LHip = 11 19 | case LKnee = 12 20 | case LAnkle = 13 21 | case REye = 14 22 | case LEye = 15 23 | case REar = 16 24 | case LEar = 17 25 | case Background = 18 26 | } 27 | 28 | let CocoPairs = [ 29 | (1, 2), (1, 5), (2, 3), (3, 4), (5, 6), (6, 7), (1, 8), (8, 9), (9, 10), (1, 11), 30 | (11, 12), (12, 13), (1, 0), (0, 14), (14, 16), (0, 15), (15, 17), (2, 16), (5, 17)] 31 | 32 | let CocoPairsRender = CocoPairs[0.. UIColor{ 46 | return UIColor(red: CGFloat(r) / 255.0, green: CGFloat(g) / 255.0, blue: CGFloat(b) / 255.0, alpha: 1) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /CoreML/Human.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Human.swift 3 | // iOSOpenPose 4 | // 5 | // Created by Eugene Bokhan on 1/19/18. 6 | // Copyright © 2018 Eugene Bokhan. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class Human { 12 | 13 | var pairs : [Connection] 14 | var bodyParts : [Int: BodyPart] 15 | var uidxList: Set 16 | 17 | init(_ pairs: [Connection]) { 18 | 19 | self.pairs = [Connection]() 20 | self.bodyParts = [Int: BodyPart]() 21 | self.uidxList = Set() 22 | 23 | for pair in pairs { 24 | self.addPair(pair) 25 | } 26 | } 27 | 28 | func _getUidx(_ partIdx: Int,_ idx: Int) -> String { 29 | return String(format: "%d-%d", partIdx, idx) 30 | } 31 | 32 | func addPair(_ pair: Connection) { 33 | self.pairs.append(pair) 34 | 35 | self.bodyParts[pair.partIdx1] = BodyPart(_getUidx(pair.partIdx1, pair.idx1), 36 | pair.partIdx1, 37 | pair.coord1.0, pair.coord1.1, pair.score) 38 | 39 | self.bodyParts[pair.partIdx2] = BodyPart(_getUidx(pair.partIdx2, pair.idx2), 40 | pair.partIdx2, 41 | pair.coord2.0, pair.coord2.1, pair.score) 42 | 43 | let uidx: [String] = [_getUidx(pair.partIdx1, pair.idx1),_getUidx(pair.partIdx2, pair.idx2)] 44 | self.uidxList.formUnion(uidx) 45 | } 46 | 47 | func merge(_ other: Human) { 48 | for pair in other.pairs { 49 | self.addPair(pair) 50 | } 51 | } 52 | 53 | func isConnected(_ other: Human) -> Bool { 54 | return uidxList.intersection(other.uidxList).count > 0 55 | } 56 | 57 | func partCount() -> Int { 58 | return self.bodyParts.count 59 | } 60 | 61 | func getMaxScore() -> Double { 62 | return max(self.bodyParts.map{ $0.value.score }) 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /CoreML/MobileOpenPose.mlmodel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/CoreML/MobileOpenPose.mlmodel -------------------------------------------------------------------------------- /DoubleControlSDK.framework/DoubleControlSDK: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/DoubleControlSDK.framework/DoubleControlSDK -------------------------------------------------------------------------------- /DoubleControlSDK.framework/Headers/DRDouble.h: -------------------------------------------------------------------------------- 1 | // 2 | // DRDouble.h 3 | // Double Basic Example 4 | // 5 | // Created by David Cann on 8/3/13. 6 | // Copyright (c) 2013 Double Robotics, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #define kDoubleBasicSDKVersion @"0.8.1" 12 | 13 | typedef NS_ENUM(NSInteger, DRDriveDirection) { 14 | kDRDriveDirectionStop = 0, 15 | kDRDriveDirectionForward = 1, 16 | kDRDriveDirectionBackward = 2 17 | }; 18 | 19 | @class DRDouble; 20 | 21 | @protocol DRDoubleDelegate 22 | @optional 23 | - (void)doubleDidConnect:(DRDouble *)theDouble; 24 | - (void)doubleDidDisconnect:(DRDouble *)theDouble; 25 | - (void)doubleStatusDidUpdate:(DRDouble *)theDouble; 26 | - (void)doubleDriveShouldUpdate:(DRDouble *)theDouble; 27 | - (void)doubleTravelDataDidUpdate:(DRDouble *)theDouble; 28 | @end 29 | 30 | @interface DRDouble : NSObject { 31 | 32 | } 33 | 34 | @property (nonatomic, assign) id delegate; 35 | @property (nonatomic, readonly) float poleHeightPercent; 36 | @property (nonatomic, readonly) int kickstandState; 37 | @property (nonatomic, readonly) float batteryPercent; 38 | @property (nonatomic, readonly) BOOL batteryIsFullyCharged; 39 | @property (nonatomic, readonly) NSString *firmwareVersion; 40 | @property (nonatomic, readonly) float leftEncoderDeltaInches; 41 | @property (nonatomic, readonly) float rightEncoderDeltaInches; 42 | @property (nonatomic, readonly) float xDeltaInches; 43 | @property (nonatomic, readonly) float yDeltaInches; 44 | @property (nonatomic, readonly) float headingDeltaRadians; 45 | @property (nonatomic, readonly) NSString *serial; 46 | 47 | #pragma mark - Singleton 48 | + (DRDouble *)sharedDouble; 49 | 50 | #pragma mark - Controls 51 | - (void)drive:(DRDriveDirection)forwardBack turn:(float)leftRight; // leftRight is -1.0 to 1.0 52 | - (void)variableDrive:(float)forwardBack turn:(float)leftRight; // drive is -1.0 to 1.0, leftRight is -1.0 to 1.0 (0.0 is stop on both) 53 | - (void)turnByDegrees:(float)theDegrees; 54 | - (void)poleUp; 55 | - (void)poleDown; 56 | - (void)poleStop; 57 | - (void)deployKickstands; 58 | - (void)retractKickstands; 59 | - (void)startTravelData; 60 | - (void)stopTravelData; 61 | - (void)requestStatusUpdate; 62 | - (void)headPowerOn; 63 | - (void)headPowerOff; 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /DoubleControlSDK.framework/Headers/DoubleControlSDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // DoubleBasicSDK.h 3 | // Double Basic Example 4 | // 5 | // Created by David Cann on 8/3/13. 6 | // Copyright (c) 2013 Double Robotics, Inc. All rights reserved. 7 | // 8 | 9 | #ifndef Double_Basic_Example_DoubleBasicSDK_h 10 | #define Double_Basic_Example_DoubleBasicSDK_h 11 | 12 | #import "DRDouble.h" 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /DoubleControlSDK.framework/Resources/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/DoubleControlSDK.framework/Resources/Info.plist -------------------------------------------------------------------------------- /DoubleControlSDK.framework/Versions/A/DoubleControlSDK: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/DoubleControlSDK.framework/Versions/A/DoubleControlSDK -------------------------------------------------------------------------------- /DoubleControlSDK.framework/Versions/A/Headers/DRDouble.h: -------------------------------------------------------------------------------- 1 | // 2 | // DRDouble.h 3 | // Double Basic Example 4 | // 5 | // Created by David Cann on 8/3/13. 6 | // Copyright (c) 2013 Double Robotics, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #define kDoubleBasicSDKVersion @"0.8.1" 12 | 13 | typedef NS_ENUM(NSInteger, DRDriveDirection) { 14 | kDRDriveDirectionStop = 0, 15 | kDRDriveDirectionForward = 1, 16 | kDRDriveDirectionBackward = 2 17 | }; 18 | 19 | @class DRDouble; 20 | 21 | @protocol DRDoubleDelegate 22 | @optional 23 | - (void)doubleDidConnect:(DRDouble *)theDouble; 24 | - (void)doubleDidDisconnect:(DRDouble *)theDouble; 25 | - (void)doubleStatusDidUpdate:(DRDouble *)theDouble; 26 | - (void)doubleDriveShouldUpdate:(DRDouble *)theDouble; 27 | - (void)doubleTravelDataDidUpdate:(DRDouble *)theDouble; 28 | @end 29 | 30 | @interface DRDouble : NSObject { 31 | 32 | } 33 | 34 | @property (nonatomic, assign) id delegate; 35 | @property (nonatomic, readonly) float poleHeightPercent; 36 | @property (nonatomic, readonly) int kickstandState; 37 | @property (nonatomic, readonly) float batteryPercent; 38 | @property (nonatomic, readonly) BOOL batteryIsFullyCharged; 39 | @property (nonatomic, readonly) NSString *firmwareVersion; 40 | @property (nonatomic, readonly) float leftEncoderDeltaInches; 41 | @property (nonatomic, readonly) float rightEncoderDeltaInches; 42 | @property (nonatomic, readonly) float xDeltaInches; 43 | @property (nonatomic, readonly) float yDeltaInches; 44 | @property (nonatomic, readonly) float headingDeltaRadians; 45 | @property (nonatomic, readonly) NSString *serial; 46 | 47 | #pragma mark - Singleton 48 | + (DRDouble *)sharedDouble; 49 | 50 | #pragma mark - Controls 51 | - (void)drive:(DRDriveDirection)forwardBack turn:(float)leftRight; // leftRight is -1.0 to 1.0 52 | - (void)variableDrive:(float)forwardBack turn:(float)leftRight; // drive is -1.0 to 1.0, leftRight is -1.0 to 1.0 (0.0 is stop on both) 53 | - (void)turnByDegrees:(float)theDegrees; 54 | - (void)poleUp; 55 | - (void)poleDown; 56 | - (void)poleStop; 57 | - (void)deployKickstands; 58 | - (void)retractKickstands; 59 | - (void)startTravelData; 60 | - (void)stopTravelData; 61 | - (void)requestStatusUpdate; 62 | - (void)headPowerOn; 63 | - (void)headPowerOff; 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /DoubleControlSDK.framework/Versions/A/Headers/DoubleControlSDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // DoubleBasicSDK.h 3 | // Double Basic Example 4 | // 5 | // Created by David Cann on 8/3/13. 6 | // Copyright (c) 2013 Double Robotics, Inc. All rights reserved. 7 | // 8 | 9 | #ifndef Double_Basic_Example_DoubleBasicSDK_h 10 | #define Double_Basic_Example_DoubleBasicSDK_h 11 | 12 | #import "DRDouble.h" 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /DoubleControlSDK.framework/Versions/A/Resources/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/DoubleControlSDK.framework/Versions/A/Resources/Info.plist -------------------------------------------------------------------------------- /DoubleControlSDK.framework/Versions/Current/DoubleControlSDK: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/DoubleControlSDK.framework/Versions/Current/DoubleControlSDK -------------------------------------------------------------------------------- /DoubleControlSDK.framework/Versions/Current/Headers/DRDouble.h: -------------------------------------------------------------------------------- 1 | // 2 | // DRDouble.h 3 | // Double Basic Example 4 | // 5 | // Created by David Cann on 8/3/13. 6 | // Copyright (c) 2013 Double Robotics, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #define kDoubleBasicSDKVersion @"0.8.1" 12 | 13 | typedef NS_ENUM(NSInteger, DRDriveDirection) { 14 | kDRDriveDirectionStop = 0, 15 | kDRDriveDirectionForward = 1, 16 | kDRDriveDirectionBackward = 2 17 | }; 18 | 19 | @class DRDouble; 20 | 21 | @protocol DRDoubleDelegate 22 | @optional 23 | - (void)doubleDidConnect:(DRDouble *)theDouble; 24 | - (void)doubleDidDisconnect:(DRDouble *)theDouble; 25 | - (void)doubleStatusDidUpdate:(DRDouble *)theDouble; 26 | - (void)doubleDriveShouldUpdate:(DRDouble *)theDouble; 27 | - (void)doubleTravelDataDidUpdate:(DRDouble *)theDouble; 28 | @end 29 | 30 | @interface DRDouble : NSObject { 31 | 32 | } 33 | 34 | @property (nonatomic, assign) id delegate; 35 | @property (nonatomic, readonly) float poleHeightPercent; 36 | @property (nonatomic, readonly) int kickstandState; 37 | @property (nonatomic, readonly) float batteryPercent; 38 | @property (nonatomic, readonly) BOOL batteryIsFullyCharged; 39 | @property (nonatomic, readonly) NSString *firmwareVersion; 40 | @property (nonatomic, readonly) float leftEncoderDeltaInches; 41 | @property (nonatomic, readonly) float rightEncoderDeltaInches; 42 | @property (nonatomic, readonly) float xDeltaInches; 43 | @property (nonatomic, readonly) float yDeltaInches; 44 | @property (nonatomic, readonly) float headingDeltaRadians; 45 | @property (nonatomic, readonly) NSString *serial; 46 | 47 | #pragma mark - Singleton 48 | + (DRDouble *)sharedDouble; 49 | 50 | #pragma mark - Controls 51 | - (void)drive:(DRDriveDirection)forwardBack turn:(float)leftRight; // leftRight is -1.0 to 1.0 52 | - (void)variableDrive:(float)forwardBack turn:(float)leftRight; // drive is -1.0 to 1.0, leftRight is -1.0 to 1.0 (0.0 is stop on both) 53 | - (void)turnByDegrees:(float)theDegrees; 54 | - (void)poleUp; 55 | - (void)poleDown; 56 | - (void)poleStop; 57 | - (void)deployKickstands; 58 | - (void)retractKickstands; 59 | - (void)startTravelData; 60 | - (void)stopTravelData; 61 | - (void)requestStatusUpdate; 62 | - (void)headPowerOn; 63 | - (void)headPowerOff; 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /DoubleControlSDK.framework/Versions/Current/Headers/DoubleControlSDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // DoubleBasicSDK.h 3 | // Double Basic Example 4 | // 5 | // Created by David Cann on 8/3/13. 6 | // Copyright (c) 2013 Double Robotics, Inc. All rights reserved. 7 | // 8 | 9 | #ifndef Double_Basic_Example_DoubleBasicSDK_h 10 | #define Double_Basic_Example_DoubleBasicSDK_h 11 | 12 | #import "DRDouble.h" 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /DoubleControlSDK.framework/Versions/Current/Resources/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/DoubleControlSDK.framework/Versions/Current/Resources/Info.plist -------------------------------------------------------------------------------- /Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | NSCameraUsageDescription 24 | NSCameraUsageDescription 25 | UIAppFonts 26 | 27 | monaco.ttf 28 | 29 | UILaunchStoryboardName 30 | LaunchScreen 31 | UIMainStoryboardFile 32 | Main 33 | UIRequiredDeviceCapabilities 34 | 35 | armv7 36 | 37 | UISupportedExternalAccessoryProtocols 38 | 39 | com.doublerobotics.camerakit.video 40 | com.doublerobotics.camerakit.control 41 | com.doublerobotics.pancho 42 | 43 | UISupportedInterfaceOrientations 44 | 45 | UIInterfaceOrientationPortrait 46 | 47 | UISupportedInterfaceOrientations~ipad 48 | 49 | UIInterfaceOrientationPortrait 50 | UIInterfaceOrientationPortraitUpsideDown 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /Libraries/CoreMLHelpers/Array.swift: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 M.I. Hollemans 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | IN THE SOFTWARE. 21 | */ 22 | 23 | import Swift 24 | 25 | extension Array where Element: Comparable { 26 | /** 27 | Returns the index and value of the largest element in the array. 28 | */ 29 | public func argmax() -> (Int, Element) { 30 | precondition(self.count > 0) 31 | var maxIndex = 0 32 | var maxValue = self[0] 33 | for i in 1.. maxValue { 35 | maxValue = self[i] 36 | maxIndex = i 37 | } 38 | } 39 | return (maxIndex, maxValue) 40 | } 41 | 42 | /** 43 | Returns the indices of the array's elements in sorted order. 44 | */ 45 | public func argsort(by areInIncreasingOrder: (Element, Element) -> Bool) -> [Array.Index] { 46 | return self.indices.sorted { areInIncreasingOrder(self[$0], self[$1]) } 47 | } 48 | 49 | /** 50 | Returns a new array containing the elements at the specified indices. 51 | */ 52 | public func gather(indices: [Array.Index]) -> [Element] { 53 | var a = [Element]() 54 | for i in indices { a.append(self[i]) } 55 | return a 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Libraries/CoreMLHelpers/MLMultiArray+Image.swift: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 M.I. Hollemans 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | IN THE SOFTWARE. 21 | */ 22 | 23 | import Foundation 24 | import CoreML 25 | 26 | extension MLMultiArray { 27 | /** 28 | Converts the multi-array to a UIImage. 29 | */ 30 | public func image(offset: T, scale: T) -> UIImage? { 31 | return MultiArray(self).image(offset: offset, scale: scale) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Libraries/CoreMLHelpers/Math.swift: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 M.I. Hollemans 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | IN THE SOFTWARE. 21 | */ 22 | 23 | import Foundation 24 | 25 | public func clamp(_ x: T, min: T, max: T) -> T { 26 | if x < min { return min } 27 | if x > max { return max } 28 | return x 29 | } 30 | -------------------------------------------------------------------------------- /Libraries/CoreMLHelpers/Predictions.swift: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2017 M.I. Hollemans 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | IN THE SOFTWARE. 21 | */ 22 | 23 | import Vision 24 | 25 | /** 26 | Returns the top `k` predictions from Core ML classification results as an 27 | array of `(String, Double)` pairs. 28 | */ 29 | public func top(_ k: Int, _ prob: [String: Double]) -> [(String, Double)] { 30 | return Array(prob.map { x in (x.key, x.value) } 31 | .sorted(by: { a, b -> Bool in a.1 > b.1 }) 32 | .prefix(through: min(k, prob.count) - 1)) 33 | } 34 | 35 | /** 36 | Returns the top `k` predictions from Vision classification results as an 37 | array of `(String, Double)` pairs. 38 | */ 39 | public func top(_ k: Int, _ observations: [VNClassificationObservation]) -> [(String, Double)] { 40 | // The Vision observations are sorted by confidence already. 41 | return observations.prefix(through: min(k, observations.count) - 1) 42 | .map { ($0.identifier, Double($0.confidence)) } 43 | } 44 | -------------------------------------------------------------------------------- /Libraries/IteratorTools/Accumulate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Accumulate.swift 3 | // IteratorTools 4 | // 5 | // Created by Michael Pangburn on 8/24/17. 6 | // Copyright © 2017 Michael Pangburn. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | public extension Sequence { 13 | 14 | /** 15 | Returns an array of containing consecutively accumulated values from the sequence. 16 | ``` 17 | let values = [1, 2, 3, 4].accumulate(+) 18 | // [1, 3, 6, 10] 19 | ``` 20 | - Parameter nextPartialResult: The function used to accumulate the sequence's values. 21 | - Returns: An array of containing consecutively accumulated values from the sequence. 22 | */ 23 | func accumulate(_ nextPartialResult: @escaping (Iterator.Element, Iterator.Element) -> Iterator.Element) -> [Iterator.Element] { 24 | return Array(Accumulator(sequence: self, accumulate: nextPartialResult)) 25 | } 26 | } 27 | 28 | 29 | public extension LazySequenceProtocol { 30 | 31 | /** 32 | Returns an iterator-sequence for consecutively accumulating the sequence's values. 33 | ``` 34 | let values = [1, 2, 3, 4].lazy.accumulate(+) 35 | // 1, 3, 6, 10 36 | ``` 37 | - Parameter nextPartialResult: The function used to accumulate the sequence's values. 38 | - Returns: An iterator-sequence consecutively accumulating the sequence's values. 39 | */ 40 | func accumulate(_ nextPartialResult: @escaping (Iterator.Element, Iterator.Element) -> Iterator.Element) -> Accumulator { 41 | return Accumulator(sequence: self, accumulate: nextPartialResult) 42 | } 43 | } 44 | 45 | 46 | /// An iterator-sequence for accumulating sequence values. 47 | /// See the `accumulate(_:)` Sequence and LazySequenceProtocol method. 48 | public struct Accumulator: IteratorProtocol, Sequence { 49 | 50 | private let sequence: S 51 | private var iterator: S.Iterator 52 | private let accumulate: (S.Iterator.Element, S.Iterator.Element) -> S.Iterator.Element 53 | private var total: S.Iterator.Element? = nil 54 | 55 | fileprivate init(sequence: S, accumulate: @escaping (S.Iterator.Element, S.Iterator.Element) -> S.Iterator.Element) { 56 | self.sequence = sequence 57 | self.iterator = sequence.makeIterator() 58 | self.accumulate = accumulate 59 | } 60 | 61 | public mutating func next() -> S.Iterator.Element? { 62 | guard let next = iterator.next() else { 63 | return nil 64 | } 65 | 66 | if let total = total { 67 | self.total = accumulate(total, next) 68 | } else { 69 | self.total = next 70 | } 71 | 72 | return total 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Libraries/IteratorTools/AnyIterator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AnyIterator.swift 3 | // IteratorTools 4 | // 5 | // Created by Michael Pangburn on 12/11/17. 6 | // Copyright © 2017 Michael Pangburn. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | // c.f. http://chris.eidhof.nl/post/type-erasers-in-swift/ 13 | class AnyIterator: IteratorProtocol { 14 | private let _next: () -> A? 15 | 16 | init(_ iterator: I) where I.Element == A { 17 | var iteratorCopy = iterator 18 | self._next = { iteratorCopy.next() } 19 | } 20 | 21 | func next() -> A? { 22 | return _next() 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Libraries/IteratorTools/Chain.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Chain.swift 3 | // IteratorTools 4 | // 5 | // Created by Michael Pangburn on 8/25/17. 6 | // Copyright © 2017 Michael Pangburn. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | /** 13 | Returns an iterator-sequence that returns values from each sequence until all are exhausted. 14 | Used for treating consecutive sequences as a single sequence. 15 | ``` 16 | let values = chain([1, 2, 3], [4, 5, 6]) 17 | // 1, 2, 3, 4, 5, 6 18 | ``` 19 | - Parameter sequences: The sequences to chain. 20 | - Returns: An iterator-sequence that returns values from each sequence until all are exhausted. 21 | */ 22 | public func chain(_ sequences: S...) -> Chain { 23 | return Chain(sequences: sequences) 24 | } 25 | 26 | 27 | /** 28 | Returns an iterator-sequence that returns values from each sequence until all are exhausted. 29 | Used for treating consecutive sequences as a single sequence. 30 | ``` 31 | let values = chain([[1, 2, 3], [4, 5, 6]]) 32 | // 1, 2, 3, 4, 5, 6 33 | ``` 34 | - Parameter sequenceArray: The sequences to chain. 35 | - Returns: An iterator-sequence that returns values from each sequence until all are exhausted. 36 | */ 37 | public func chain(_ sequenceArray: [S]) -> Chain { 38 | return Chain(sequences: sequenceArray) 39 | } 40 | 41 | 42 | /// An iterator-sequence for chaining sequences. 43 | /// See `chain(_:)`. 44 | public struct Chain: IteratorProtocol, Sequence { 45 | 46 | private var iterators: [S.Iterator] 47 | 48 | fileprivate init(sequences: [S]) { 49 | iterators = sequences.map { $0.makeIterator() } 50 | } 51 | 52 | public mutating func next() -> S.Iterator.Element? { 53 | guard !iterators.isEmpty else { 54 | return nil 55 | } 56 | 57 | guard let next = iterators[0].next() else { 58 | iterators = Array(iterators.dropFirst()) 59 | return self.next() 60 | } 61 | 62 | return next 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Libraries/IteratorTools/Combinations.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Combinations.swift 3 | // IteratorTools 4 | // 5 | // Created by Michael Pangburn on 8/28/17. 6 | // Copyright © 2017 Michael Pangburn. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | public extension Sequence { 13 | 14 | /** 15 | Returns an array containing the combinations of the specified length of elements in the sequence. 16 | ``` 17 | let values = [1, 2, 3, 4].combinations(length: 2, repeatingElements: false) 18 | // [[1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4]] 19 | 20 | let values = [1, 2, 3, 4].combinations(length: 2, repeatingElements: true) 21 | // [[1, 1], [1, 2], [1, 3], [1, 4], [2, 2], [2, 3], [2, 4], [3, 3], [3, 4]] 22 | ``` 23 | - Parameters: 24 | - length: The length of the combinations to return. 25 | - repeatingElements: A boolean value determining whether or not elements can repeat in a combination. 26 | - Returns: An array containing the combinations of the specified length of elements in the sequence. 27 | */ 28 | func combinations(length: Int, repeatingElements: Bool) -> [[Iterator.Element]] { 29 | return Array(Combinations(sequence: self, length: length, repeatingElements: repeatingElements)) 30 | } 31 | } 32 | 33 | 34 | public extension LazySequenceProtocol { 35 | 36 | /** 37 | Returns an iterator-sequence that returns the combinations of the specified length of elements in the sequence. 38 | ``` 39 | let values = [1, 2, 3, 4].lazy.combinations(length: 2, repeatingElements: false) 40 | // [1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4] 41 | 42 | let values = [1, 2, 3, 4].lazy.combinations(length: 2, repeatingElements: true) 43 | // [1, 1], [1, 2], [1, 3], [1, 4], [2, 2], [2, 3], [2, 4], [3, 3], [3, 4] 44 | ``` 45 | - Parameters: 46 | - length: The length of the combinations to return. 47 | - repeatingElements: A boolean value determining whether or not elements can repeat in a combination. 48 | - Returns: An an iterator-sequence that returns the combinations of the specified length of elements in the sequence. 49 | */ 50 | func combinations(length: Int, repeatingElements: Bool) -> Combinations { 51 | return Combinations(sequence: self, length: length, repeatingElements: repeatingElements) 52 | } 53 | } 54 | 55 | 56 | /// An iterator-sequence that returns the combinations of a specified length of elements in a sequence. 57 | /// See the `combinations(length:repeatingElements:)` Sequence and LazySequenceProtocol method. 58 | public struct Combinations: IteratorProtocol, Sequence { 59 | 60 | private let values: [S.Iterator.Element] 61 | private let combinationLength: Int 62 | private let repeatingElements: Bool 63 | private var indicesIterator: AnyIterator> 64 | 65 | fileprivate init(sequence: S, length: Int, repeatingElements: Bool) { 66 | self.values = Array(sequence) 67 | self.combinationLength = length 68 | self.repeatingElements = repeatingElements 69 | if repeatingElements { 70 | self.indicesIterator = AnyIterator(product(values.indices, repeated: length)) 71 | } else { 72 | self.indicesIterator = AnyIterator(Permutations(sequence: values.indices, length: length, repeatingElements: false)) 73 | } 74 | } 75 | 76 | public mutating func next() -> [S.Iterator.Element]? { 77 | guard let indices = indicesIterator.next() else { 78 | return nil 79 | } 80 | 81 | guard indices.sorted() == indices else { 82 | return next() 83 | } 84 | 85 | let combination = indices.map { values[$0] } 86 | return combination.isEmpty ? nil : combination 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /Libraries/IteratorTools/Compress.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Compress.swift 3 | // IteratorTools 4 | // 5 | // Created by Michael Pangburn on 8/25/17. 6 | // Copyright © 2017 Michael Pangburn. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | /** 13 | Returns an iterator-sequence that filters elements from `data`, returning only those that have a corresponding `true` in `selectors`. 14 | Stops when either `data` or `selectors` has been exhausted. 15 | ``` 16 | let values = compress(data: [1, 2, 3, 4], selectors: [true, true, false, true]) 17 | // 1, 2, 4 18 | ``` 19 | - Parameters: 20 | - data: The data to filter. 21 | - selectors: The selectors used in filtering the data. 22 | - Returns: An iterator-sequence that filters elements from `data`, returning only those that have a corresponding `true` in `selectors`. 23 | */ 24 | public func compress(data: S1, selectors: S2) -> Compressor { 25 | return Compressor(data: data, selectors: selectors) 26 | } 27 | 28 | 29 | /// An iterator-sequence for filtering data based on corresponding selectors. 30 | /// See `compress(data:selectors:)`. 31 | public struct Compressor: IteratorProtocol, Sequence where S2.Iterator.Element == Bool { 32 | 33 | private var dataIterator: S1.Iterator 34 | private var selectorIterator: S2.Iterator 35 | 36 | fileprivate init(data: S1, selectors: S2) { 37 | self.dataIterator = data.makeIterator() 38 | self.selectorIterator = selectors.makeIterator() 39 | } 40 | 41 | public mutating func next() -> S1.Iterator.Element? { 42 | guard let nextData = dataIterator.next(), let nextSelector = selectorIterator.next() else { 43 | return nil 44 | } 45 | 46 | guard nextSelector else { 47 | return next() 48 | } 49 | 50 | return nextData 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Libraries/IteratorTools/Counter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Counter.swift 3 | // IteratorTools 4 | // 5 | // Created by Michael Pangburn on 8/24/17. 6 | // Copyright © 2017 Michael Pangburn. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | /** 13 | Returns an iterator-sequence beginning at `start` and incrementing by `step`. 14 | ``` 15 | let values = counter(start: 1, step: 2) 16 | // 1, 3, 5, 7, 9, ... 17 | ``` 18 | - Parameters: 19 | - start: The starting value for the counter. 20 | - step: The value by which to increment. 21 | - Returns: An iterator-sequence beginning at `start` and incrementing by `step`. 22 | */ 23 | public func counter(start: Double = 0, step: Double = 1) -> Counter { 24 | return Counter(start: start, step: step) 25 | } 26 | 27 | 28 | /// An iterator-sequence that functions as a simple incremental counter. 29 | /// See `counter(start:step:)` 30 | public struct Counter: IteratorProtocol, LazySequenceProtocol { 31 | 32 | private var start: Double 33 | private let step: Double 34 | 35 | fileprivate init(start: Double, step: Double) { 36 | self.start = start 37 | self.step = step 38 | } 39 | 40 | public mutating func next() -> Double? { 41 | defer { start += step } 42 | return start 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Libraries/IteratorTools/Cycle.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Cycle.swift 3 | // IteratorTools 4 | // 5 | // Created by Michael Pangburn on 8/24/17. 6 | // Copyright © 2017 Michael Pangburn. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | public extension Sequence { 13 | 14 | /** 15 | Returns an iterator-sequence cycling infinitely through the sequence. 16 | ``` 17 | let values = [1, 2, 3].cycle() 18 | // 1, 2, 3, 1, 2, 3, 1, ... 19 | ``` 20 | - Returns: An iterator-sequence cycling infinitely through the sequence. 21 | */ 22 | func cycle() -> CycleIterator { 23 | return CycleIterator(sequence: self) 24 | } 25 | 26 | /** 27 | Returns an array of `times` cycles of self. 28 | ``` 29 | let values = [1, 2, 3].cycle(times: 2) 30 | // [1, 2, 3, 1, 2, 3] 31 | ``` 32 | - Parameter times: The number of times to cycle through the sequence. 33 | - Returns: An array of `times` cycles of self. 34 | */ 35 | func cycle(times: Int) -> [Iterator.Element] { 36 | return Array(CycleIterator(sequence: self, times: times)) 37 | } 38 | } 39 | 40 | 41 | public extension LazySequenceProtocol { 42 | 43 | /** 44 | Returns an iterator-sequence of `times` cycles of self. 45 | ``` 46 | let values = [1, 2, 3].lazy.cycle(times: 2) 47 | // 1, 2, 3, 1, 2, 3 48 | ``` 49 | - Parameter times: The number of times to cycle through the sequence. 50 | - Returns: An iterator-sequence of `times` cycles of self. 51 | */ 52 | func cycle(times: Int) -> CycleIterator { 53 | return CycleIterator(sequence: self, times: times) 54 | } 55 | } 56 | 57 | 58 | /// An iterator-sequence for cycling through a collection. 59 | /// See the `cycle` and `cycle(times:)` Sequence and LazySequenceProtocol methods. 60 | public struct CycleIterator: IteratorProtocol, LazySequenceProtocol { 61 | 62 | private let sequence: S 63 | private var iterator: S.Iterator 64 | private var times: Int 65 | 66 | fileprivate init(sequence: S, times: Int = -1) { 67 | self.sequence = sequence 68 | self.iterator = sequence.makeIterator() 69 | self.times = times 70 | } 71 | 72 | public mutating func next() -> S.Iterator.Element? { 73 | guard times != 0 else { 74 | return nil 75 | } 76 | 77 | if let next = iterator.next() { 78 | return next 79 | } 80 | 81 | times -= 1 82 | guard times != 0 else { 83 | return nil 84 | } 85 | 86 | iterator = sequence.makeIterator() 87 | return iterator.next() 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /Libraries/IteratorTools/Grouped.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Grouped.swift 3 | // IteratorTools 4 | // 5 | // Created by Michael Pangburn on 8/25/17. 6 | // Copyright © 2017 Michael Pangburn. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | public extension Sequence { 13 | 14 | /** 15 | Returns an array of consecutive keys and groups from the sequence as tuples. 16 | Groups are made based on the element's output from the given key function. 17 | A group is cut as soon as the sequence's next value produces a different key. 18 | Generally, the sequence should be sorted on the same key function to group all values with the same key. 19 | ``` 20 | let values = (0...10).sorted(by: { $0 % 3 < $1 % 3 }).grouped(by: { $0 % 3 }) 21 | // [(key: 0, elements: [0, 3, 6, 9]), (key: 1, elements: [1, 4, 7, 10]), (key: 2, elements: [2, 5, 8])] 22 | ``` 23 | - Parameter key: The key function used in determining groups. 24 | - Returns: An array of consecutive keys and groups from the sequence. 25 | */ 26 | func grouped(by key: @escaping (Iterator.Element) -> Key) -> [(key: Key, elements: [Iterator.Element])] { 27 | return Array(Grouper(sequence: self, key: key)) 28 | } 29 | } 30 | 31 | public extension LazySequenceProtocol { 32 | 33 | /** 34 | Returns an iterator-sequence that returns consecutive keys and groups from the sequence as tuples. 35 | Groups are made based on the element's output from the given key function. 36 | A group is cut as soon as the sequence's next value produces a different key. 37 | Generally, the sequence should be sorted on the same key function to group all values with the same key. 38 | ``` 39 | let values = (0...10).sorted(by: { $0 % 3 < $1 % 3 }).lazy.grouped(by: { $0 % 3 }) 40 | // (key: 0, elements: [0, 3, 6, 9]), (key: 1, elements: [1, 4, 7, 10]), (key: 2, elements: [2, 5, 8]) 41 | ``` 42 | - Parameter key: The key function used in determining groups. 43 | - Returns: An iterator-sequence that returns consecutive keys and groups from the sequence. 44 | */ 45 | func grouped(by key: @escaping (Iterator.Element) -> Key) -> Grouper { 46 | return Grouper(sequence: self, key: key) 47 | } 48 | } 49 | 50 | 51 | /// An iterator-sequence that returns consecutive keys and groups from a sequence as tuples. 52 | /// See the `grouped(by:)` Sequence method. 53 | public struct Grouper: IteratorProtocol, Sequence { 54 | 55 | private var iterator: S.Iterator 56 | private let key: (S.Iterator.Element) -> Key 57 | private var currentKey: Key? 58 | private var currentValues: [S.Iterator.Element] = [] 59 | 60 | fileprivate init(sequence: S, key: @escaping (S.Iterator.Element) -> Key) { 61 | self.iterator = sequence.makeIterator() 62 | self.key = key 63 | } 64 | 65 | public mutating func next() -> (key: Key, elements: [S.Iterator.Element])? { 66 | if currentKey == nil { 67 | guard let next = iterator.next() else { 68 | return nil 69 | } 70 | currentKey = key(next) 71 | currentValues = [next] 72 | } 73 | 74 | while let next = iterator.next() { 75 | let nextKey = key(next) 76 | if nextKey == currentKey { 77 | currentValues.append(next) 78 | } else { 79 | let lastKey = currentKey! 80 | let lastValues = currentValues 81 | currentKey = nextKey 82 | currentValues = [next] 83 | return (lastKey, lastValues) 84 | } 85 | } 86 | 87 | guard !currentValues.isEmpty else { 88 | return nil 89 | } 90 | 91 | let lastKey = currentKey! 92 | let lastValues = currentValues 93 | currentKey = nil 94 | currentValues = [] 95 | return (lastKey, lastValues) 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /Libraries/IteratorTools/Permutations.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Permutations.swift 3 | // IteratorTools 4 | // 5 | // Created by Michael Pangburn on 8/27/17. 6 | // Copyright © 2017 Michael Pangburn. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | public extension Sequence { 13 | 14 | /** 15 | Returns an array containing the permutations of elements in the sequence, optionally of a specified length. 16 | ``` 17 | let values = [1, 2, 3].permutations(repeatingElements: false) 18 | // [[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]] 19 | 20 | let values = [1, 2, 3].permutations(length: 2, repeatingElements: true) 21 | // [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]] 22 | ``` 23 | - Parameters: 24 | - length: The length of the permutations to return. Defaults to the length of the sequence. 25 | - repeatingElements: A boolean value determining whether or not elements can repeat in a permutation. 26 | - Returns: An array containing the permutations of elements in the sequence. 27 | */ 28 | func permutations(length: Int? = nil, repeatingElements: Bool) -> [[Iterator.Element]] { 29 | return Array(Permutations(sequence: self, length: length, repeatingElements: repeatingElements)) 30 | } 31 | } 32 | 33 | 34 | public extension LazySequenceProtocol { 35 | 36 | /** 37 | Returns an iterator-sequence that returns the permutations of elements in the sequence, optionally of a specified length. 38 | ``` 39 | let values = [1, 2, 3].lazy.permutations(repeatingElements: false) 40 | // [1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1] 41 | 42 | let values = [1, 2, 3].lazy.permutations(length: 2, repeatingElements: true) 43 | // [1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3] 44 | ``` 45 | - Parameters: 46 | - length: The length of the permutations to return. Defaults to the length of the sequence. 47 | - repeatingElements: A boolean value determining whether or not elements can repeat in a permutation. 48 | - Returns: An an iterator-sequence that returns the permutations of elements in the sequence. 49 | */ 50 | func permutations(length: Int? = nil, repeatingElements: Bool) -> Permutations { 51 | return Permutations(sequence: self, length: length, repeatingElements: repeatingElements) 52 | } 53 | } 54 | 55 | 56 | /// An iterator-sequence that returns the permutations of elements in a sequence. 57 | /// See the `permutations(repeatingElements:)` and `permutations(length:repeatingElements:)` Sequence and LazySequenceProtocol methods. 58 | public struct Permutations: IteratorProtocol, Sequence { 59 | 60 | private let values: [S.Iterator.Element] 61 | private let permutationLength: Int 62 | private let repeatingElements: Bool 63 | private var indicesIterator: CartesianProduct> 64 | 65 | init(sequence: S, length: Int?, repeatingElements: Bool) { 66 | self.values = Array(sequence) 67 | 68 | if let length = length { 69 | self.permutationLength = length 70 | } else { 71 | self.permutationLength = values.count 72 | } 73 | 74 | self.repeatingElements = repeatingElements 75 | self.indicesIterator = product(values.indices, repeated: permutationLength) 76 | } 77 | 78 | public mutating func next() -> [S.Iterator.Element]? { 79 | guard let indices = indicesIterator.next() else { 80 | return nil 81 | } 82 | 83 | if !repeatingElements { 84 | guard Set(indices).count == permutationLength else { 85 | return next() 86 | } 87 | } 88 | 89 | let permutation = indices.map { values[$0] } 90 | return permutation.isEmpty ? nil : permutation 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /Libraries/IteratorTools/Reject.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Reject.swift 3 | // IteratorTools 4 | // 5 | // Created by Michael Pangburn on 8/25/17. 6 | // Copyright © 2017 Michael Pangburn. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | public extension Sequence { 13 | 14 | /** 15 | Returns an array containing only the elements from the sequence for which the predicate is false. 16 | ``` 17 | let values = [1, 2, 3, 4, 5].reject { $0 % 2 == 0 } 18 | // [1, 3, 5] 19 | ``` 20 | - Parameter predicate: The predicate used to determine whether the elements should be included in the result. 21 | Elements are included only when the predicate is false. 22 | - Returns: An array containing only the elements from the sequence for which the predicate is false. 23 | */ 24 | func reject(predicate: @escaping (Iterator.Element) -> Bool) -> [Iterator.Element] { 25 | return filter { !predicate($0) } 26 | } 27 | } 28 | 29 | 30 | public extension LazySequenceProtocol { 31 | 32 | /** 33 | Returns an iterator-sequence that returns only the elements from the sequence for which the predicate is false. 34 | ``` 35 | let values = [1, 2, 3, 4, 5].lazy.reject { $0 % 2 == 0 } 36 | // 1, 3, 5 37 | ``` 38 | - Parameter predicate: The predicate used to determine whether the elements should be included in the result. 39 | Elements are included only when the predicate is false. 40 | - Returns: An iterator-sequence that returns only the elements from the sequence for which the predicate is false. 41 | */ 42 | func reject(predicate: @escaping (Iterator.Element) -> Bool) -> Rejector { 43 | return Rejector(sequence: self, predicate: predicate) 44 | } 45 | } 46 | 47 | 48 | /// An iterator-sequence that rejects values that do not meet the predicate. 49 | /// See the `reject(predicate:)` LazySequenceProtocol method. 50 | public struct Rejector: IteratorProtocol, Sequence { 51 | 52 | private var iterator: S.Iterator 53 | private let predicate: (S.Iterator.Element) -> Bool 54 | 55 | fileprivate init(sequence: S, predicate: @escaping (S.Iterator.Element) -> Bool) { 56 | self.iterator = sequence.makeIterator() 57 | self.predicate = predicate 58 | } 59 | 60 | public mutating func next() -> S.Iterator.Element? { 61 | guard let next = iterator.next() else { 62 | return nil 63 | } 64 | 65 | return !predicate(next) ? next : self.next() 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Libraries/IteratorTools/Repeater.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Repeater.swift 3 | // IteratorTools 4 | // 5 | // Created by Michael Pangburn on 8/24/17. 6 | // Copyright © 2017 Michael Pangburn. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | /** 13 | Returns an iterator-sequence repeating a value, either infinitely or a specified number of times. 14 | ``` 15 | let values = repeater(value: 0) 16 | // 0, 0, 0, 0, ... 17 | 18 | let values = repeater(value: 0, times: 3) 19 | // 0, 0, 0 20 | ``` 21 | - Parameters: 22 | - value: The value to repeat. 23 | - times: The number of times to repeat. Defaults to infinite repetition. 24 | - Returns: An iterator-sequence repeating the value the specified number of times or infinitely otherwise. 25 | */ 26 | public func repeater(value: T, times: Int = -1) -> Repeater { 27 | return Repeater(value: value, times: times) 28 | } 29 | 30 | 31 | /// An iterator-sequence repeating a value. 32 | /// See `repeater(value:times:)` 33 | public struct Repeater: IteratorProtocol, LazySequenceProtocol { 34 | 35 | private let value: T 36 | private var times: Int 37 | 38 | fileprivate init(value: T, times: Int) { 39 | self.value = value 40 | self.times = times 41 | } 42 | 43 | public mutating func next() -> T? { 44 | defer { times -= 1 } 45 | return times == 0 ? nil : value 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Libraries/IteratorTools/Tee.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Tee.swift 3 | // IteratorTools 4 | // 5 | // Created by Michael Pangburn on 8/25/17. 6 | // Copyright © 2017 Michael Pangburn. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | public extension Sequence { 13 | 14 | /** 15 | Returns an array of `n` independent iterators from the sequence. 16 | - Parameter n: The number of iterators to produce. 17 | - Returns: An array of `n` independent iterators from the sequence. 18 | */ 19 | func tee(_ n: Int = 2) -> [Iterator] { 20 | return Array(repeating: makeIterator(), count: n) 21 | } 22 | } 23 | 24 | 25 | public extension LazySequenceProtocol { 26 | 27 | /** 28 | Returns an iterator-sequence of `n` independent iterators from the sequence. 29 | - Parameter n: The number of iterators to produce. 30 | - Returns: An iterator-sequence of `n` indepdent iterators from the sequence 31 | */ 32 | func tee(_ n: Int = 2) -> Tee { 33 | return Tee(sequence: self, times: n) 34 | } 35 | } 36 | 37 | 38 | /// An iterator-sequence of a specified number of independent iterators from the sequence. 39 | /// See the `tee(_:)` Sequence and LazySequenceProtocol method. 40 | public struct Tee: IteratorProtocol, Sequence { 41 | 42 | private let sequence: S 43 | private var times: Int 44 | 45 | fileprivate init(sequence: S, times: Int) { 46 | self.sequence = sequence 47 | self.times = times 48 | } 49 | 50 | public mutating func next() -> S.Iterator? { 51 | defer { times -= 1 } 52 | return times == 0 ? nil : sequence.makeIterator() 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Libraries/IteratorTools/ZipToLongest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ZipToLongest.swift 3 | // IteratorTools 4 | // 5 | // Created by Michael Pangburn on 8/25/17. 6 | // Copyright © 2017 Michael Pangburn. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | /** 13 | Returns an iterator-sequence that aggregates elements from each of the sequences. 14 | If the sequences are of uneven length, missing values are filled-in with the corresponding fill value. 15 | Iteration continues until the longest sequence is exhausted. 16 | ``` 17 | let values = zipToLongest([1, 2], ["a", "b", "c"], firstFillValue: 0, secondFillValue: "z" 18 | // (1, "a"), (2, "b"), (0, "c") 19 | 20 | let values = zipToLongest([1, 2, 3, 4], ["a", "b"], firstFillValue: 0, secondFillValue: "z") 21 | // (1, "a"), (2, "b"), (3, "z"), (4, "z") 22 | ``` 23 | - Parameters: 24 | - firstSequence: The first of the sequences from which to aggregate elements. 25 | - secondSequence: The second of the sequences from which to aggregate elements. 26 | - firstFillValue: The value to use as a filler in zipping when the second sequence is longer than the first. 27 | - secondFillValue: The value to use as a filler in zipping when the first sequence is longer than the second. 28 | - Returns: An iterator-sequence that aggregates elements from each of the sequences. 29 | */ 30 | public func zipToLongest(_ firstSequence: S1, _ secondSequence: S2, firstFillValue: S1.Iterator.Element, secondFillValue: S2.Iterator.Element) -> ZipToLongest { 31 | return ZipToLongest(firstSequence, secondSequence, firstFillValue: firstFillValue, secondFillValue: secondFillValue) 32 | } 33 | 34 | 35 | /// An iterator-sequence that aggregates elements from two sequences, filling in with values when one sequence is longer than the other. 36 | /// See `zipToLongest(_:_:firstFillValue:secondFillValue:)`. 37 | public struct ZipToLongest: IteratorProtocol, Sequence { 38 | 39 | private var firstIterator: S1.Iterator 40 | private var secondIterator: S2.Iterator 41 | private let firstFillValue: S1.Iterator.Element 42 | private let secondFillValue: S2.Iterator.Element 43 | 44 | fileprivate init(_ sequence1: S1, _ sequence2: S2, firstFillValue: S1.Iterator.Element, secondFillValue: S2.Iterator.Element) { 45 | self.firstIterator = sequence1.makeIterator() 46 | self.secondIterator = sequence2.makeIterator() 47 | self.firstFillValue = firstFillValue 48 | self.secondFillValue = secondFillValue 49 | } 50 | 51 | public mutating func next() -> (S1.Iterator.Element, S2.Iterator.Element)? { 52 | let firstValue = firstIterator.next() 53 | let secondValue = secondIterator.next() 54 | guard firstValue != nil || secondValue != nil else { 55 | return nil 56 | } 57 | return (firstValue ?? firstFillValue, secondValue ?? secondFillValue) 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Libraries/Upsurge/Interval.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2015 Venture Media Labs. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | public protocol IntervalType { 22 | var start: Int? { get } 23 | var end: Int? { get } 24 | } 25 | 26 | public enum Interval: IntervalType, ExpressibleByIntegerLiteral { 27 | case all 28 | case range(CountableClosedRange) 29 | 30 | public init(range: CountableClosedRange) { 31 | self = Interval.range(range) 32 | } 33 | 34 | public init(integerLiteral value: Int) { 35 | self = Interval.range(value...value) 36 | } 37 | 38 | public var start: Int? { 39 | if case let .range(r) = self { 40 | return r.lowerBound 41 | } 42 | return nil 43 | } 44 | 45 | public var end: Int? { 46 | if case let .range(r) = self { 47 | return r.upperBound + 1 48 | } 49 | return nil 50 | } 51 | } 52 | 53 | extension CountableRange: IntervalType { 54 | public var start: Int? { 55 | return unsafeBitCast(lowerBound, to: Int.self) 56 | } 57 | 58 | public var end: Int? { 59 | return unsafeBitCast(upperBound, to: Int.self) 60 | } 61 | } 62 | 63 | extension CountableClosedRange: IntervalType { 64 | public var start: Int? { 65 | return unsafeBitCast(lowerBound, to: Int.self) 66 | } 67 | 68 | public var end: Int? { 69 | return unsafeBitCast(upperBound, to: Int.self) + 1 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Libraries/Upsurge/QuadraticType.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2015 Venture Media Labs. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | public enum QuadraticArrangement { 22 | /// Consecutive elements in a rows are contiguous in memory 23 | case rowMajor 24 | 25 | /// Consecutive elements in a column are contiguous in memory 26 | case columnMajor 27 | } 28 | 29 | public protocol QuadraticType: TensorType { 30 | 31 | /// The arrangement of rows and columns 32 | var arrangement: QuadraticArrangement { get } 33 | 34 | /// The number of rows 35 | var rows: Int { get } 36 | 37 | /// The number of columns 38 | var columns: Int { get } 39 | 40 | /// The step size between major-axis elements 41 | var stride: Int { get } 42 | 43 | /// The step of the base elements 44 | var step: Int { get } 45 | } 46 | 47 | public extension QuadraticType { 48 | /// The number of valid element in the memory block, taking into account the step size. 49 | public var count: Int { 50 | return rows * columns 51 | } 52 | 53 | public var dimensions: [Int] { 54 | if arrangement == .rowMajor { 55 | return [rows, columns] 56 | } else { 57 | return [columns, rows] 58 | } 59 | } 60 | } 61 | 62 | public protocol MutableQuadraticType: QuadraticType, MutableTensorType { 63 | } 64 | -------------------------------------------------------------------------------- /Libraries/Upsurge/Real.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2015 Venture Media Labs. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | /// A real number 22 | public protocol Real: FloatingPoint, ExpressibleByFloatLiteral, CustomStringConvertible {} 23 | 24 | extension Double: Real {} 25 | extension Float: Real {} 26 | -------------------------------------------------------------------------------- /Libraries/Upsurge/Sequence.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2015 Venture Media Labs. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | 21 | import Foundation 22 | 23 | extension Sequence { 24 | func all(predicate: (Iterator.Element) -> Bool) -> Bool { 25 | for e in self where !predicate(e) { 26 | return false 27 | } 28 | return true 29 | } 30 | } 31 | 32 | internal extension Collection { 33 | func indexIsValid(_ index: Index) -> Bool { 34 | return (startIndex.. 4 | #import 5 | 6 | @interface OpenCVWrapper : NSObject 7 | 8 | -(void) matrixMin: (double *) data 9 | data_size:(int)data_size 10 | data_rows:(int)data_rows 11 | heat_rows:(int)heat_rows; 12 | 13 | -(void) maximum_filter: (double *) data 14 | data_size:(int)data_size 15 | data_rows:(int)data_rows 16 | mask_size:(int)mask_size 17 | threshold:(double)threshold; 18 | 19 | -(UIImage*) renderKeyPoint:(CGRect) bounds 20 | keypoint:(int*) keypoint 21 | keypoint_size:(int) keypoint_size 22 | pos:(CGPoint*) pos; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /OpenCV/ios_conversions.mm: -------------------------------------------------------------------------------- 1 | 2 | 3 | #import 4 | #import 5 | #import 6 | #import 7 | #include "opencv2/core.hpp" 8 | 9 | 10 | UIImage* MatToUIImage(const cv::Mat& image); 11 | void UIImageToMat(const UIImage* image, cv::Mat& m, bool alphaExist); 12 | 13 | UIImage* MatToUIImage(const cv::Mat& image) { 14 | 15 | NSData *data = [NSData dataWithBytes:image.data 16 | length:image.step.p[0] * image.rows]; 17 | 18 | CGColorSpaceRef colorSpace; 19 | 20 | if (image.elemSize() == 1) { 21 | colorSpace = CGColorSpaceCreateDeviceGray(); 22 | } else { 23 | colorSpace = CGColorSpaceCreateDeviceRGB(); 24 | } 25 | 26 | CGDataProviderRef provider = 27 | CGDataProviderCreateWithCFData((__bridge CFDataRef)data); 28 | 29 | // Preserve alpha transparency, if exists 30 | bool alpha = image.channels() == 4; 31 | CGBitmapInfo bitmapInfo = (alpha ? kCGImageAlphaLast : kCGImageAlphaNone) | kCGBitmapByteOrderDefault; 32 | 33 | // Creating CGImage from cv::Mat 34 | CGImageRef imageRef = CGImageCreate(image.cols, 35 | image.rows, 36 | 8 * image.elemSize1(), 37 | 8 * image.elemSize(), 38 | image.step.p[0], 39 | colorSpace, 40 | bitmapInfo, 41 | provider, 42 | NULL, 43 | false, 44 | kCGRenderingIntentDefault 45 | ); 46 | 47 | 48 | // Getting UIImage from CGImage 49 | UIImage *finalImage = [UIImage imageWithCGImage:imageRef]; 50 | CGImageRelease(imageRef); 51 | CGDataProviderRelease(provider); 52 | CGColorSpaceRelease(colorSpace); 53 | 54 | return finalImage; 55 | } 56 | 57 | void UIImageToMat(const UIImage* image, 58 | cv::Mat& m, bool alphaExist) { 59 | CGColorSpaceRef colorSpace = CGImageGetColorSpace(image.CGImage); 60 | CGFloat cols = CGImageGetWidth(image.CGImage), rows = CGImageGetHeight(image.CGImage); 61 | CGContextRef contextRef; 62 | CGBitmapInfo bitmapInfo = kCGImageAlphaPremultipliedLast; 63 | if (CGColorSpaceGetModel(colorSpace) == kCGColorSpaceModelMonochrome) 64 | { 65 | m.create(rows, cols, CV_8UC1); // 8 bits per component, 1 channel 66 | bitmapInfo = kCGImageAlphaNone; 67 | if (!alphaExist) 68 | bitmapInfo = kCGImageAlphaNone; 69 | else 70 | m = cv::Scalar(0); 71 | contextRef = CGBitmapContextCreate(m.data, m.cols, m.rows, 8, 72 | m.step[0], colorSpace, 73 | bitmapInfo); 74 | } 75 | else 76 | { 77 | m.create(rows, cols, CV_8UC4); // 8 bits per component, 4 channels 78 | if (!alphaExist) 79 | bitmapInfo = kCGImageAlphaNoneSkipLast | 80 | kCGBitmapByteOrderDefault; 81 | else 82 | m = cv::Scalar(0); 83 | contextRef = CGBitmapContextCreate(m.data, m.cols, m.rows, 8, 84 | m.step[0], colorSpace, 85 | bitmapInfo); 86 | } 87 | CGContextDrawImage(contextRef, CGRectMake(0, 0, cols, rows), 88 | image.CGImage); 89 | CGContextRelease(contextRef); 90 | } 91 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Realtime-Openpose-on-iOS-with-Double-Robot 2 | 3 | This project achieves run the Openpose model(human pose estimation) on iOS device in real-time, and also a mobile robot named Double Robot is controlled by iOS device at same time. 4 | 5 | 6 | ## Requirements 7 | You can build this app on a iPad with your mac with XCode. 8 | 9 | 10 | 11 | 12 | ## Demo Picture 13 | 14 | 15 | 16 | 17 | 18 | ## References 19 | 20 | Please consider citing the following works, if you use in your research/projects: 21 | 22 | @inproceedings{wang2021single, 23 | title={A single RGB camera based gait analysis with a mobile tele-robot for healthcare}, 24 | author={Wang, Ziyang and Deligianni, Fani and Voiculescu, Irina and Yang, Guang-Zhong}, 25 | booktitle={2021 43rd Annual International Conference of the IEEE Engineering in Medicine \& Biology Society (EMBC)}, 26 | pages={6933--6936}, 27 | year={2021}, 28 | organization={IEEE} 29 | } 30 | 31 | 32 | 33 | ## Double Robot 34 | The information about Double Robot can be found here: 35 | https://www.doublerobotics.com/ 36 | -------------------------------------------------------------------------------- /Supporting Files/monaco.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/Supporting Files/monaco.ttf -------------------------------------------------------------------------------- /Utils/CameraHelper.m: -------------------------------------------------------------------------------- 1 | 2 | 3 | #import "CameraHelper.h" 4 | 5 | @implementation CameraHelper 6 | 7 | -(void) configureQuality:(DRCameraKit *) camera { 8 | [camera setCameraSettingsWithArray:(cameraSetting *)kCameraSettings1280x960_30FPS]; 9 | }; 10 | 11 | -(void) start: (DRCameraKit *) camera { 12 | [camera startVideo]; 13 | }; 14 | 15 | -(void) stop: (DRCameraKit *) camera { 16 | [camera stopVideo]; 17 | }; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Utils/Collection Extensions.swift: -------------------------------------------------------------------------------- 1 | 2 | 3 | import Foundation 4 | 5 | extension Array where Iterator.Element == CGFloat { 6 | var average: CGFloat? { 7 | guard !isEmpty else { 8 | return nil 9 | } 10 | 11 | var ret = self.reduce(CGFloat(0)) { (cur, next) -> CGFloat in 12 | var cur = cur 13 | cur += next 14 | return cur 15 | } 16 | let fcount = CGFloat(count) 17 | ret /= fcount 18 | return ret 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Utils/UIImage + Extensions.swift: -------------------------------------------------------------------------------- 1 | 2 | 3 | import Foundation 4 | import UIKit 5 | 6 | extension UIImage { 7 | 8 | public func rotated(byDegrees degrees: CGFloat) -> UIImage! { 9 | // calculate the size of the rotated view's containing box for our drawing space 10 | let rotatedViewBox = UIView(frame: CGRect(x: 0, y: 0, width: self.size.width, height: self.size.height)) 11 | let t = CGAffineTransform(rotationAngle: DegreesToRadians(degrees)) 12 | rotatedViewBox.transform = t 13 | let rotatedSize = rotatedViewBox.frame.size 14 | 15 | // Create the bitmap context 16 | UIGraphicsBeginImageContext(rotatedSize) 17 | let bitmap = UIGraphicsGetCurrentContext() 18 | 19 | // Move the origin to the middle of the image so we will rotate and scale around the center. 20 | bitmap?.translateBy(x: rotatedSize.width/2, y: rotatedSize.height/2) 21 | 22 | // // Rotate the image context 23 | bitmap?.rotate(by: DegreesToRadians(degrees)) 24 | 25 | // Now, draw the rotated/scaled image into the context 26 | bitmap?.scaleBy(x: 1.0, y: -1.0) 27 | bitmap?.draw(self.cgImage!, in: CGRect(x: -self.size.width / 2, y: -self.size.height / 2, width: self.size.width, height: self.size.height)) 28 | 29 | let newImage = UIGraphicsGetImageFromCurrentImageContext() 30 | UIGraphicsEndImageContext() 31 | return newImage 32 | 33 | } 34 | 35 | private func DegreesToRadians(_ degrees: CGFloat) -> CGFloat {return degrees * (.pi / 180)} 36 | 37 | } 38 | -------------------------------------------------------------------------------- /demo1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/demo1.png -------------------------------------------------------------------------------- /demo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/demo2.png -------------------------------------------------------------------------------- /demo3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/demo3.png -------------------------------------------------------------------------------- /demo4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/demo4.jpg -------------------------------------------------------------------------------- /demogif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/demogif.gif -------------------------------------------------------------------------------- /iOSOpenPose Loop Experiments-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | #import "OpenCVWrapper.h" 6 | #import "CameraHelper.h" 7 | #import 8 | 9 | -------------------------------------------------------------------------------- /opencv2.framework/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/opencv2.framework/.DS_Store -------------------------------------------------------------------------------- /opencv2.framework/Headers/calib3d/calib3d.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/calib3d.hpp" 49 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/core/bufferpool.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | // 5 | // Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved. 6 | 7 | #ifndef OPENCV_CORE_BUFFER_POOL_HPP 8 | #define OPENCV_CORE_BUFFER_POOL_HPP 9 | 10 | #ifdef _MSC_VER 11 | #pragma warning(push) 12 | #pragma warning(disable: 4265) 13 | #endif 14 | 15 | namespace cv 16 | { 17 | 18 | //! @addtogroup core 19 | //! @{ 20 | 21 | class BufferPoolController 22 | { 23 | protected: 24 | ~BufferPoolController() { } 25 | public: 26 | virtual size_t getReservedSize() const = 0; 27 | virtual size_t getMaxReservedSize() const = 0; 28 | virtual void setMaxReservedSize(size_t size) = 0; 29 | virtual void freeAllReservedBuffers() = 0; 30 | }; 31 | 32 | //! @} 33 | 34 | } 35 | 36 | #ifdef _MSC_VER 37 | #pragma warning(pop) 38 | #endif 39 | 40 | #endif // OPENCV_CORE_BUFFER_POOL_HPP 41 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/core/core.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/core.hpp" 49 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/core/cuda_stream_accessor.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP 44 | #define OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP 45 | 46 | #ifndef __cplusplus 47 | # error cuda_stream_accessor.hpp header must be compiled as C++ 48 | #endif 49 | 50 | /** @file cuda_stream_accessor.hpp 51 | * This is only header file that depends on CUDA Runtime API. All other headers are independent. 52 | */ 53 | 54 | #include 55 | #include "opencv2/core/cuda.hpp" 56 | 57 | namespace cv 58 | { 59 | namespace cuda 60 | { 61 | 62 | //! @addtogroup cudacore_struct 63 | //! @{ 64 | 65 | /** @brief Class that enables getting cudaStream_t from cuda::Stream 66 | */ 67 | struct StreamAccessor 68 | { 69 | CV_EXPORTS static cudaStream_t getStream(const Stream& stream); 70 | CV_EXPORTS static Stream wrapStream(cudaStream_t stream); 71 | }; 72 | 73 | /** @brief Class that enables getting cudaEvent_t from cuda::Event 74 | */ 75 | struct EventAccessor 76 | { 77 | CV_EXPORTS static cudaEvent_t getEvent(const Event& event); 78 | CV_EXPORTS static Event wrapEvent(cudaEvent_t event); 79 | }; 80 | 81 | //! @} 82 | 83 | } 84 | } 85 | 86 | #endif /* OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP */ 87 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/core/ocl_genbase.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the OpenCV Foundation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_OPENCL_GENBASE_HPP 43 | #define OPENCV_OPENCL_GENBASE_HPP 44 | 45 | //! @cond IGNORED 46 | 47 | namespace cv { 48 | namespace ocl { 49 | 50 | class ProgramSource; 51 | 52 | namespace internal { 53 | 54 | struct CV_EXPORTS ProgramEntry 55 | { 56 | const char* module; 57 | const char* name; 58 | const char* programCode; 59 | const char* programHash; 60 | ProgramSource* pProgramSource; 61 | 62 | operator ProgramSource& () const; 63 | }; 64 | 65 | } } } // namespace 66 | 67 | //! @endcond 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/core/ovx.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | // Copyright (C) 2016, Intel Corporation, all rights reserved. 6 | // Third party copyrights are property of their respective owners. 7 | 8 | // OpenVX related definitions and declarations 9 | 10 | #pragma once 11 | #ifndef OPENCV_OVX_HPP 12 | #define OPENCV_OVX_HPP 13 | 14 | #include "cvdef.h" 15 | 16 | namespace cv 17 | { 18 | /// Check if use of OpenVX is possible 19 | CV_EXPORTS_W bool haveOpenVX(); 20 | 21 | /// Check if use of OpenVX is enabled 22 | CV_EXPORTS_W bool useOpenVX(); 23 | 24 | /// Enable/disable use of OpenVX 25 | CV_EXPORTS_W void setUseOpenVX(bool flag); 26 | } // namespace cv 27 | 28 | #endif // OPENCV_OVX_HPP 29 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/core/utils/logger.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_LOGGING_HPP 6 | #define OPENCV_LOGGING_HPP 7 | 8 | #include 9 | #include 10 | #include // INT_MAX 11 | 12 | // TODO This file contains just interface part with implementation stubs. 13 | 14 | //! @addtogroup core_logging 15 | // This section describes OpenCV logging utilities. 16 | // 17 | //! @{ 18 | 19 | namespace cv { 20 | namespace utils { 21 | namespace logging { 22 | 23 | // Supported logging levels and their semantic 24 | #define CV_LOG_LEVEL_SILENT 0 //!< for using in setLogVevel() call 25 | #define CV_LOG_LEVEL_FATAL 1 //!< Fatal (critical) error (unrecoverable internal error) 26 | #define CV_LOG_LEVEL_ERROR 2 //!< Error message 27 | #define CV_LOG_LEVEL_WARN 3 //!< Warning message 28 | #define CV_LOG_LEVEL_INFO 4 //!< Info message 29 | #define CV_LOG_LEVEL_DEBUG 5 //!< Debug message. Disabled in the "Release" build. 30 | #define CV_LOG_LEVEL_VERBOSE 6 //!< Verbose (trace) messages. Requires verbosity level. Disabled in the "Release" build. 31 | 32 | //! Supported logging levels and their semantic 33 | enum LogLevel { 34 | LOG_LEVEL_SILENT = 0, //!< for using in setLogVevel() call 35 | LOG_LEVEL_FATAL = 1, //!< Fatal (critical) error (unrecoverable internal error) 36 | LOG_LEVEL_ERROR = 2, //!< Error message 37 | LOG_LEVEL_WARNING = 3, //!< Warning message 38 | LOG_LEVEL_INFO = 4, //!< Info message 39 | LOG_LEVEL_DEBUG = 5, //!< Debug message. Disabled in the "Release" build. 40 | LOG_LEVEL_VERBOSE = 6, //!< Verbose (trace) messages. Requires verbosity level. Disabled in the "Release" build. 41 | #ifndef CV_DOXYGEN 42 | ENUM_LOG_LEVEL_FORCE_INT = INT_MAX 43 | #endif 44 | }; 45 | 46 | 47 | /** 48 | * \def CV_LOG_STRIP_LEVEL 49 | * 50 | * Define CV_LOG_STRIP_LEVEL=CV_LOG_LEVEL_[DEBUG|INFO|WARN|ERROR|FATAL|DISABLED] to compile out anything at that and before that logging level 51 | */ 52 | #ifndef CV_LOG_STRIP_LEVEL 53 | # if defined NDEBUG 54 | # define CV_LOG_STRIP_LEVEL CV_LOG_LEVEL_DEBUG 55 | # else 56 | # define CV_LOG_STRIP_LEVEL CV_LOG_LEVEL_VERBOSE 57 | # endif 58 | #endif 59 | 60 | 61 | #define CV_LOG_FATAL(tag, ...) for(;;) { std::stringstream ss; ss << "[FATAL:" << cv::utils::getThreadID() << "] " << __VA_ARGS__ << std::endl; std::cerr << ss.str(); break; } 62 | #define CV_LOG_ERROR(tag, ...) for(;;) { std::stringstream ss; ss << "[ERROR:" << cv::utils::getThreadID() << "] " << __VA_ARGS__ << std::endl; std::cerr << ss.str(); break; } 63 | #define CV_LOG_WARNING(tag, ...) for(;;) { std::stringstream ss; ss << "[ WARN:" << cv::utils::getThreadID() << "] " << __VA_ARGS__ << std::endl; std::cout << ss.str(); break; } 64 | #if CV_LOG_STRIP_LEVEL <= CV_LOG_LEVEL_INFO 65 | #define CV_LOG_INFO(tag, ...) 66 | #else 67 | #define CV_LOG_INFO(tag, ...) for(;;) { std::stringstream ss; ss << "[ INFO:" << cv::utils::getThreadID() << "] " << __VA_ARGS__ << std::endl; std::cout << ss.str(); break; } 68 | #endif 69 | #if CV_LOG_STRIP_LEVEL <= CV_LOG_LEVEL_DEBUG 70 | #define CV_LOG_DEBUG(tag, ...) 71 | #else 72 | #define CV_LOG_DEBUG(tag, ...) for(;;) { std::stringstream ss; ss << "[DEBUG:" << cv::utils::getThreadID() << "] " << __VA_ARGS__ << std::endl; std::cout << ss.str(); break; } 73 | #endif 74 | #if CV_LOG_STRIP_LEVEL <= CV_LOG_LEVEL_VERBOSE 75 | #define CV_LOG_VERBOSE(tag, v, ...) 76 | #else 77 | #define CV_LOG_VERBOSE(tag, v, ...) for(;;) { std::stringstream ss; ss << "[VERB" << v << ":" << cv::utils::getThreadID() << "] " << __VA_ARGS__ << std::endl; std::cout << ss.str(); break; } 78 | #endif 79 | 80 | 81 | }}} // namespace 82 | 83 | //! @} 84 | 85 | #endif // OPENCV_LOGGING_HPP 86 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/core/va_intel.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | // Copyright (C) 2015, Itseez, Inc., all rights reserved. 6 | // Third party copyrights are property of their respective owners. 7 | 8 | #ifndef OPENCV_CORE_VA_INTEL_HPP 9 | #define OPENCV_CORE_VA_INTEL_HPP 10 | 11 | #ifndef __cplusplus 12 | # error va_intel.hpp header must be compiled as C++ 13 | #endif 14 | 15 | #include "opencv2/core.hpp" 16 | #include "ocl.hpp" 17 | 18 | #if defined(HAVE_VA) 19 | # include "va/va.h" 20 | #else // HAVE_VA 21 | # if !defined(_VA_H_) 22 | typedef void* VADisplay; 23 | typedef unsigned int VASurfaceID; 24 | # endif // !_VA_H_ 25 | #endif // HAVE_VA 26 | 27 | namespace cv { namespace va_intel { 28 | 29 | /** @addtogroup core_va_intel 30 | This section describes Intel VA-API/OpenCL (CL-VA) interoperability. 31 | 32 | To enable CL-VA interoperability support, configure OpenCV using CMake with WITH_VA_INTEL=ON . Currently VA-API is 33 | supported on Linux only. You should also install Intel Media Server Studio (MSS) to use this feature. You may 34 | have to specify the path(s) to MSS components for cmake in environment variables: VA_INTEL_MSDK_ROOT for Media SDK 35 | (default is "/opt/intel/mediasdk"), and VA_INTEL_IOCL_ROOT for Intel OpenCL (default is "/opt/intel/opencl"). 36 | 37 | To use CL-VA interoperability you should first create VADisplay (libva), and then call initializeContextFromVA() 38 | function to create OpenCL context and set up interoperability. 39 | */ 40 | //! @{ 41 | 42 | /////////////////// CL-VA Interoperability Functions /////////////////// 43 | 44 | namespace ocl { 45 | using namespace cv::ocl; 46 | 47 | // TODO static functions in the Context class 48 | /** @brief Creates OpenCL context from VA. 49 | @param display - VADisplay for which CL interop should be established. 50 | @param tryInterop - try to set up for interoperability, if true; set up for use slow copy if false. 51 | @return Returns reference to OpenCL Context 52 | */ 53 | CV_EXPORTS Context& initializeContextFromVA(VADisplay display, bool tryInterop = true); 54 | 55 | } // namespace cv::va_intel::ocl 56 | 57 | /** @brief Converts InputArray to VASurfaceID object. 58 | @param display - VADisplay object. 59 | @param src - source InputArray. 60 | @param surface - destination VASurfaceID object. 61 | @param size - size of image represented by VASurfaceID object. 62 | */ 63 | CV_EXPORTS void convertToVASurface(VADisplay display, InputArray src, VASurfaceID surface, Size size); 64 | 65 | /** @brief Converts VASurfaceID object to OutputArray. 66 | @param display - VADisplay object. 67 | @param surface - source VASurfaceID object. 68 | @param size - size of image represented by VASurfaceID object. 69 | @param dst - destination OutputArray. 70 | */ 71 | CV_EXPORTS void convertFromVASurface(VADisplay display, VASurfaceID surface, Size size, OutputArray dst); 72 | 73 | //! @} 74 | 75 | }} // namespace cv::va_intel 76 | 77 | #endif /* OPENCV_CORE_VA_INTEL_HPP */ 78 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/core/version.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // Intel License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright( C) 2000-2015, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2011-2013, NVIDIA Corporation, all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Copyright (C) 2015, Itseez Inc., all rights reserved. 17 | // Third party copyrights are property of their respective owners. 18 | // 19 | // Redistribution and use in source and binary forms, with or without modification, 20 | // are permitted provided that the following conditions are met: 21 | // 22 | // * Redistribution's of source code must retain the above copyright notice, 23 | // this list of conditions and the following disclaimer. 24 | // 25 | // * Redistribution's in binary form must reproduce the above copyright notice, 26 | // this list of conditions and the following disclaimer in the documentation 27 | // and/or other materials provided with the distribution. 28 | // 29 | // * The name of Intel Corporation may not be used to endorse or promote products 30 | // derived from this software without specific prior written permission. 31 | // 32 | // This software is provided by the copyright holders and contributors "as is" and 33 | // any express or implied warranties, including, but not limited to, the implied 34 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 35 | // In no event shall the Intel Corporation or contributors be liable for any direct, 36 | // indirect, incidental, special, exemplary, or consequential damages 37 | //(including, but not limited to, procurement of substitute goods or services; 38 | // loss of use, data, or profits; or business interruption) however caused 39 | // and on any theory of liability, whether in contract, strict liability, 40 | // or tort(including negligence or otherwise) arising in any way out of 41 | // the use of this software, even if advised of the possibility of such damage. 42 | // 43 | //M*/ 44 | 45 | /* 46 | definition of the current version of OpenCV 47 | Usefull to test in user programs 48 | */ 49 | 50 | #ifndef OPENCV_VERSION_HPP 51 | #define OPENCV_VERSION_HPP 52 | 53 | #define CV_VERSION_MAJOR 3 54 | #define CV_VERSION_MINOR 3 55 | #define CV_VERSION_REVISION 1 56 | #define CV_VERSION_STATUS "" 57 | 58 | #define CVAUX_STR_EXP(__A) #__A 59 | #define CVAUX_STR(__A) CVAUX_STR_EXP(__A) 60 | 61 | #define CVAUX_STRW_EXP(__A) L ## #__A 62 | #define CVAUX_STRW(__A) CVAUX_STRW_EXP(__A) 63 | 64 | #define CV_VERSION CVAUX_STR(CV_VERSION_MAJOR) "." CVAUX_STR(CV_VERSION_MINOR) "." CVAUX_STR(CV_VERSION_REVISION) CV_VERSION_STATUS 65 | 66 | /* old style version constants*/ 67 | #define CV_MAJOR_VERSION CV_VERSION_MAJOR 68 | #define CV_MINOR_VERSION CV_VERSION_MINOR 69 | #define CV_SUBMINOR_VERSION CV_VERSION_REVISION 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/dnn.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the Intel Corporation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_DNN_HPP 43 | #define OPENCV_DNN_HPP 44 | 45 | // This is an umbrealla header to include into you project. 46 | // We are free to change headers layout in dnn subfolder, so please include 47 | // this header for future compatibility 48 | 49 | 50 | /** @defgroup dnn Deep Neural Network module 51 | @{ 52 | This module contains: 53 | - API for new layers creation, layers are building bricks of neural networks; 54 | - set of built-in most-useful Layers; 55 | - API to constuct and modify comprehensive neural networks from layers; 56 | - functionality for loading serialized networks models from differnet frameworks. 57 | 58 | Functionality of this module is designed only for forward pass computations (i. e. network testing). 59 | A network training is in principle not supported. 60 | @} 61 | */ 62 | #include 63 | 64 | #endif /* OPENCV_DNN_HPP */ 65 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/dnn/layer.details.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | // 5 | #ifndef OPENCV_DNN_LAYER_DETAILS_HPP 6 | #define OPENCV_DNN_LAYER_DETAILS_HPP 7 | 8 | #include 9 | 10 | namespace cv { 11 | namespace dnn { 12 | CV__DNN_EXPERIMENTAL_NS_BEGIN 13 | 14 | /** @brief Registers layer constructor in runtime. 15 | * @param type string, containing type name of the layer. 16 | * @param constuctorFunc pointer to the function of type LayerRegister::Constuctor, which creates the layer. 17 | * @details This macros must be placed inside the function code. 18 | */ 19 | #define CV_DNN_REGISTER_LAYER_FUNC(type, constuctorFunc) \ 20 | cv::dnn::LayerFactory::registerLayer(#type, constuctorFunc); 21 | 22 | /** @brief Registers layer class in runtime. 23 | * @param type string, containing type name of the layer. 24 | * @param class C++ class, derived from Layer. 25 | * @details This macros must be placed inside the function code. 26 | */ 27 | #define CV_DNN_REGISTER_LAYER_CLASS(type, class) \ 28 | cv::dnn::LayerFactory::registerLayer(#type, cv::dnn::details::_layerDynamicRegisterer); 29 | 30 | /** @brief Registers layer constructor on module load time. 31 | * @param type string, containing type name of the layer. 32 | * @param constuctorFunc pointer to the function of type LayerRegister::Constuctor, which creates the layer. 33 | * @details This macros must be placed outside the function code. 34 | */ 35 | #define CV_DNN_REGISTER_LAYER_FUNC_STATIC(type, constuctorFunc) \ 36 | static cv::dnn::details::_LayerStaticRegisterer __LayerStaticRegisterer_##type(#type, constuctorFunc); 37 | 38 | /** @brief Registers layer class on module load time. 39 | * @param type string, containing type name of the layer. 40 | * @param class C++ class, derived from Layer. 41 | * @details This macros must be placed outside the function code. 42 | */ 43 | #define CV_DNN_REGISTER_LAYER_CLASS_STATIC(type, class) \ 44 | Ptr __LayerStaticRegisterer_func_##type(LayerParams ¶ms) \ 45 | { return Ptr(new class(params)); } \ 46 | static cv::dnn::details::_LayerStaticRegisterer __LayerStaticRegisterer_##type(#type, __LayerStaticRegisterer_func_##type); 47 | 48 | namespace details { 49 | 50 | template 51 | Ptr _layerDynamicRegisterer(LayerParams ¶ms) 52 | { 53 | return Ptr(LayerClass::create(params)); 54 | } 55 | 56 | //allows automatically register created layer on module load time 57 | class _LayerStaticRegisterer 58 | { 59 | String type; 60 | public: 61 | 62 | _LayerStaticRegisterer(const String &layerType, LayerFactory::Constuctor layerConstuctor) 63 | { 64 | this->type = layerType; 65 | LayerFactory::registerLayer(layerType, layerConstuctor); 66 | } 67 | 68 | ~_LayerStaticRegisterer() 69 | { 70 | LayerFactory::unregisterLayer(type); 71 | } 72 | }; 73 | 74 | } // namespace 75 | CV__DNN_EXPERIMENTAL_NS_END 76 | }} // namespace 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/dnn/layer.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the Intel Corporation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_DNN_LAYER_HPP 43 | #define OPENCV_DNN_LAYER_HPP 44 | #include 45 | 46 | namespace cv { 47 | namespace dnn { 48 | CV__DNN_EXPERIMENTAL_NS_BEGIN 49 | //! @addtogroup dnn 50 | //! @{ 51 | //! 52 | //! @defgroup dnnLayerFactory Utilities for New Layers Registration 53 | //! @{ 54 | 55 | /** @brief %Layer factory allows to create instances of registered layers. */ 56 | class CV_EXPORTS LayerFactory 57 | { 58 | public: 59 | 60 | //! Each Layer class must provide this function to the factory 61 | typedef Ptr(*Constuctor)(LayerParams ¶ms); 62 | 63 | //! Registers the layer class with typename @p type and specified @p constructor. Thread-safe. 64 | static void registerLayer(const String &type, Constuctor constructor); 65 | 66 | //! Unregisters registered layer with specified type name. Thread-safe. 67 | static void unregisterLayer(const String &type); 68 | 69 | /** @brief Creates instance of registered layer. 70 | * @param type type name of creating layer. 71 | * @param params parameters which will be used for layer initialization. 72 | * @note Thread-safe. 73 | */ 74 | static Ptr createLayerInstance(const String &type, LayerParams& params); 75 | 76 | private: 77 | LayerFactory(); 78 | }; 79 | 80 | //! @} 81 | //! @} 82 | CV__DNN_EXPERIMENTAL_NS_END 83 | } 84 | } 85 | #endif 86 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/features2d/features2d.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/features2d.hpp" 49 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/flann/config.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | * Software License Agreement (BSD License) 3 | * 4 | * Copyright 2008-2011 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. 5 | * Copyright 2008-2011 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | *************************************************************************/ 28 | 29 | 30 | #ifndef OPENCV_FLANN_CONFIG_H_ 31 | #define OPENCV_FLANN_CONFIG_H_ 32 | 33 | #ifdef FLANN_VERSION_ 34 | #undef FLANN_VERSION_ 35 | #endif 36 | #define FLANN_VERSION_ "1.6.10" 37 | 38 | #endif /* OPENCV_FLANN_CONFIG_H_ */ 39 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/flann/dummy.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef OPENCV_FLANN_DUMMY_H_ 3 | #define OPENCV_FLANN_DUMMY_H_ 4 | 5 | namespace cvflann 6 | { 7 | 8 | #if (defined _WIN32 || defined WINCE) && defined CVAPI_EXPORTS 9 | __declspec(dllexport) 10 | #endif 11 | void dummyfunc(); 12 | 13 | } 14 | 15 | 16 | #endif /* OPENCV_FLANN_DUMMY_H_ */ 17 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/flann/flann.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/flann.hpp" 49 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/flann/general.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | * Software License Agreement (BSD License) 3 | * 4 | * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. 5 | * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. 6 | * 7 | * THE BSD LICENSE 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | *************************************************************************/ 30 | 31 | #ifndef OPENCV_FLANN_GENERAL_H_ 32 | #define OPENCV_FLANN_GENERAL_H_ 33 | 34 | #include "opencv2/core.hpp" 35 | 36 | namespace cvflann 37 | { 38 | 39 | class FLANNException : public cv::Exception 40 | { 41 | public: 42 | FLANNException(const char* message) : cv::Exception(0, message, "", __FILE__, __LINE__) { } 43 | 44 | FLANNException(const cv::String& message) : cv::Exception(0, message, "", __FILE__, __LINE__) { } 45 | }; 46 | 47 | } 48 | 49 | 50 | #endif /* OPENCV_FLANN_GENERAL_H_ */ 51 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/flann/ground_truth.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | * Software License Agreement (BSD License) 3 | * 4 | * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. 5 | * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. 6 | * 7 | * THE BSD LICENSE 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | *************************************************************************/ 30 | 31 | #ifndef OPENCV_FLANN_GROUND_TRUTH_H_ 32 | #define OPENCV_FLANN_GROUND_TRUTH_H_ 33 | 34 | #include "dist.h" 35 | #include "matrix.h" 36 | 37 | 38 | namespace cvflann 39 | { 40 | 41 | template 42 | void find_nearest(const Matrix& dataset, typename Distance::ElementType* query, int* matches, int nn, 43 | int skip = 0, Distance distance = Distance()) 44 | { 45 | typedef typename Distance::ResultType DistanceType; 46 | int n = nn + skip; 47 | 48 | std::vector match(n); 49 | std::vector dists(n); 50 | 51 | dists[0] = distance(dataset[0], query, dataset.cols); 52 | match[0] = 0; 53 | int dcnt = 1; 54 | 55 | for (size_t i=1; i=1 && dists[j] 83 | void compute_ground_truth(const Matrix& dataset, const Matrix& testset, Matrix& matches, 84 | int skip=0, Distance d = Distance()) 85 | { 86 | for (size_t i=0; i(dataset, testset[i], matches[i], (int)matches.cols, skip, d); 88 | } 89 | } 90 | 91 | 92 | } 93 | 94 | #endif //OPENCV_FLANN_GROUND_TRUTH_H_ 95 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/flann/matrix.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | * Software License Agreement (BSD License) 3 | * 4 | * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. 5 | * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. 6 | * 7 | * THE BSD LICENSE 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | *************************************************************************/ 30 | 31 | #ifndef OPENCV_FLANN_DATASET_H_ 32 | #define OPENCV_FLANN_DATASET_H_ 33 | 34 | #include 35 | 36 | #include "general.h" 37 | 38 | namespace cvflann 39 | { 40 | 41 | /** 42 | * Class that implements a simple rectangular matrix stored in a memory buffer and 43 | * provides convenient matrix-like access using the [] operators. 44 | */ 45 | template 46 | class Matrix 47 | { 48 | public: 49 | typedef T type; 50 | 51 | size_t rows; 52 | size_t cols; 53 | size_t stride; 54 | T* data; 55 | 56 | Matrix() : rows(0), cols(0), stride(0), data(NULL) 57 | { 58 | } 59 | 60 | Matrix(T* data_, size_t rows_, size_t cols_, size_t stride_ = 0) : 61 | rows(rows_), cols(cols_), stride(stride_), data(data_) 62 | { 63 | if (stride==0) stride = cols; 64 | } 65 | 66 | /** 67 | * Convenience function for deallocating the storage data. 68 | */ 69 | CV_DEPRECATED void free() 70 | { 71 | fprintf(stderr, "The cvflann::Matrix::free() method is deprecated " 72 | "and it does not do any memory deallocation any more. You are" 73 | "responsible for deallocating the matrix memory (by doing" 74 | "'delete[] matrix.data' for example)"); 75 | } 76 | 77 | /** 78 | * Operator that return a (pointer to a) row of the data. 79 | */ 80 | T* operator[](size_t index) const 81 | { 82 | return data+index*stride; 83 | } 84 | }; 85 | 86 | 87 | class UntypedMatrix 88 | { 89 | public: 90 | size_t rows; 91 | size_t cols; 92 | void* data; 93 | flann_datatype_t type; 94 | 95 | UntypedMatrix(void* data_, long rows_, long cols_) : 96 | rows(rows_), cols(cols_), data(data_) 97 | { 98 | } 99 | 100 | ~UntypedMatrix() 101 | { 102 | } 103 | 104 | 105 | template 106 | Matrix as() 107 | { 108 | return Matrix((T*)data, rows, cols); 109 | } 110 | }; 111 | 112 | 113 | 114 | } 115 | 116 | #endif //OPENCV_FLANN_DATASET_H_ 117 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/flann/object_factory.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | * Software License Agreement (BSD License) 3 | * 4 | * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. 5 | * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. 6 | * 7 | * THE BSD LICENSE 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | *************************************************************************/ 30 | 31 | #ifndef OPENCV_FLANN_OBJECT_FACTORY_H_ 32 | #define OPENCV_FLANN_OBJECT_FACTORY_H_ 33 | 34 | #include 35 | 36 | namespace cvflann 37 | { 38 | 39 | class CreatorNotFound 40 | { 41 | }; 42 | 43 | template 46 | class ObjectFactory 47 | { 48 | typedef ObjectFactory ThisClass; 49 | typedef std::map ObjectRegistry; 50 | 51 | // singleton class, private constructor 52 | ObjectFactory() {} 53 | 54 | public: 55 | 56 | bool subscribe(UniqueIdType id, ObjectCreator creator) 57 | { 58 | if (object_registry.find(id) != object_registry.end()) return false; 59 | 60 | object_registry[id] = creator; 61 | return true; 62 | } 63 | 64 | bool unregister(UniqueIdType id) 65 | { 66 | return object_registry.erase(id) == 1; 67 | } 68 | 69 | ObjectCreator create(UniqueIdType id) 70 | { 71 | typename ObjectRegistry::const_iterator iter = object_registry.find(id); 72 | 73 | if (iter == object_registry.end()) { 74 | throw CreatorNotFound(); 75 | } 76 | 77 | return iter->second; 78 | } 79 | 80 | static ThisClass& instance() 81 | { 82 | static ThisClass the_factory; 83 | return the_factory; 84 | } 85 | private: 86 | ObjectRegistry object_registry; 87 | }; 88 | 89 | } 90 | 91 | #endif /* OPENCV_FLANN_OBJECT_FACTORY_H_ */ 92 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/flann/params.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | * Software License Agreement (BSD License) 3 | * 4 | * Copyright 2008-2011 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. 5 | * Copyright 2008-2011 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | *************************************************************************/ 28 | 29 | 30 | #ifndef OPENCV_FLANN_PARAMS_H_ 31 | #define OPENCV_FLANN_PARAMS_H_ 32 | 33 | #include "any.h" 34 | #include "general.h" 35 | #include 36 | #include 37 | 38 | 39 | namespace cvflann 40 | { 41 | 42 | typedef std::map IndexParams; 43 | 44 | struct SearchParams : public IndexParams 45 | { 46 | SearchParams(int checks = 32, float eps = 0, bool sorted = true ) 47 | { 48 | // how many leafs to visit when searching for neighbours (-1 for unlimited) 49 | (*this)["checks"] = checks; 50 | // search for eps-approximate neighbours (default: 0) 51 | (*this)["eps"] = eps; 52 | // only for radius search, require neighbours sorted by distance (default: true) 53 | (*this)["sorted"] = sorted; 54 | } 55 | }; 56 | 57 | 58 | template 59 | T get_param(const IndexParams& params, cv::String name, const T& default_value) 60 | { 61 | IndexParams::const_iterator it = params.find(name); 62 | if (it != params.end()) { 63 | return it->second.cast(); 64 | } 65 | else { 66 | return default_value; 67 | } 68 | } 69 | 70 | template 71 | T get_param(const IndexParams& params, cv::String name) 72 | { 73 | IndexParams::const_iterator it = params.find(name); 74 | if (it != params.end()) { 75 | return it->second.cast(); 76 | } 77 | else { 78 | throw FLANNException(cv::String("Missing parameter '")+name+cv::String("' in the parameters given")); 79 | } 80 | } 81 | 82 | inline void print_params(const IndexParams& params, std::ostream& stream) 83 | { 84 | IndexParams::const_iterator it; 85 | 86 | for(it=params.begin(); it!=params.end(); ++it) { 87 | stream << it->first << " : " << it->second << std::endl; 88 | } 89 | } 90 | 91 | inline void print_params(const IndexParams& params) 92 | { 93 | print_params(params, std::cout); 94 | } 95 | 96 | } 97 | 98 | 99 | #endif /* OPENCV_FLANN_PARAMS_H_ */ 100 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/flann/sampling.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | * Software License Agreement (BSD License) 3 | * 4 | * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. 5 | * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | *************************************************************************/ 28 | 29 | 30 | #ifndef OPENCV_FLANN_SAMPLING_H_ 31 | #define OPENCV_FLANN_SAMPLING_H_ 32 | 33 | #include "matrix.h" 34 | #include "random.h" 35 | 36 | namespace cvflann 37 | { 38 | 39 | template 40 | Matrix random_sample(Matrix& srcMatrix, long size, bool remove = false) 41 | { 42 | Matrix newSet(new T[size * srcMatrix.cols], size,srcMatrix.cols); 43 | 44 | T* src,* dest; 45 | for (long i=0; i 63 | Matrix random_sample(const Matrix& srcMatrix, size_t size) 64 | { 65 | UniqueRandom rand((int)srcMatrix.rows); 66 | Matrix newSet(new T[size * srcMatrix.cols], size,srcMatrix.cols); 67 | 68 | T* src,* dest; 69 | for (size_t i=0; i 35 | #include "opencv2/core.hpp" 36 | #include "opencv2/core/utility.hpp" 37 | 38 | namespace cvflann 39 | { 40 | 41 | /** 42 | * A start-stop timer class. 43 | * 44 | * Can be used to time portions of code. 45 | */ 46 | class StartStopTimer 47 | { 48 | int64 startTime; 49 | 50 | public: 51 | /** 52 | * Value of the timer. 53 | */ 54 | double value; 55 | 56 | 57 | /** 58 | * Constructor. 59 | */ 60 | StartStopTimer() 61 | { 62 | reset(); 63 | } 64 | 65 | /** 66 | * Starts the timer. 67 | */ 68 | void start() 69 | { 70 | startTime = cv::getTickCount(); 71 | } 72 | 73 | /** 74 | * Stops the timer and updates timer value. 75 | */ 76 | void stop() 77 | { 78 | int64 stopTime = cv::getTickCount(); 79 | value += ( (double)stopTime - startTime) / cv::getTickFrequency(); 80 | } 81 | 82 | /** 83 | * Resets the timer value to 0. 84 | */ 85 | void reset() 86 | { 87 | value = 0; 88 | } 89 | 90 | }; 91 | 92 | } 93 | 94 | #endif // FLANN_TIMER_H 95 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/highgui/highgui.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/highgui.hpp" 49 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/imgcodecs/imgcodecs.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/imgcodecs.hpp" 49 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/imgcodecs/ios.h: -------------------------------------------------------------------------------- 1 | 2 | /*M/////////////////////////////////////////////////////////////////////////////////////// 3 | // 4 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 5 | // 6 | // By downloading, copying, installing or using the software you agree to this license. 7 | // If you do not agree to this license, do not download, install, 8 | // copy or use the software. 9 | // 10 | // 11 | // License Agreement 12 | // For Open Source Computer Vision Library 13 | // 14 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 15 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #import 45 | #import 46 | #import 47 | #import 48 | #include "opencv2/core/core.hpp" 49 | 50 | //! @addtogroup imgcodecs_ios 51 | //! @{ 52 | 53 | UIImage* MatToUIImage(const cv::Mat& image); 54 | void UIImageToMat(const UIImage* image, 55 | cv::Mat& m, bool alphaExist = false); 56 | 57 | //! @} 58 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/imgproc/hal/interface.h: -------------------------------------------------------------------------------- 1 | #ifndef OPENCV_IMGPROC_HAL_INTERFACE_H 2 | #define OPENCV_IMGPROC_HAL_INTERFACE_H 3 | 4 | //! @addtogroup imgproc_hal_interface 5 | //! @{ 6 | 7 | //! @name Interpolation modes 8 | //! @sa cv::InterpolationFlags 9 | //! @{ 10 | #define CV_HAL_INTER_NEAREST 0 11 | #define CV_HAL_INTER_LINEAR 1 12 | #define CV_HAL_INTER_CUBIC 2 13 | #define CV_HAL_INTER_AREA 3 14 | #define CV_HAL_INTER_LANCZOS4 4 15 | //! @} 16 | 17 | //! @name Morphology operations 18 | //! @sa cv::MorphTypes 19 | //! @{ 20 | #define CV_HAL_MORPH_ERODE 0 21 | #define CV_HAL_MORPH_DILATE 1 22 | //! @} 23 | 24 | //! @} 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/imgproc/imgproc.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/imgproc.hpp" 49 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/ml/ml.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/ml.hpp" 49 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/objdetect/objdetect.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/objdetect.hpp" 49 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/opencv_modules.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ** File generated automatically, do not modify ** 3 | * 4 | * This file defines the list of modules available in current build configuration 5 | * 6 | * 7 | */ 8 | 9 | // This definition means that OpenCV is built with enabled non-free code. 10 | // For example, patented algorithms for non-profit/non-commercial use only. 11 | /* #undef OPENCV_ENABLE_NONFREE */ 12 | 13 | #define HAVE_OPENCV_CALIB3D 14 | #define HAVE_OPENCV_CORE 15 | #define HAVE_OPENCV_DNN 16 | #define HAVE_OPENCV_FEATURES2D 17 | #define HAVE_OPENCV_FLANN 18 | #define HAVE_OPENCV_HIGHGUI 19 | #define HAVE_OPENCV_IMGCODECS 20 | #define HAVE_OPENCV_IMGPROC 21 | #define HAVE_OPENCV_ML 22 | #define HAVE_OPENCV_OBJDETECT 23 | #define HAVE_OPENCV_PHOTO 24 | #define HAVE_OPENCV_SHAPE 25 | #define HAVE_OPENCV_STITCHING 26 | #define HAVE_OPENCV_VIDEO 27 | #define HAVE_OPENCV_VIDEOIO 28 | #define HAVE_OPENCV_VIDEOSTAB 29 | #define HAVE_OPENCV_WORLD 30 | 31 | 32 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/photo/photo.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/photo.hpp" 49 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/photo/photo_c.h: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2008-2012, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_PHOTO_C_H 44 | #define OPENCV_PHOTO_C_H 45 | 46 | #include "opencv2/core/core_c.h" 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | /** @addtogroup photo_c 53 | @{ 54 | */ 55 | 56 | /* Inpainting algorithms */ 57 | enum InpaintingModes 58 | { 59 | CV_INPAINT_NS =0, 60 | CV_INPAINT_TELEA =1 61 | }; 62 | 63 | 64 | /* Inpaints the selected region in the image */ 65 | CVAPI(void) cvInpaint( const CvArr* src, const CvArr* inpaint_mask, 66 | CvArr* dst, double inpaintRange, int flags ); 67 | 68 | /** @} */ 69 | 70 | #ifdef __cplusplus 71 | } //extern "C" 72 | #endif 73 | 74 | #endif //OPENCV_PHOTO_C_H 75 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/shape.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009-2012, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_SHAPE_HPP 44 | #define OPENCV_SHAPE_HPP 45 | 46 | #include "opencv2/shape/emdL1.hpp" 47 | #include "opencv2/shape/shape_transformer.hpp" 48 | #include "opencv2/shape/hist_cost.hpp" 49 | #include "opencv2/shape/shape_distance.hpp" 50 | 51 | /** 52 | @defgroup shape Shape Distance and Matching 53 | */ 54 | 55 | #endif 56 | 57 | /* End of file. */ 58 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/shape/emdL1.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009-2012, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_EMD_L1_HPP 44 | #define OPENCV_EMD_L1_HPP 45 | 46 | #include "opencv2/core.hpp" 47 | 48 | namespace cv 49 | { 50 | /****************************************************************************************\ 51 | * EMDL1 Function * 52 | \****************************************************************************************/ 53 | 54 | //! @addtogroup shape 55 | //! @{ 56 | 57 | /** @brief Computes the "minimal work" distance between two weighted point configurations base on the papers 58 | "EMD-L1: An efficient and Robust Algorithm for comparing histogram-based descriptors", by Haibin 59 | Ling and Kazunori Okuda; and "The Earth Mover's Distance is the Mallows Distance: Some Insights from 60 | Statistics", by Elizaveta Levina and Peter Bickel. 61 | 62 | @param signature1 First signature, a single column floating-point matrix. Each row is the value of 63 | the histogram in each bin. 64 | @param signature2 Second signature of the same format and size as signature1. 65 | */ 66 | CV_EXPORTS float EMDL1(InputArray signature1, InputArray signature2); 67 | 68 | //! @} 69 | 70 | }//namespace cv 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/shape/shape.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/shape.hpp" 49 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/stitching/detail/autocalib.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_STITCHING_AUTOCALIB_HPP 44 | #define OPENCV_STITCHING_AUTOCALIB_HPP 45 | 46 | #include "opencv2/core.hpp" 47 | #include "matchers.hpp" 48 | 49 | namespace cv { 50 | namespace detail { 51 | 52 | //! @addtogroup stitching_autocalib 53 | //! @{ 54 | 55 | /** @brief Tries to estimate focal lengths from the given homography under the assumption that the camera 56 | undergoes rotations around its centre only. 57 | 58 | @param H Homography. 59 | @param f0 Estimated focal length along X axis. 60 | @param f1 Estimated focal length along Y axis. 61 | @param f0_ok True, if f0 was estimated successfully, false otherwise. 62 | @param f1_ok True, if f1 was estimated successfully, false otherwise. 63 | 64 | See "Construction of Panoramic Image Mosaics with Global and Local Alignment" 65 | by Heung-Yeung Shum and Richard Szeliski. 66 | */ 67 | void CV_EXPORTS focalsFromHomography(const Mat &H, double &f0, double &f1, bool &f0_ok, bool &f1_ok); 68 | 69 | /** @brief Estimates focal lengths for each given camera. 70 | 71 | @param features Features of images. 72 | @param pairwise_matches Matches between all image pairs. 73 | @param focals Estimated focal lengths for each camera. 74 | */ 75 | void CV_EXPORTS estimateFocal(const std::vector &features, 76 | const std::vector &pairwise_matches, 77 | std::vector &focals); 78 | 79 | bool CV_EXPORTS calibrateRotatingCamera(const std::vector &Hs, Mat &K); 80 | 81 | //! @} stitching_autocalib 82 | 83 | } // namespace detail 84 | } // namespace cv 85 | 86 | #endif // OPENCV_STITCHING_AUTOCALIB_HPP 87 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/stitching/detail/camera.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_STITCHING_CAMERA_HPP 44 | #define OPENCV_STITCHING_CAMERA_HPP 45 | 46 | #include "opencv2/core.hpp" 47 | 48 | namespace cv { 49 | namespace detail { 50 | 51 | //! @addtogroup stitching 52 | //! @{ 53 | 54 | /** @brief Describes camera parameters. 55 | 56 | @note Translation is assumed to be zero during the whole stitching pipeline. : 57 | */ 58 | struct CV_EXPORTS CameraParams 59 | { 60 | CameraParams(); 61 | CameraParams(const CameraParams& other); 62 | CameraParams& operator =(const CameraParams& other); 63 | Mat K() const; 64 | 65 | double focal; // Focal length 66 | double aspect; // Aspect ratio 67 | double ppx; // Principal point X 68 | double ppy; // Principal point Y 69 | Mat R; // Rotation 70 | Mat t; // Translation 71 | }; 72 | 73 | //! @} 74 | 75 | } // namespace detail 76 | } // namespace cv 77 | 78 | #endif // #ifndef OPENCV_STITCHING_CAMERA_HPP 79 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/stitching/detail/timelapsers.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | 44 | #ifndef OPENCV_STITCHING_TIMELAPSERS_HPP 45 | #define OPENCV_STITCHING_TIMELAPSERS_HPP 46 | 47 | #include "opencv2/core.hpp" 48 | 49 | namespace cv { 50 | namespace detail { 51 | 52 | //! @addtogroup stitching 53 | //! @{ 54 | 55 | // Base Timelapser class, takes a sequence of images, applies appropriate shift, stores result in dst_. 56 | 57 | class CV_EXPORTS Timelapser 58 | { 59 | public: 60 | 61 | enum {AS_IS, CROP}; 62 | 63 | virtual ~Timelapser() {} 64 | 65 | static Ptr createDefault(int type); 66 | 67 | virtual void initialize(const std::vector &corners, const std::vector &sizes); 68 | virtual void process(InputArray img, InputArray mask, Point tl); 69 | virtual const UMat& getDst() {return dst_;} 70 | 71 | protected: 72 | 73 | virtual bool test_point(Point pt); 74 | 75 | UMat dst_; 76 | Rect dst_roi_; 77 | }; 78 | 79 | 80 | class CV_EXPORTS TimelapserCrop : public Timelapser 81 | { 82 | public: 83 | virtual void initialize(const std::vector &corners, const std::vector &sizes); 84 | }; 85 | 86 | //! @} 87 | 88 | } // namespace detail 89 | } // namespace cv 90 | 91 | #endif // OPENCV_STITCHING_TIMELAPSERS_HPP 92 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/video.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifndef OPENCV_VIDEO_HPP 45 | #define OPENCV_VIDEO_HPP 46 | 47 | /** 48 | @defgroup video Video Analysis 49 | @{ 50 | @defgroup video_motion Motion Analysis 51 | @defgroup video_track Object Tracking 52 | @defgroup video_c C API 53 | @} 54 | */ 55 | 56 | #include "opencv2/video/tracking.hpp" 57 | #include "opencv2/video/background_segm.hpp" 58 | 59 | #ifndef DISABLE_OPENCV_24_COMPATIBILITY 60 | #include "opencv2/video/tracking_c.h" 61 | #endif 62 | 63 | #endif //OPENCV_VIDEO_HPP 64 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/video/video.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/video.hpp" 49 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/videoio/videoio.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/videoio.hpp" 49 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/videostab/frame_source.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_VIDEOSTAB_FRAME_SOURCE_HPP 44 | #define OPENCV_VIDEOSTAB_FRAME_SOURCE_HPP 45 | 46 | #include 47 | #include "opencv2/core.hpp" 48 | 49 | namespace cv 50 | { 51 | namespace videostab 52 | { 53 | 54 | //! @addtogroup videostab 55 | //! @{ 56 | 57 | class CV_EXPORTS IFrameSource 58 | { 59 | public: 60 | virtual ~IFrameSource() {} 61 | virtual void reset() = 0; 62 | virtual Mat nextFrame() = 0; 63 | }; 64 | 65 | class CV_EXPORTS NullFrameSource : public IFrameSource 66 | { 67 | public: 68 | virtual void reset() {} 69 | virtual Mat nextFrame() { return Mat(); } 70 | }; 71 | 72 | class CV_EXPORTS VideoFileSource : public IFrameSource 73 | { 74 | public: 75 | VideoFileSource(const String &path, bool volatileFrame = false); 76 | 77 | virtual void reset(); 78 | virtual Mat nextFrame(); 79 | 80 | int width(); 81 | int height(); 82 | int count(); 83 | double fps(); 84 | 85 | private: 86 | Ptr impl; 87 | }; 88 | 89 | //! @} 90 | 91 | } // namespace videostab 92 | } // namespace cv 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/videostab/log.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_VIDEOSTAB_LOG_HPP 44 | #define OPENCV_VIDEOSTAB_LOG_HPP 45 | 46 | #include "opencv2/core.hpp" 47 | 48 | namespace cv 49 | { 50 | namespace videostab 51 | { 52 | 53 | //! @addtogroup videostab 54 | //! @{ 55 | 56 | class CV_EXPORTS ILog 57 | { 58 | public: 59 | virtual ~ILog() {} 60 | virtual void print(const char *format, ...) = 0; 61 | }; 62 | 63 | class CV_EXPORTS NullLog : public ILog 64 | { 65 | public: 66 | virtual void print(const char * /*format*/, ...) {} 67 | }; 68 | 69 | class CV_EXPORTS LogToStdout : public ILog 70 | { 71 | public: 72 | virtual void print(const char *format, ...); 73 | }; 74 | 75 | //! @} 76 | 77 | } // namespace videostab 78 | } // namespace cv 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/videostab/ring_buffer.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_VIDEOSTAB_RING_BUFFER_HPP 44 | #define OPENCV_VIDEOSTAB_RING_BUFFER_HPP 45 | 46 | #include 47 | #include "opencv2/imgproc.hpp" 48 | 49 | namespace cv 50 | { 51 | namespace videostab 52 | { 53 | 54 | //! @addtogroup videostab 55 | //! @{ 56 | 57 | template inline T& at(int idx, std::vector &items) 58 | { 59 | return items[cv::borderInterpolate(idx, static_cast(items.size()), cv::BORDER_WRAP)]; 60 | } 61 | 62 | template inline const T& at(int idx, const std::vector &items) 63 | { 64 | return items[cv::borderInterpolate(idx, static_cast(items.size()), cv::BORDER_WRAP)]; 65 | } 66 | 67 | //! @} 68 | 69 | } // namespace videostab 70 | } // namespace cv 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /opencv2.framework/Headers/world.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009-2010, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_WORLD_HPP 44 | #define OPENCV_WORLD_HPP 45 | 46 | #include "opencv2/core.hpp" 47 | 48 | #ifdef __cplusplus 49 | namespace cv 50 | { 51 | 52 | CV_EXPORTS_W bool initAll(); 53 | 54 | } 55 | 56 | #endif 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /opencv2.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/opencv2.framework/Info.plist -------------------------------------------------------------------------------- /opencv2.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module opencv2 { 2 | umbrella header "OpenCV-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /opencv2.framework/opencv2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ziyangwang007/Realtime-Openpose-on-iOS-with-Double-Robot/bb6dbe40afb09a17c9dbd9f036c3d144efa2682f/opencv2.framework/opencv2 --------------------------------------------------------------------------------