Python utils.crop_image() Examples
The following are 4
code examples of utils.crop_image().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
utils
, or try the search function
.
Example #1
Source File: coco.py From ExtremeNet with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #2
Source File: coco.py From CenterNet with MIT License | 5 votes |
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
Example #3
Source File: coco.py From CornerNet with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #4
Source File: test.py From hq-answer-assist with Apache License 2.0 | 5 votes |
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')