Facemark fit in python doesn't match with c++ fit function

using this face_landmark_model.dat
in python

facemark = cv2.face.createFacemarkKazemi()
facemark.loadModel("face_landmark_model.dat")
ok, landmarks = facemark.fit(gray, faces)

and in c++

Ptr<Facemark> facemark = FacemarkKazemi::create();
facemark->loadModel("kazemi_model_helen.dat");
bool success = facemark->fit(frame,faces,landmarks);

for the same image, I get completely different landmark coordinates.
and when I draw the landmarks, using cpp API I get a reasonable output but the python result is irrelevant. I think fit function in python is buggy.

1 Like

can you add an example image & face rect(s), and print out the found landmarks, please ?

also, what is kazemi_model_helen.dat ? why are you using different models for this ?

dont tell me, it’s really a grayscale image (needs to be CV_8UC3 !)

1 Like

sorry about the confusion about model names. It was just a typo, though the same model.

My issue was resolved after using CV_8UC3! It seems it was due to the grayscale image. but why shouldn’t a grayscale work?

admittedly hard to spot, but the (c++ !) src code tries to access it as CV_8UC3 (Vec3b):

we probably should improve documentation and add an assert here …