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
Post a Comment