Fixed face regions for exif orientation 6, 8
This commit is contained in:
@@ -237,6 +237,11 @@ class FaceInfo:
|
|||||||
"""
|
"""
|
||||||
x, y = self.center_x, self.center_y
|
x, y = self.center_x, self.center_y
|
||||||
x, y = self._fix_orientation((x, y))
|
x, y = self._fix_orientation((x, y))
|
||||||
|
|
||||||
|
if self.photo.orientation in [5, 6, 7, 8]:
|
||||||
|
w = self.size_pixels / self.photo.height
|
||||||
|
h = self.size_pixels / self.photo.width
|
||||||
|
else:
|
||||||
h = self.size_pixels / self.photo.height
|
h = self.size_pixels / self.photo.height
|
||||||
w = self.size_pixels / self.photo.width
|
w = self.size_pixels / self.photo.width
|
||||||
|
|
||||||
@@ -258,12 +263,17 @@ class FaceInfo:
|
|||||||
"""
|
"""
|
||||||
x, y = self.center_x, self.center_y
|
x, y = self.center_x, self.center_y
|
||||||
x, y = self._fix_orientation((x, y))
|
x, y = self._fix_orientation((x, y))
|
||||||
x = x - self.size_pixels / self.photo.width / 2
|
|
||||||
y = y - self.size_pixels / self.photo.height / 2
|
|
||||||
|
|
||||||
# though the docs clearly say height, width, these appear to be flipped
|
if self.photo.orientation in [5, 6, 7, 8]:
|
||||||
|
w = self.size_pixels / self.photo.width
|
||||||
|
h = self.size_pixels / self.photo.height
|
||||||
|
x = x - self.size_pixels / self.photo.height / 2
|
||||||
|
y = y - self.size_pixels / self.photo.width / 2
|
||||||
|
else:
|
||||||
h = self.size_pixels / self.photo.width
|
h = self.size_pixels / self.photo.width
|
||||||
w = self.size_pixels / self.photo.height
|
w = self.size_pixels / self.photo.height
|
||||||
|
x = x - self.size_pixels / self.photo.width / 2
|
||||||
|
y = y - self.size_pixels / self.photo.height / 2
|
||||||
|
|
||||||
return MPRI_Reg_Rect(x, y, h, w)
|
return MPRI_Reg_Rect(x, y, h, w)
|
||||||
|
|
||||||
@@ -403,6 +413,8 @@ class FaceInfo:
|
|||||||
"right_eye": self.right_eye,
|
"right_eye": self.right_eye,
|
||||||
"size": self.size,
|
"size": self.size,
|
||||||
"face_rect": self.face_rect(),
|
"face_rect": self.face_rect(),
|
||||||
|
"mpri_reg_rect": self.mpri_reg_rect._asdict(),
|
||||||
|
"mwg_rs_area": self.mwg_rs_area._asdict(),
|
||||||
"roll": roll,
|
"roll": roll,
|
||||||
"pitch": pitch,
|
"pitch": pitch,
|
||||||
"yaw": yaw,
|
"yaw": yaw,
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ import sys
|
|||||||
|
|
||||||
import osxphotos
|
import osxphotos
|
||||||
|
|
||||||
photosdb = osxphotos.PhotosDB()
|
db = sys.argv[1]
|
||||||
|
photosdb = osxphotos.PhotosDB(dbfile=db)
|
||||||
|
|
||||||
face_photos = [p for p in photosdb.photos() if p.face_info]
|
face_photos = [p for p in photosdb.photos() if p.face_info]
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user