Python scipy.misc.imrotate() Examples
The following are 30
code examples of scipy.misc.imrotate().
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
scipy.misc
, or try the search function
.
![](https://www.programcreek.com/common/static/images/search.png)
Example #1
Source File: data_utils.py From LSH_Memory with Apache License 2.0 | 6 votes |
def crawl_directory(directory, augment_with_rotations=False, first_label=0): """Crawls data directory and returns stuff.""" label_idx = first_label images = [] labels = [] info = [] # traverse root directory for root, _, files in os.walk(directory): logging.info('Reading files from %s', root) for file_name in files: full_file_name = os.path.join(root, file_name) img = imread(full_file_name, flatten=True) for idx, angle in enumerate([0, 90, 180, 270]): if not augment_with_rotations and idx > 0: break images.append(imrotate(img, angle)) labels.append(label_idx + idx) info.append(full_file_name) if len(files) == 20: label_idx += 4 if augment_with_rotations else 1 return images, labels, info
Example #2
Source File: Prepare_TrainData_HR_LR.py From SRFBN_CVPR19 with MIT License | 6 votes |
def save_HR_LR(img, size, path, idx): HR_img = misc.imresize(img, size, interp='bicubic') HR_img = modcrop(HR_img, 4) rot180_img = misc.imrotate(HR_img, 180) x4_img = misc.imresize(HR_img, 1 / 4, interp='bicubic') x4_rot180_img = misc.imresize(rot180_img, 1 / 4, interp='bicubic') img_path = path.split('/')[-1].split('.')[0] + '_rot0_' + 'ds' + str(idx) + '.png' rot180img_path = path.split('/')[-1].split('.')[0] + '_rot180_' + 'ds' + str(idx) + '.png' x4_img_path = path.split('/')[-1].split('.')[0] + '_rot0_' + 'ds' + str(idx) + '.png' x4_rot180img_path = path.split('/')[-1].split('.')[0] + '_rot180_' + 'ds' + str(idx) + '.png' misc.imsave(save_HR_path + '/' + img_path, HR_img) misc.imsave(save_HR_path + '/' + rot180img_path, rot180_img) misc.imsave(save_LR_path + '/' + x4_img_path, x4_img) misc.imsave(save_LR_path + '/' + x4_rot180img_path, x4_rot180_img)
Example #3
Source File: facenet.py From facenet-demo with MIT License | 5 votes |
def random_rotate_image(image): angle = np.random.uniform(low=-10.0, high=10.0) return misc.imrotate(image, angle, 'bicubic') # 1: Random rotate 2: Random crop 4: Random flip 8: Fixed image standardization 16: Flip
Example #4
Source File: facenet.py From uai-sdk with Apache License 2.0 | 5 votes |
def random_rotate_image(image): angle = np.random.uniform(low=-10.0, high=10.0) return misc.imrotate(image, angle, 'bicubic') # 1: Random rotate 2: Random crop 4: Random flip 8: Fixed image standardization 16: Flip
Example #5
Source File: facenet.py From facenet-demo with MIT License | 5 votes |
def random_rotate_image(image): angle = np.random.uniform(low=-10.0, high=10.0) return misc.imrotate(image, angle, 'bicubic') # 1: Random rotate 2: Random crop 4: Random flip 8: Fixed image standardization 16: Flip
Example #6
Source File: transforms.py From soccerontable with BSD 2-Clause "Simplified" License | 5 votes |
def __call__(self, sample, interval=(-10, 10)): image, mask, target = sample['image'], sample['mask'], sample['target'] angle = np.random.uniform(interval[0], interval[1]) image = imrotate(image, angle) mask = imrotate(mask, angle, interp='nearest', mode='F') target = imrotate(target, angle, interp='nearest', mode='F') return {'image': image, 'mask': mask, 'target': target}
Example #7
Source File: data_utils.py From hands-detection with MIT License | 5 votes |
def crawl_directory(directory, augment_with_rotations=False, first_label=0): """Crawls data directory and returns stuff.""" label_idx = first_label images = [] labels = [] info = [] # traverse root directory for root, _, files in os.walk(directory): logging.info('Reading files from %s', root) fileflag = 0 for file_name in files: full_file_name = os.path.join(root, file_name) img = imread(full_file_name, flatten=True) for i, angle in enumerate([0, 90, 180, 270]): if not augment_with_rotations and i > 0: break images.append(imrotate(img, angle)) labels.append(label_idx + i) info.append(full_file_name) fileflag = 1 if fileflag: label_idx += 4 if augment_with_rotations else 1 return images, labels, info
Example #8
Source File: data_process.py From MobileFaceNet_TF with Apache License 2.0 | 5 votes |
def random_rotate_image(image): angle = np.random.uniform(low=-10.0, high=10.0) return misc.imrotate(image, angle, 'bicubic')
Example #9
Source File: data_utils.py From object_detection_kitti with Apache License 2.0 | 5 votes |
def crawl_directory(directory, augment_with_rotations=False, first_label=0): """Crawls data directory and returns stuff.""" label_idx = first_label images = [] labels = [] info = [] # traverse root directory for root, _, files in os.walk(directory): logging.info('Reading files from %s', root) fileflag = 0 for file_name in files: full_file_name = os.path.join(root, file_name) img = imread(full_file_name, flatten=True) for i, angle in enumerate([0, 90, 180, 270]): if not augment_with_rotations and i > 0: break images.append(imrotate(img, angle)) labels.append(label_idx + i) info.append(full_file_name) fileflag = 1 if fileflag: label_idx += 4 if augment_with_rotations else 1 return images, labels, info
Example #10
Source File: data_utils.py From object_detection_with_tensorflow with MIT License | 5 votes |
def crawl_directory(directory, augment_with_rotations=False, first_label=0): """Crawls data directory and returns stuff.""" label_idx = first_label images = [] labels = [] info = [] # traverse root directory for root, _, files in os.walk(directory): logging.info('Reading files from %s', root) fileflag = 0 for file_name in files: full_file_name = os.path.join(root, file_name) img = imread(full_file_name, flatten=True) for i, angle in enumerate([0, 90, 180, 270]): if not augment_with_rotations and i > 0: break images.append(imrotate(img, angle)) labels.append(label_idx + i) info.append(full_file_name) fileflag = 1 if fileflag: label_idx += 4 if augment_with_rotations else 1 return images, labels, info
Example #11
Source File: facenet.py From real-time-face-recognition-with-facenet with MIT License | 5 votes |
def random_rotate_image(image): angle = np.random.uniform(low=-10.0, high=10.0) return misc.imrotate(image, angle, 'bicubic')
Example #12
Source File: data_utils.py From HumanRecognition with MIT License | 5 votes |
def crawl_directory(directory, augment_with_rotations=False, first_label=0): """Crawls data directory and returns stuff.""" label_idx = first_label images = [] labels = [] info = [] # traverse root directory for root, _, files in os.walk(directory): logging.info('Reading files from %s', root) fileflag = 0 for file_name in files: full_file_name = os.path.join(root, file_name) img = imread(full_file_name, flatten=True) for i, angle in enumerate([0, 90, 180, 270]): if not augment_with_rotations and i > 0: break images.append(imrotate(img, angle)) labels.append(label_idx + i) info.append(full_file_name) fileflag = 1 if fileflag: label_idx += 4 if augment_with_rotations else 1 return images, labels, info
Example #13
Source File: data_utils.py From g-tensorflow-models with Apache License 2.0 | 5 votes |
def crawl_directory(directory, augment_with_rotations=False, first_label=0): """Crawls data directory and returns stuff.""" label_idx = first_label images = [] labels = [] info = [] # traverse root directory for root, _, files in os.walk(directory): logging.info('Reading files from %s', root) fileflag = 0 for file_name in files: full_file_name = os.path.join(root, file_name) img = imread(full_file_name, flatten=True) for i, angle in enumerate([0, 90, 180, 270]): if not augment_with_rotations and i > 0: break images.append(imrotate(img, angle)) labels.append(label_idx + i) info.append(full_file_name) fileflag = 1 if fileflag: label_idx += 4 if augment_with_rotations else 1 return images, labels, info
Example #14
Source File: data_utils.py From models with Apache License 2.0 | 5 votes |
def crawl_directory(directory, augment_with_rotations=False, first_label=0): """Crawls data directory and returns stuff.""" label_idx = first_label images = [] labels = [] info = [] # traverse root directory for root, _, files in os.walk(directory): logging.info('Reading files from %s', root) fileflag = 0 for file_name in files: full_file_name = os.path.join(root, file_name) img = imread(full_file_name, flatten=True) for i, angle in enumerate([0, 90, 180, 270]): if not augment_with_rotations and i > 0: break images.append(imrotate(img, angle)) labels.append(label_idx + i) info.append(full_file_name) fileflag = 1 if fileflag: label_idx += 4 if augment_with_rotations else 1 return images, labels, info
Example #15
Source File: test_invariance_on_lfw.py From facenet with MIT License | 5 votes |
def rotate_images(images, angle, image_size): images_list = [None] * images.shape[0] for i in range(images.shape[0]): images_list[i] = misc.imrotate(images[i,:,:,:], angle) images_rot = np.stack(images_list,axis=0) sz1 = images_rot.shape[1]/2 sz2 = image_size/2 images_crop = images_rot[:,(sz1-sz2):(sz1+sz2),(sz1-sz2):(sz1+sz2),:] return images_crop
Example #16
Source File: facenet.py From facenet with MIT License | 5 votes |
def random_rotate_image(image): angle = np.random.uniform(low=-10.0, high=10.0) return misc.imrotate(image, angle, 'bicubic') # 1: Random rotate 2: Random crop 4: Random flip 8: Fixed image standardization 16: Flip
Example #17
Source File: data_utils.py From multilabel-image-classification-tensorflow with MIT License | 5 votes |
def crawl_directory(directory, augment_with_rotations=False, first_label=0): """Crawls data directory and returns stuff.""" label_idx = first_label images = [] labels = [] info = [] # traverse root directory for root, _, files in os.walk(directory): logging.info('Reading files from %s', root) fileflag = 0 for file_name in files: full_file_name = os.path.join(root, file_name) img = imread(full_file_name, flatten=True) for i, angle in enumerate([0, 90, 180, 270]): if not augment_with_rotations and i > 0: break images.append(imrotate(img, angle)) labels.append(label_idx + i) info.append(full_file_name) fileflag = 1 if fileflag: label_idx += 4 if augment_with_rotations else 1 return images, labels, info
Example #18
Source File: test_invariance_on_lfw.py From facenet-demo with MIT License | 5 votes |
def rotate_images(images, angle, image_size): images_list = [None] * images.shape[0] for i in range(images.shape[0]): images_list[i] = misc.imrotate(images[i,:,:,:], angle) images_rot = np.stack(images_list,axis=0) sz1 = images_rot.shape[1]/2 sz2 = image_size/2 images_crop = images_rot[:,(sz1-sz2):(sz1+sz2),(sz1-sz2):(sz1+sz2),:] return images_crop
Example #19
Source File: data_utils.py From DOTA_models with Apache License 2.0 | 5 votes |
def crawl_directory(directory, augment_with_rotations=False, first_label=0): """Crawls data directory and returns stuff.""" label_idx = first_label images = [] labels = [] info = [] # traverse root directory for root, _, files in os.walk(directory): logging.info('Reading files from %s', root) fileflag = 0 for file_name in files: full_file_name = os.path.join(root, file_name) img = imread(full_file_name, flatten=True) for i, angle in enumerate([0, 90, 180, 270]): if not augment_with_rotations and i > 0: break images.append(imrotate(img, angle)) labels.append(label_idx + i) info.append(full_file_name) fileflag = 1 if fileflag: label_idx += 4 if augment_with_rotations else 1 return images, labels, info
Example #20
Source File: facenet.py From uai-sdk with Apache License 2.0 | 5 votes |
def random_rotate_image(image): angle = np.random.uniform(low=-10.0, high=10.0) return misc.imrotate(image, angle, 'bicubic') # 1: Random rotate 2: Random crop 4: Random flip 8: Fixed image standardization 16: Flip
Example #21
Source File: utils.py From aitom with GNU General Public License v3.0 | 5 votes |
def random_rotate_image(image): angle = np.random.uniform(low=-10.0, high=10.0) return misc.imrotate(image, angle, 'bicubic')
Example #22
Source File: facenet.py From facenet_mtcnn_to_mobile with MIT License | 5 votes |
def random_rotate_image(image): angle = np.random.uniform(low=-10.0, high=10.0) return misc.imrotate(image, angle, 'bicubic') # 1: Random rotate 2: Random crop 4: Random flip 8: Fixed image standardization 16: Flip
Example #23
Source File: data_process.py From MobileFaceNet_Tensorflow with Apache License 2.0 | 5 votes |
def random_rotate_image(image): angle = np.random.uniform(low=-10.0, high=10.0) return misc.imrotate(image, angle, 'bicubic')
Example #24
Source File: facenet.py From facenet_trt with MIT License | 5 votes |
def random_rotate_image(image): angle = np.random.uniform(low=-10.0, high=10.0) return misc.imrotate(image, angle, 'bicubic') # 1: Random rotate 2: Random crop 4: Random flip 8: Fixed image standardization 16: Flip
Example #25
Source File: data_utils.py From Gun-Detector with Apache License 2.0 | 5 votes |
def crawl_directory(directory, augment_with_rotations=False, first_label=0): """Crawls data directory and returns stuff.""" label_idx = first_label images = [] labels = [] info = [] # traverse root directory for root, _, files in os.walk(directory): logging.info('Reading files from %s', root) fileflag = 0 for file_name in files: full_file_name = os.path.join(root, file_name) img = imread(full_file_name, flatten=True) for i, angle in enumerate([0, 90, 180, 270]): if not augment_with_rotations and i > 0: break images.append(imrotate(img, angle)) labels.append(label_idx + i) info.append(full_file_name) fileflag = 1 if fileflag: label_idx += 4 if augment_with_rotations else 1 return images, labels, info
Example #26
Source File: facenet.py From real-time-deep-face-recognition with MIT License | 5 votes |
def random_rotate_image(image): angle = np.random.uniform(low=-10.0, high=10.0) return misc.imrotate(image, angle, 'bicubic')
Example #27
Source File: custom_transforms.py From cc with MIT License | 5 votes |
def __call__(self, images, intrinsics): if np.random.random() > 0.5: return images, intrinsics else: assert intrinsics is not None rot = np.random.uniform(0,10) rotated_images = [imrotate(im, rot) for im in images] return rotated_images, intrinsics
Example #28
Source File: data_utils.py From yolo_v2 with Apache License 2.0 | 5 votes |
def crawl_directory(directory, augment_with_rotations=False, first_label=0): """Crawls data directory and returns stuff.""" label_idx = first_label images = [] labels = [] info = [] # traverse root directory for root, _, files in os.walk(directory): logging.info('Reading files from %s', root) fileflag = 0 for file_name in files: full_file_name = os.path.join(root, file_name) img = imread(full_file_name, flatten=True) for i, angle in enumerate([0, 90, 180, 270]): if not augment_with_rotations and i > 0: break images.append(imrotate(img, angle)) labels.append(label_idx + i) info.append(full_file_name) fileflag = 1 if fileflag: label_idx += 4 if augment_with_rotations else 1 return images, labels, info
Example #29
Source File: facenet.py From Rekognition with GNU General Public License v3.0 | 5 votes |
def random_rotate_image(image): logger.info(msg="random_rotate_image called") angle = np.random.uniform(low=-10.0, high=10.0) return misc.imrotate(image, angle, 'bicubic') # 1: Random rotate # 2: Random crop # 4: Random flip # 8: Fixed image standardization # 16: Flip
Example #30
Source File: facenet.py From TNT with GNU General Public License v3.0 | 5 votes |
def random_rotate_image(image): angle = np.random.uniform(low=-10.0, high=10.0) return misc.imrotate(image, angle, 'bicubic') # 1: Random rotate 2: Random crop 4: Random flip 8: Fixed image standardization 16: Flip