feat(新功能):
fix(修复bug): print_painting.py 坐标算法修改 docs(文档变更): refactor(重构): test(增加测试): 代码回溯
This commit is contained in:
@@ -407,12 +407,14 @@ class PrintPainting:
|
|||||||
# y_offset = random.randint(0, image.shape[1] - image_size_w)
|
# y_offset = random.randint(0, image.shape[1] - image_size_w)
|
||||||
|
|
||||||
# 1.拿到偏移量后和resize后的print宽高取余 得到真正偏移量
|
# 1.拿到偏移量后和resize后的print宽高取余 得到真正偏移量
|
||||||
x_offset = print_w - int(location[0][1] % print_w)
|
# 偏移量增加2分之print.w 使坐标位于图中间 如果要位于左上角删除+ print_w // 2 即可
|
||||||
y_offset = print_w - int(location[0][0] % print_h)
|
x_offset = print_w - int(location[0][1] % print_w) + print_w // 2
|
||||||
|
y_offset = print_h - int(location[0][0] % print_h) + print_h // 2
|
||||||
|
|
||||||
# y_offset = int(location[0][0])
|
# y_offset = int(location[0][0])
|
||||||
# x_offset = int(location[0][1])
|
# x_offset = int(location[0][1])
|
||||||
|
|
||||||
|
|
||||||
if len(image.shape) == 2:
|
if len(image.shape) == 2:
|
||||||
image = image[x_offset: x_offset + image_size_h, y_offset: y_offset + image_size_w]
|
image = image[x_offset: x_offset + image_size_h, y_offset: y_offset + image_size_w]
|
||||||
elif len(image.shape) == 3:
|
elif len(image.shape) == 3:
|
||||||
|
|||||||
Reference in New Issue
Block a user