본문 바로가기

OBJECTIVE-C

[퍼옴]iPhone custom camera overlay (plus image processing) : how-to [duplicate]

Many image sharing apps available today from the App Store use a custom camera instead of the standard camera picker provided by Apple.

Does anyone know any tutorials or tips for creating a custom camera?

Oliver
7,280947124
asked Nov 10 '11 at 0:15
Fred Collins
1,0131641

marked as duplicate by Mitch WheatBrian RoachMosheBrad LarsonJeremy Banks Nov 10 '11 at 19:50

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Yes, create a UIImagePickerController from code, adjust its properties, add an overlay onto it, and with you controller, control whatever you want on that overlay : custom controls, overlaying images, etc...

That gives something like this :

self.picker = [[UIImagePickerController alloc] init];
self.picker.sourceType = UIImagePickerControllerSourceTypeCamera;
self.picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
self.picker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
self.picker.showsCameraControls = NO;
self.picker.navigationBarHidden = YES;
self.picker.toolbarHidden = YES;
self.picker.wantsFullScreenLayout = YES;

// Insert the overlay
self.overlay = [[OverlayViewController alloc] initWithNibName:@"Overlay" bundle:nil];
self.overlay.pickerReference = self.picker;
self.picker.cameraOverlayView = self.overlay.view;
self.picker.delegate = self.overlay;

[self presentModalViewController:self.picker animated:NO];

OverlayViewController is the controller that you must write to control everything you add onto the overlay.

pickerReference is a property you can keep to send orders to the camera. For example, you could call the following from an IBAction coming from a UIButton placed onto the overlay :

[self.pickerReference takePicture];
answered Nov 10 '11 at 0:29

Oliver
7,280947124
Thank you for the answer. I've understood but only a question: how can I make a shot button that when is pressed it stops the image capturing from the camera? (in few words, how can I implement a 'take a picture' button. Thanks guy. – Fred Collins Nov 10 '11 at 0:39
1  
@FredCollins: put a button on the overlay, link it with an IBAction and into the IBAction call [self.pickerReference takePicture]; (check the method name in Apple doc, I think it's this one) – Oliver Nov 10 '11 at 0:40
3  
@FredCollins : Applying effect starts with the delgate method - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info to get the taken image. After that, you have an infinite number of effects you can apply so... It's up to you to do what you want. – Oliver Nov 10 '11 at 0:55
2  
@FredCollins : That really depends. OpenGL is for 3D Effects and/or some complex effects. But for basic things, CoreGraphics could be enough. Here we enter in image processing and once you exactly know what kind of effect you want, you should open another question. Also think about looking to the other StackExchange sites. Some talks about image processing. – Oliver Nov 10 '11 at 0:59
1  
@FredCollins : You're welcome – Oliver Nov 10 '11 at 1:07
show 4 more comments