Add object detection, tracking, mobile notifications, and search to any security camera.
clean a bit
roryclear6c55096bfad1
diff --git a/clearcam/ViewController.m b/clearcam/ViewController.mindex 4509037..4a9126d 100644--- a/clearcam/ViewController.m+++ b/clearcam/ViewController.m@@ -94,6 +94,7 @@ NSMutableDictionary *classColorMap;[settings addObserver:self forKeyPath:@"preset" options:NSKeyValueObservingOptionNew context:nil];[self setupCameraWithWidth:settings.width height:settings.height];+ [self startNewRecording];[self setupUI];}@@ -102,40 +103,7 @@ NSMutableDictionary *classColorMap;[self finishRecording];[self resetUI];SettingsManager *settings = [SettingsManager sharedManager];- self.captureSession = [[AVCaptureSession alloc] init];- NSString *presetString = [NSString stringWithFormat:@"AVCaptureSessionPreset%@x%@", settings.width, settings.height];-- if ([self.captureSession canSetSessionPreset:presetString]) {- self.captureSession.sessionPreset = presetString;- } else {- NSLog(@"Unsupported preset: %@", presetString);- return;- }-- AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];- NSError *error = nil;- AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:device error:&error];- if (!input) {- NSLog(@"Error setting up camera input: %@", error.localizedDescription);- return;- }- [self.captureSession addInput:input];-- AVCaptureVideoDataOutput *output = [[AVCaptureVideoDataOutput alloc] init];- output.videoSettings = @{(NSString *)kCVPixelBufferPixelFormatTypeKey: @(kCVPixelFormatType_32BGRA)};- output.alwaysDiscardsLateVideoFrames = YES;- [output setSampleBufferDelegate:self queue:dispatch_get_main_queue()];- [self.captureSession addOutput:output];-- if (self.previewLayer) {- [self.previewLayer removeFromSuperlayer]; // Remove from the view's layer hierarchy- self.previewLayer = nil; // Optionally, set it to nil if you're done with it- }- self.previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:self.captureSession];- self.previewLayer.videoGravity = AVLayerVideoGravityResizeAspect;- [self.view.layer addSublayer:self.previewLayer];-- [self.captureSession startRunning];+ [self setupCameraWithWidth:settings.width height:settings.height];if(self.isRecording) [self startNewRecording];[self setupUI];}@@ -202,7 +170,6 @@ NSMutableDictionary *classColorMap;[self.view.layer addSublayer:self.previewLayer];[self.captureSession startRunning];- [self startNewRecording];}- (NSString*)getDateString {