github.com/kaydxh/golang@v0.0.131/pkg/gocv/cgo/third_path/opencv4/include/opencv2/videoio/cap_ios.h (about)

     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  
    35  //! @addtogroup videoio_ios
    36  //! @{
    37  
    38  /////////////////////////////////////// CvAbstractCamera /////////////////////////////////////
    39  
    40  @class CvAbstractCamera;
    41  
    42  CV_EXPORTS @interface CvAbstractCamera : NSObject
    43  {
    44      UIDeviceOrientation currentDeviceOrientation;
    45  
    46      BOOL cameraAvailable;
    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  
    86  ///////////////////////////////// CvVideoCamera ///////////////////////////////////////////
    87  
    88  @class CvVideoCamera;
    89  
    90  CV_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  
    99  CV_EXPORTS @interface CvVideoCamera : CvAbstractCamera<AVCaptureVideoDataOutputSampleBufferDelegate>
   100  {
   101      AVCaptureVideoDataOutput *videoDataOutput;
   102  
   103      dispatch_queue_t videoDataOutputQueue;
   104      CALayer *customPreviewLayer;
   105  
   106      CMTime lastSampleTime;
   107  
   108  }
   109  
   110  @property (nonatomic, weak) id<CvVideoCameraDelegate> delegate;
   111  @property (nonatomic, assign) BOOL grayscaleMode;
   112  
   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;
   118  
   119  - (void)adjustLayoutToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
   120  - CV_UNUSED(layoutPreviewLayer);
   121  - CV_UNUSED(saveVideo);
   122  - (NSURL *)videoFileURL;
   123  - (NSString *)videoFileString;
   124  
   125  
   126  @end
   127  
   128  ///////////////////////////////// CvPhotoCamera ///////////////////////////////////////////
   129  
   130  @class CvPhotoCamera;
   131  
   132  CV_EXPORTS @protocol CvPhotoCameraDelegate <NSObject>
   133  
   134  - (void)photoCamera:(CvPhotoCamera*)photoCamera capturedImage:(UIImage *)image;
   135  - (void)photoCameraCancel:(CvPhotoCamera*)photoCamera;
   136  
   137  @end
   138  
   139  CV_EXPORTS @interface CvPhotoCamera : CvAbstractCamera
   140  {
   141      AVCaptureStillImageOutput *stillImageOutput;
   142  }
   143  
   144  @property (nonatomic, weak) id<CvPhotoCameraDelegate> delegate;
   145  
   146  - CV_UNUSED(takePicture);
   147  
   148  @end
   149  
   150  //! @} videoio_ios