October 2018
Intermediate to advanced
472 pages
10h 57m
English
This Python file contains the image_cropping(), image_resize(), and model_data() functions, as shown:
"""This module contains functions to crop and resize images."""import osimport cv2 as cvimport numpy as npimport pandas as pddef image_cropping(image_id, joints, crop_pad_inf=1.4, crop_pad_sup=1.6, shift=5, min_dim=100): """Crop Function.""" # # image cropping # load the image image = cv.imread('FLIC-full/images/%s' % (image_id)) # convert joint list to array joints = np.asarray([int(float(p)) for p in joints]) # reshape joints to shape (7*2) joints = joints.reshape((len(joints) // 2, 2)) # transform joints to list of (x,y) tuples posi_joints = [(j[0], j[1]) for j in joints if j[0] > 0 and j[1] > 0] # obtain ...Read now
Unlock full access