Thanks to Christoph Rackwitz's hint, and by adding this line of code to the read_image_for_rectify
function
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
mediapipe gives the same result like the first case.
def read_image_for_rectify(address: str) -> Dict:
face_object = dict()
img = cv2.imread(address)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
_, buffer = cv2.imencode(".jpg", img)
img = base64.b64encode(buffer).decode()
face_object["image"] = img
face_object["address"] = address
return face_object
But yet could not detect landmarks for some images like