Rescale, resize, and downscale — skimage v0.19.0 docs
scikit-image.org › transform › plot_rescaleimport matplotlib.pyplot as plt from skimage import data, color from skimage.transform import rescale, resize, downscale_local_mean image = color. rgb2gray (data. astronaut ()) image_rescaled = rescale (image, 0.25, anti_aliasing = False) image_resized = resize (image, (image. shape [0] // 4, image. shape [1] // 4), anti_aliasing = True) image_downscaled = downscale_local_mean (image, (4, 3)) fig, axes = plt. subplots (nrows = 2, ncols = 2) ax = axes. ravel ax [0]. imshow (image, cmap ...
Python Examples of skimage.transform.resize
www.programcreek.com › skimagedef evaluate_aesthetics_score(images): scores = np.zeros(shape=(len(images),)) for i in range(len(images)): img = images[i].astype(np.float32)/255 img_resize = transform.resize(img, (227, 227))-0.5 img_resize = np.expand_dims(img_resize, axis=0) scores[i] = sess.run([score_func], feed_dict={image_placeholder: img_resize})[0] return scores
Python Examples of skimage.transform
www.programcreek.com › 96580 › skimagedef __call__(self, sample): image, annots = sample['img'], sample['annot'] rows, cols, cns = image.shape largest_side = max(rows, cols) scale = self.img_size / largest_side # resize the image with the computed scale image = skimage.transform.resize(image, (int(round(rows*scale)), int(round((cols*scale))))) rows, cols, cns = image.shape new_image = np.zeros((self.img_size, self.img_size, cns)).astype(np.float32) new_image[:rows, :cols, :] = image.astype(np.float32) annots[:, :4] *= scale ...