This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this method rotates the UIImage captured by the capture session manager based on the device orientation when the image was captured ([AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer];) | |
- (UIImage*) imageRotated:(UIImage*)image position:(AVCaptureDevicePosition)position orientation:(AVCaptureVideoOrientation)orientation | |
{ | |
CGAffineTransform transform = CGAffineTransformIdentity; | |
CGFloat w = image.size.width * image.scale; | |
CGFloat h = image.size.height * image.scale; | |
CGFloat dw = w; | |
CGFloat dh = h; | |
image = [UIImage imageWithCGImage:image.CGImage scale:1.0f orientation:UIImageOrientationUp]; | |
NewerOlder