new
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 93 KiB |
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 120 KiB |
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 105 KiB |
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 93 KiB |
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 83 KiB |
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 116 KiB |
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 73 KiB |
@ -39,26 +39,34 @@ def crop_face(img, face):
|
|||||||
|
|
||||||
# crop the face with a bigger bbox
|
# crop the face with a bigger bbox
|
||||||
hmw = h - w
|
hmw = h - w
|
||||||
hpad = int(h/2)+1
|
# hpad = int(h/2)+1
|
||||||
wpad = int(w/2)+1
|
# wpad = int(w/2)+1
|
||||||
|
|
||||||
l,r,t,b = 0,0,0,0
|
l,r,t,b = 0,0,0,0
|
||||||
left = x-wpad
|
lpad = int(float(w)*0.4)
|
||||||
|
left = x-lpad
|
||||||
if(left<0):
|
if(left<0):
|
||||||
|
l = lpad-x
|
||||||
left = 0
|
left = 0
|
||||||
l = wpad-x
|
|
||||||
right = x+w+wpad
|
rpad = int(float(w)*0.4)
|
||||||
|
right = x+w+rpad
|
||||||
if(right>width):
|
if(right>width):
|
||||||
right = width
|
|
||||||
r = right-width
|
r = right-width
|
||||||
top = y - hpad
|
right = width
|
||||||
|
|
||||||
|
tpad = int(float(h)*0.6)
|
||||||
|
top = y - tpad
|
||||||
if(top<0):
|
if(top<0):
|
||||||
|
t = tpad-y
|
||||||
top = 0
|
top = 0
|
||||||
t = hpad-y
|
|
||||||
bottom = y+h+int(hpad*0.5)
|
bpad = int(float(h)*0.2)
|
||||||
|
bottom = y+h+bpad
|
||||||
if(bottom>height):
|
if(bottom>height):
|
||||||
bottom = height
|
|
||||||
b = bottom-height
|
b = bottom-height
|
||||||
|
bottom = height
|
||||||
|
|
||||||
|
|
||||||
im_face = img[top:bottom,left:right]
|
im_face = img[top:bottom,left:right]
|
||||||
if(len(im_face.shape)==2):
|
if(len(im_face.shape)==2):
|
||||||
|