Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4252416
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:47:32+00:00 2026-05-21T04:47:32+00:00

I want to know how to access the iphones camera and work with it

  • 0

I want to know how to access the iphones camera and work with it in realtime: for example just draw on the camera view.

Another related Question:

Can I display 4 camera-views at once like in “Photo Booth” on the Mac.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T04:47:33+00:00Added an answer on May 21, 2026 at 4:47 am

    You can do it by using AVFoundation

    - (void)initCapture {
    
        AVCaptureDeviceInput *captureInput = [AVCaptureDeviceInput 
                                              deviceInputWithDevice:[AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo] 
                                              error:nil];
    
        AVCaptureVideoDataOutput *captureOutput = [[AVCaptureVideoDataOutput alloc] init];
    
        captureOutput.alwaysDiscardsLateVideoFrames = YES; 
    
        dispatch_queue_t queue;
        queue = dispatch_queue_create("cameraQueue", NULL);
        [captureOutput setSampleBufferDelegate:self queue:queue];
        dispatch_release(queue);
    
        NSString* key = (NSString*)kCVPixelBufferPixelFormatTypeKey; 
        NSNumber* value = [NSNumber numberWithUnsignedInt:kCVPixelFormatType_32BGRA]; 
        NSDictionary* videoSettings = [NSDictionary dictionaryWithObject:value forKey:key]; 
        [captureOutput setVideoSettings:videoSettings]; 
    
    
        self.captureSession = [[AVCaptureSession alloc] init];
        [self.captureSession setSessionPreset:AVCaptureSessionPresetLow];
    
        [self.captureSession addInput:captureInput];
        [self.captureSession addOutput:captureOutput];
    
        [self.captureSession startRunning];
    
        self.customLayer = [CALayer layer];
    
        self.customLayer.frame =CGRectMake(5-25,25, 200,150);
    
        self.customLayer.transform = CATransform3DRotate(CATransform3DIdentity, M_PI/2.0f, 0, 0, 1);
    
        //self.customLayer.transform =CATransform3DMakeRotation(M_PI/2.0f, 0, 0, 1);
    
    
        //[self.view.layer addSublayer:imageView.layer];
        //self.customLayer.frame =CGRectMake(0, 0, 200,150);
        //self.customLayer.contentsGravity = kCAGravityResizeAspectFill;
    
        [self.view.layer insertSublayer:self.customLayer atIndex:4];
        //[self.view.layer addSublayer:self.customLayer];
    
    
        self.customLayer1 = [CALayer layer];
        //self.customLayer.frame = self.view.bounds;
        self.customLayer1.frame =CGRectMake(165-25, 25, 200, 150);
        self.customLayer1.transform = CATransform3DRotate(CATransform3DIdentity, M_PI/2.0f, 0, 0, 1);
        //self.customLayer1.contentsGravity = kCAGravityResizeAspectFill;
        [self.view.layer addSublayer:self.customLayer1];
    
    
    
    
        self.customLayer2 = [CALayer layer];
        //self.customLayer.frame = self.view.bounds;
        self.customLayer2.frame =CGRectMake(5-25, 210 +25, 200, 150);
        self.customLayer2.transform = CATransform3DRotate(CATransform3DIdentity, M_PI/2.0f, 0, 0, 1);
        //self.customLayer1.contentsGravity = kCAGravityResizeAspectFill;
        [self.view.layer addSublayer:self.customLayer2];
    
    
        self.customLayer3 = [CALayer layer];
        //self.customLayer.frame = self.view.bounds;
        self.customLayer3.frame =CGRectMake(165-25, 210 +25, 200, 150);
        self.customLayer3.transform = CATransform3DRotate(CATransform3DIdentity, M_PI/2.0f, 0, 0, 1);
        //self.customLayer1.contentsGravity = kCAGravityResizeAspectFill;
        [self.view.layer addSublayer:self.customLayer3];
    
    
    
    }
    
    
    
    #pragma mark -
    #pragma mark AVCaptureSession delegate
    - (void)captureOutput:(AVCaptureOutput *)captureOutput 
    didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer 
           fromConnection:(AVCaptureConnection *)connection 
    { 
    
    
        NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    
        CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer); 
        /*Lock the image buffer*/
        CVPixelBufferLockBaseAddress(imageBuffer,0); 
        /*Get information about the image*/
        uint8_t *baseAddress = (uint8_t *)CVPixelBufferGetBaseAddress(imageBuffer); 
        size_t bytesPerRow = CVPixelBufferGetBytesPerRow(imageBuffer); 
        size_t width = CVPixelBufferGetWidth(imageBuffer); 
        size_t height = CVPixelBufferGetHeight(imageBuffer);  
    
    
        /*Create a CGImageRef from the CVImageBufferRef*/
        CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 
    
    
    
        CGContextRef newContext = CGBitmapContextCreate(baseAddress, width, height, 8, bytesPerRow, colorSpace, kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst);
        CGImageRef newImage2 = CGBitmapContextCreateImage(newContext); 
        /*We release some components*/
        CGContextRelease(newContext); 
        CGColorSpaceRelease(colorSpace);
    
        [self.customLayer performSelectorOnMainThread:@selector(setContents:) withObject: (id) newImage2 waitUntilDone:YES];
        [self.customLayer1 performSelectorOnMainThread:@selector(setContents:) withObject: (id) newImage2 waitUntilDone:YES];
        [self.customLayer2 performSelectorOnMainThread:@selector(setContents:) withObject: (id) newImage2 waitUntilDone:YES];
        [self.customLayer3 performSelectorOnMainThread:@selector(setContents:) withObject: (id) newImage2 waitUntilDone:YES];
    
    
        //  UIImage *image= [UIImage imageWithCGImage:newImage scale:1.0 orientation:UIImageOrientationRight];
    
    
        /*We relase the CGImageRef*/
        CGImageRelease(newImage2);
    
        //  [self.imageView performSelectorOnMainThread:@selector(setImage:) withObject:image waitUntilDone:YES];
    
        /*We unlock the  image buffer*/
        CVPixelBufferUnlockBaseAddress(imageBuffer,0);
    
        [pool drain];
    
    } 
    

    it works fine..

    http://crayoncoding.blogspot.com/2011/04/iphone-4-camera-views-at-once.html

    see the above link for detail code

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hello friends i just want to know that whether we can access or fetch
I want to know how to pass structures to another function and subsequently access
I want to know if I can access the media libraries on an iPhone:
i think i know the answer to this question, but just want to make
I want to know if I can get an Access Token through the FBConnect
I want to know which tool can be used to measure the cyclomatic complexity
I want to know if i can create a custom google maps application,on which
I want to know how to get access of this [span class=myclass] in below
I have just started looking at JqueryMobile and want to know if the following
I want to access the general settings of iPhone. I know that it was

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.