(image, width=None, height=None, inter=cv2.INTER_AREA)
| 63 | return cv2.warpAffine(image, M, (nW, nH)) |
| 64 | |
| 65 | def resize(image, width=None, height=None, inter=cv2.INTER_AREA): |
| 66 | # initialize the dimensions of the image to be resized and |
| 67 | # grab the image size |
| 68 | dim = None |
| 69 | (h, w) = image.shape[:2] |
| 70 | |
| 71 | # if both the width and height are None, then return the |
| 72 | # original image |
| 73 | if width is None and height is None: |
| 74 | return image |
| 75 | |
| 76 | # check to see if the width is None |
| 77 | if width is None: |
| 78 | # calculate the ratio of the height and construct the |
| 79 | # dimensions |
| 80 | r = height / float(h) |
| 81 | dim = (int(w * r), height) |
| 82 | |
| 83 | # otherwise, the height is None |
| 84 | else: |
| 85 | # calculate the ratio of the width and construct the |
| 86 | # dimensions |
| 87 | r = width / float(w) |
| 88 | dim = (width, int(h * r)) |
| 89 | |
| 90 | # resize the image |
| 91 | resized = cv2.resize(image, dim, interpolation=inter) |
| 92 | |
| 93 | # return the resized image |
| 94 | return resized |
| 95 | |
| 96 | def skeletonize(image, size, structuring=cv2.MORPH_RECT): |
| 97 | # determine the area (i.e. total number of pixels in the image), |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…