objective c - Image orientation issue AVCaptureOutput delegate iOS sdk -



objective c - Image orientation issue AVCaptureOutput delegate iOS sdk -

i'm working on face detection functionality , getting buffer in delegate below when seek create uiimage ciimage, i'm getting image in landscape code, have portrait orientation in app:

1)- on generating session, tried create portrait mode:

// previewlayer kind of avcapturevideopreviewlayer if ([self.previewlayer.connection isvideoorientationsupported]) [self.previewlayer.connection setvideoorientation:avcapturevideoorientationportrait];

2)- delegate:

- (void)captureoutput:(avcaptureoutput *)captureoutput didoutputsamplebuffer:(cmsamplebufferref)samplebuffer fromconnection:(avcaptureconnection *)connection

3)- unable rotate uiimage image.cgimage nil

cvpixelbufferref pixelbuffer = cmsamplebuffergetimagebuffer(samplebuffer); ///cvpixelbufferref pixelbuffer = [self rotatebuffer:samplebuffer]; cfdictionaryref attachments = cmcopydictionaryofattachments(kcfallocatordefault, pixelbuffer, kcmattachmentmode_shouldpropagate); ciimage *ciimage = [[ciimage alloc] initwithcvpixelbuffer:pixelbuffer options:(__bridge nsdictionary *)attachments]; uiimage *image = [uiimage imagewithciimage:ciimage];

i'm not sure what's wrong orientation of image delegate, tried multiple code snaps of stack overflow answers none of them worked rotate image or buffer, are:

ios app photographic camera orientation in captureoutput

rotate cgimage taken video frame

how straight rotate cvimagebuffer image in ios 4 without converting uiimage?

ios objective-c uiimage avfoundation face-detection

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -