AVCaptureSession - output in landscape and portrait is causing problems

Closed - This job posting has been filled and work has been completed.
Web, Mobile & Software Dev Mobile Development Posted 2 years ago

Fixed Price

Delivery by April 3, 2013

$10.00

Budget

Details

Hi,

I have an iPhone app that captures video and shows it using AVCaptureSession. But when I rotate it in captureOutput delegate, it seems a bit squished.

I need some help with this app on Skype, but I can't share all the code. If you have used AVCapture help should be a breeze.

------------

- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection
{

    UIDeviceOrientation deviceOrientation = [[UIDevice currentDevice] orientation];
    AVCaptureVideoOrientation orientation = UIImageOrientationRight;
    
    if (deviceOrientation == UIDeviceOrientationLandscapeLeft)
    {
        orientation = UIImageOrientationUp;
    }
    else if (deviceOrientation == UIDeviceOrientationLandscapeRight)
    {
        orientation = UIImageOrientationDown;
    }

    CVPixelBufferRef pixel_buffer = CMSampleBufferGetImageBuffer(sampleBuffer);
    CIImage *ciImage = [CIImage imageWithCVPixelBuffer:pixel_buffer];
    
    CGImageRef ref = [self.context createCGImage:ciImage fromRect:ciImage.extent];
    UIImage *image = [UIImage imageWithCGImage:ref scale:1.0 orientation:orientation];
    
    CGImageRelease(ref);
    
    // add frames to array if supposed to be captured
    if (captureFrames == TRUE)
    {
        [self.imageFrames addObject:image];
        if (self.imageFrames.count > 10)
        {
            captureFrames = FALSE;
        }
        NSLog(@"capturing frame");
    }
    
    // Show image
    [self.imageView performSelectorOnMainThread:@selector(setImage:) withObject:image waitUntilDone:YES];
}

---
Skills: video


About the Client

(5.00) 125 reviews

Canada
Edmonton 11:12 AM

288 Jobs Posted
57% Hire Rate, 2 Open Jobs

Over $50,000 Total Spent
177 Hires, 2 Active

$15.08/hr Avg Hourly Rate Paid
7,727 Hours

Member Since Apr 18, 2011