zweigraf / face-landmarking-ios

👦 Basic face landmarking on iPhone with Dlib via Swift & ObjC++
481 stars 126 forks source link

Problems with image size 1080x1920 #17

Open PPPiotr opened 7 years ago

PPPiotr commented 7 years ago

There is a strange problem with this lib when working on images with resolution 1080x1920 (WIDTHxHEIGHT). It produces artefacts like this: img_0191 Not only drawing is corrupted but also points positions.

To reproduce this bug You only need to add this:

if let connection = output.connectionWithMediaType(AVMediaTypeVideo) {
    if connection.supportsVideoOrientation {
        connection.videoOrientation = .Portrait
    }
}
session.sessionPreset = AVCaptureSessionPreset1920x1080

Just before session.commitConfiguration() in func openSession(). Not every device will be able work in this resolution in front camera, so changing to back camera might help.

Smaller images with resolution 720x1280 and 1280x720 works fine (I did not check smaller images than 720x1280). Even 2160x3840 and 3840x2160 works fine, so there is something wrong only with resolution 1080x1920. On other hand resolution 1920x1080 works correctly but it is for landscape and I need portrait orientation. So for now I'm using: session.sessionPreset = AVCaptureSessionPreset1280x720

Do You know what could be wrong?

Miths19 commented 7 years ago

Same issue with me also .... have you solved this problem?

PPPiotr commented 7 years ago

No, I'm using smaller resolution instead.

alberto093 commented 7 years ago

Same issue...could be an AVFoundation issue?

ramanihiteshc commented 6 years ago

not perfect point find face ...

AlexFWulff commented 6 years ago

Has anyone figured out why this issue arises yet? It's affecting me as well

ghost commented 6 years ago

Any solution, guys?

niimi commented 5 years ago

DlibWrapper.mm L57 size_t width = CVPixelBufferGetBytesPerRow(imageBuffer)/4; same as below size_t width = 1088;

worked on ipad pro front camera. (1080x1920)