Fixed cropping
This commit is contained in:
parent
98fc8f46b6
commit
1210266c95
|
@ -22,15 +22,16 @@ def convert(in_path, out_path, file_name):
|
|||
im : Image = data.image
|
||||
width, height = im.size
|
||||
|
||||
left = int((width - 2) * 0.8)
|
||||
left = int(width * 0.8)
|
||||
padding = 1
|
||||
|
||||
im1 = im.crop((0, 0, left, height))
|
||||
im1 = im.crop((0, 0, left - padding, height))
|
||||
im1_array = np.asarray(im1, dtype=np.float32) / 255
|
||||
|
||||
y_channel = im1_array[:, :, 0]
|
||||
alpha_channel = im1_array[:, :, 2]
|
||||
|
||||
im2 = im.crop((left+2, 0, width, height)).resize((left, height), Image.NEAREST)
|
||||
im2 = im.crop((left + padding, 0, width, height)).resize((left - padding, height), Image.NEAREST)
|
||||
im2_array = np.asarray(im2, dtype=np.float32) / 255
|
||||
|
||||
cr_channel = im2_array[:, :, 0]
|
||||
|
|
Loading…
Reference in New Issue