October 2018
Intermediate to advanced
472 pages
10h 57m
English
In the Cropping section, we saw that the original image of shape (480*720*3) is cropped to shape (393*254*3). However, the VGG16 architecture accepts images of shape (224*224*3). Hence, we will define a function called image_resize() that does the resizing for us. It accepts the cropped image and the joint resulting from the image_cropping() function as input and returns the resized image and its joint coordinates:
def image_resize(image, joints, new_size = 224): """Function resize cropped images""" orig_h, orig_w = image.shape[:2] joints[0::2] = joints[0::2] / float(orig_w) * new_size joints[1::2] = joints[1::2] / float(orig_h) * new_size image = cv.resize(image, (new_size, new_size), interpolation=cv.INTER_NEAREST) return image, ...
Read now
Unlock full access