Using Camera on iPad / iPhone with Overlay

I am trying to add an overlay image to a photograph that was taken. Has anyone seen any examples of how I can do this? I want to have an image that is a transparent PNG file, and then allows the user to take a picture with the image in it.

0
source share
1 answer

Julius is right that this is essentially a duplicate question. However, to eliminate one problem - do you want the user to be able to see the overlay when taking a picture? (i.e. if your application makes different hats appear on people's heads, do you want to show a hat floating in space when they take a photo?). If you want to know more about this, you will need to use the cameraOverlayView property for imagePickerController, which allows you to overlay your own views on the camera. There are questions on this topic already on SO, like this one: How to add overlay viewing to the camera and save it

re: - LilMoke, , , , (4: 3) iPhone (3: 4). cameraViewTransform UIImagePickerController. , raywenderlich.com:

#define CAMERA_TRANSFORM  1.24299
// First create an overlay view for your superimposed image
overlay = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
overlay.backgroundColor=[UIColor clearColor];
overlay.opaque = NO;

UIImagePickerController *imagePicker;
imagePicker = [[[UIImagePickerController alloc] init] autorelease];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.showsCameraControls = YES; // assuming you need these?
imagePicker.toolbarHidden = YES;
imagePicker.navigationBarHidden = YES;
imagePicker.wantsFullScreenLayout = YES;
imagePicker.cameraViewTransform = CGAffineTransformScale(imagePicker.cameraViewTransform, 
    CAMERA_TRANSFORM, CAMERA_TRANSFORM); // If I understood your problem, this should help
imagePicker.cameraOverlayView = overlay;

, , , . , CameraViewTransform, .

+1

Source: https://habr.com/ru/post/1728724/


All Articles