ios - Faces not detected when photographed with front facing camera -


i'm using azure face recognition api in iphone app. it's working fine when take pictures camera when use front-facing one, api fails detect faces.

i've tried transferring (front-facing) photo laptop , dragged test area in documentation , there face detected fine.

this leads me believe there's maybe metadata og flags specific front-facing photos confuse api? , stripped when uploaded through browser?

update

here's how i'm uploading file using alamofire:

let data = uiimagejpegrepresentation(photo, 0.5) let url = "https://.../detect" let octetheaders = ["content-type": "application/octet-stream", "ocp-apim-subscription-key": "..."] alamofire.upload(data, to: url, method: .post, headers: octetheaders) 

thanks! mikkel

xuan hu right in comments. turns out iphone doesn't rotate images – sets orientation exif-tag.

hard rotating photo before uploading made work:

func normalizeimagerotation(_ image: uiimage) -> uiimage {     if (image.imageorientation == uiimageorientation.up) { return image }      uigraphicsbeginimagecontextwithoptions(image.size, false, image.scale)     image.draw(in: cgrect(x: 0, y: 0, width: image.size.width, height: image.size.height))     let normalizedimage = uigraphicsgetimagefromcurrentimagecontext()!     uigraphicsendimagecontext()     return normalizedimage } 

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -