INNER CODE UNIT · Python
left_top_y
minivision-ai/Silent-Face-Anti-Spoofing · src/generate_patches.py:30
left_top_y = center_y-new_height/2
right_bottom_x = center_x+new_width/2
right_bottom_y = center_y+new_height/2
if left_top_x < 0:
right_bottom_x -= left_top_x
left_top_x = 0
if left_top_y < 0:
right_bottom_y -= left_top_y
left_top_y = 0
if right_bottom_x > src_w-1:
left_top_x -= right_bottom_x-src_w+1
right_bottom_x = src_w-1
if right_bottom_y > src_h-1:
left_top_y -= right_bottom_y-src_h+1