Afdx Detector stuck in landscape


I have been trying to use the AfdxDetector on a camera stream view, in an iMessage App, it only detects faces and expressions on right Landscape but does not work in portrait view.

We have tried a troubleshooting step: AFDXDetector.rotateUIImage -90 degrees
Result: Expression detection still happens on landscape right.

[announcement] iOS SDK 4.0 release

Hey Sumesh,

When using AFDXDetector in camera mode, the object automatically compensates for the orientation of the device by rotating the image coming out of the camera appropriately and then passing it to the face detector for detection and tracking.

I am not certain why this wouldn’t be happening in your case. You indicated that you are working on an iMessage App. Is this an iMessage Extension, not an actual app? Can you provide a bit more detail as to the nature of the app?

While not ideal, a workaround is to manage the camera yourself via an AVCaptureDevice object. You would obtain the image and then pass it to the AFDXDetector yourself. It’s certainly more work than relying on the AFDXDetector to manage the camera, you would have complete control of the image as it comes in and could orient properly it before passing it on.


Hey Boisy,

This is what I mean by an iMessage app

AVCapture is getting a little difficult to implement at our end, can you please try calling AFDXDetector on Xcode 9 beta (with an iMessage template). It will help us a lot if you could suggest a fix for the same or share your project with us. So that we know where we are going wrong.


This was solved in another email thread.