This is my dilemma. I built a QR Scanner and need to crop out the top left colored portion of the QR Code into it's own image for further processing.
The blue bounding box is a subview of self.view, and the red bounding box is a subview of the blue bounding box. Im using AVCaptureStillImageOutput to generate the image; code below..
[_imageOutput captureStillImageAsynchronouslyFromConnection:videoConnection completionHandler: ^(CMSampleBufferRef imageSampleBuffer, NSError *error) {
NSData *jpegData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageSampleBuffer];
UIImage *takenImage = [UIImage imageWithData:jpegData];
//crop and process takenImage
// tried utilizing convertRect:toView: and crop result is completely wrong.
CGRect redFrame = [_colorBox convertRect:_colorBox.bounds toView:self.view];
}];
Id really appreciate any assistance with this as I've been at it for days, and am at my wits end. Thanks!