Open ghost opened 12 years ago
What camera are you capturing an image from, the front or rear? Have you set the outputImageOrientation property on the camera to match the orientation you wish to see in your image?
Hi Brad,
I am using the rear camera with the following settings
videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition: videoCamera.outputImageOrientation = UIInterfaceOrientationLandscapeLeft;
I get the raw data like this
[imageRawData rawBytesForImage];
When I get the image using the following the image is in the correct orientation
UIImage * image = [sharpenFilter imageFromCurrentlyProcessedOutputWithOrientation:UIImageOrientationUp];
Perhaphs I am doing something wrong here..
I think I'm having a similar problem, Im setting things up to do some CPU processing with opencv. Right now I'm just taking the raw data output and pumping it back into raw data input like so.
camera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset1920x1080 cameraPosition:AVCaptureDevicePositionBack];
camera.outputImageOrientation = UIInterfaceOrientationPortrait;
camera.runBenchmark = YES;
camera.horizontallyMirrorRearFacingCamera = NO;
CGSize size = CGSizeMake(1920, 1080);
rawDataOutputFilter = [[GPUImageRawDataOutput alloc] initWithImageSize:size resultsInBGRAFormat:YES];
rawDataInputFilter = [[GPUImageRawDataInput alloc] initWithBytes:nil size:size];
__weak GPUImageRawDataInput *rawDataInput = rawDataInputFilter;
__weak GPUImageRawDataOutput *rawDataOutput = rawDataOutputFilter;
[rawDataOutputFilter setNewFrameAvailableBlock:^{
[rawDataInput updateDataFromBytes:[rawDataOutput rawBytesForImage] size:size];
[rawDataInput processData];
}];
[camera addTarget:rawDataOutput];
[rawDataInputFilter addTarget:(GPUImageView*)self.view];
[camera startCameraCapture];
Any thoughts ?
When I render the output of a filter to the screen the image displays correctly.
When I get the raw data from GPUImageRawData using rawBytesForImage the image is fliped vertically.
I can use imageFromCurrentlyProcessedOutputWithOrientation:UIImageOrientationUp and all is ok.
If I was to post process the flipped image I would loose the speed benifit gained by using GPUImageRawData