1 // Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #import <AVFoundation/AVFoundation.h> 16 #import <UIKit/UIKit.h> 17 18 #include <vector> 19 20 // Set TFLITE_USE_GPU_DELEGATE to 1 to use TFLite GPU Delegate. 21 #ifndef TFLITE_USE_GPU_DELEGATE 22 #define TFLITE_USE_GPU_DELEGATE 0 23 #endif 24 25 @interface CameraExampleViewController 26 : UIViewController<UIGestureRecognizerDelegate, AVCaptureVideoDataOutputSampleBufferDelegate> { 27 IBOutlet UIView* previewView; 28 AVCaptureVideoPreviewLayer* previewLayer; 29 AVCaptureVideoDataOutput* videoDataOutput; 30 dispatch_queue_t videoDataOutputQueue; 31 UIView* flashView; 32 BOOL isUsingFrontFacingCamera; 33 NSMutableDictionary* oldPredictionValues; 34 NSMutableArray* labelLayers; 35 AVCaptureSession* session; 36 37 std::vector<std::string> labels; 38 double total_latency; 39 int total_count; 40 } 41 @property(strong, nonatomic) CATextLayer* predictionTextLayer; 42 43 - (IBAction)takePicture:(id)sender; 44 45 @end 46