EstervQrCode 2.0.0
Library for qr code manipulation
Loading...
Searching...
No Matches
cap_ios.h
1/* For iOS video I/O
2 * by Eduard Feicho on 29/07/12
3 * Copyright 2012. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 */
28
29#import <UIKit/UIKit.h>
30#import <Accelerate/Accelerate.h>
31#import <AVFoundation/AVFoundation.h>
32#import <ImageIO/ImageIO.h>
33#include "opencv2/core.hpp"
34
37
39
40@class CvAbstractCamera;
41
42CV_EXPORTS @interface CvAbstractCamera : NSObject
43{
44 UIDeviceOrientation currentDeviceOrientation;
45
47}
48
49@property (nonatomic, strong) AVCaptureSession* captureSession;
50@property (nonatomic, strong) AVCaptureConnection* videoCaptureConnection;
51
52@property (nonatomic, readonly) BOOL running;
53@property (nonatomic, readonly) BOOL captureSessionLoaded;
54
55@property (nonatomic, assign) int defaultFPS;
56@property (nonatomic, readonly) AVCaptureVideoPreviewLayer *captureVideoPreviewLayer;
57@property (nonatomic, assign) AVCaptureDevicePosition defaultAVCaptureDevicePosition;
58@property (nonatomic, assign) AVCaptureVideoOrientation defaultAVCaptureVideoOrientation;
59@property (nonatomic, assign) BOOL useAVCaptureVideoPreviewLayer;
60@property (nonatomic, strong) NSString *const defaultAVCaptureSessionPreset;
61
62@property (nonatomic, assign) int imageWidth;
63@property (nonatomic, assign) int imageHeight;
64
65@property (nonatomic, strong) UIView* parentView;
66
67- CV_UNUSED(start);
68- CV_UNUSED(stop);
69- CV_UNUSED(switchCameras);
70
71- (id)initWithParentView:(UIView*)parent;
72
73- CV_UNUSED(createCaptureOutput);
74- CV_UNUSED(createVideoPreviewLayer);
75- CV_UNUSED(updateOrientation);
76
77- CV_UNUSED(lockFocus);
78- CV_UNUSED(unlockFocus);
79- CV_UNUSED(lockExposure);
80- CV_UNUSED(unlockExposure);
81- CV_UNUSED(lockBalance);
82- CV_UNUSED(unlockBalance);
83
84@end
85
87
88@class CvVideoCamera;
89
90CV_EXPORTS @protocol CvVideoCameraDelegate <NSObject>
91
92#ifdef __cplusplus
93// delegate method for processing image frames
94- (void)processImage:(cv::Mat&)image;
95#endif
96
97@end
98
99CV_EXPORTS @interface CvVideoCamera : CvAbstractCamera<AVCaptureVideoDataOutputSampleBufferDelegate>
100{
101 AVCaptureVideoDataOutput *videoDataOutput;
103 dispatch_queue_t videoDataOutputQueue;
106 CMTime lastSampleTime;
108}
109
110@property (nonatomic, weak) id<CvVideoCameraDelegate> delegate;
111@property (nonatomic, assign) BOOL grayscaleMode;
113@property (nonatomic, assign) BOOL recordVideo;
114@property (nonatomic, assign) BOOL rotateVideo;
115@property (nonatomic, strong) AVAssetWriterInput* recordAssetWriterInput;
116@property (nonatomic, strong) AVAssetWriterInputPixelBufferAdaptor* recordPixelBufferAdaptor;
117@property (nonatomic, strong) AVAssetWriter* recordAssetWriter;
119- (void)adjustLayoutToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
120- CV_UNUSED(layoutPreviewLayer);
121- CV_UNUSED(saveVideo);
122- (NSURL *)videoFileURL;
123- (NSString *)videoFileString;
124
125
126@end
127
129
130@class CvPhotoCamera;
131
132CV_EXPORTS @protocol CvPhotoCameraDelegate <NSObject>
134- (void)photoCamera:(CvPhotoCamera*)photoCamera capturedImage:(UIImage *)image;
135- (void)photoCameraCancel:(CvPhotoCamera*)photoCamera;
136
137@end
138
141 AVCaptureStillImageOutput *stillImageOutput;
143
144@property (nonatomic, weak) id<CvPhotoCameraDelegate> delegate;
146- CV_UNUSED(takePicture);
147
148@end
149
double start
Definition core_c.h:1381
#define CV_EXPORTS
Definition cvdef.h:435
Definition cap_ios.h:43
UIDeviceOrientation currentDeviceOrientation
Definition cap_ios.h:44
BOOL cameraAvailable
Definition cap_ios.h:46
Definition cap_ios.h:141
AVCaptureStillImageOutput * stillImageOutput
Definition cap_ios.h:142
Definition cap_ios.h:101
CMTime lastSampleTime
Definition cap_ios.h:107
CALayer * customPreviewLayer
Definition cap_ios.h:105
dispatch_queue_t videoDataOutputQueue
Definition cap_ios.h:104
AVCaptureVideoDataOutput * videoDataOutput
Definition cap_ios.h:102
"black box" representation of the file storage associated with a file on disk.
Definition calib3d.hpp:441