本文整理匯總了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')