本文整理汇总了Python中utils.crop_image方法的典型用法代码示例。如果您正苦于以下问题:Python utils.crop_image方法的具体用法?Python utils.crop_image怎么用?Python utils.crop_image使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils
的用法示例。
在下文中一共展示了utils.crop_image方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _full_image_crop
# 需要导入模块: import utils [as 别名]
# 或者: from utils import crop_image [as 别名]
def _full_image_crop(image, detections):
detections = detections.copy()
height, width = image.shape[0:2]
max_hw = max(height, width)
center = [height // 2, width // 2]
size = [max_hw, max_hw]
image, border, offset = crop_image(image, center, size)
detections[:, 0:4:2] += border[2]
detections[:, 1:4:2] += border[0]
return image, detections
示例2: test_shot
# 需要导入模块: import utils [as 别名]
# 或者: from utils import crop_image [as 别名]
def test_shot(is_ios):
size = utils.check_os(is_ios)
pixel_json = utils.get_pixel_config(size)
blank_area = pixel_json['blank_area']
question_area = pixel_json['question_area']
blank_area_point = blank_area['x1'], blank_area['y1'], blank_area['x2'], blank_area['y2']
question_area_point = question_area['x1'], question_area['y1'], question_area['x2'], question_area['y2']
backup_img = None
if os.path.exists('image/backup.png'):
backup_img = Image.open('image/backup.png')
else:
utils.pull_from_screen_ios()
backup_img = Image.open('image/backup.png')
utils.crop_image(backup_img, question_area_point, 'image/crop_test.png')
utils.crop_image(backup_img, blank_area_point, 'image/blank_test.png')