Rotate images in batches

When you are working on a project, you need to rotate all the images at a certain angle, so write this program, using matlab.

clc;clear;                              
%% batch read rotation image

 Degree = 270 % degree to rotate, counterclockwise
 File_path = 'C:\Users\yyy\Desktop\process\raw\';% image folder path
 Img_path_list = dir(strcat(file_path,'*.jpg'));%Get all images in jpg format in this folder
 Img_num = length(img_path_list);%Get the total number of images


 If img_num > 0 % has images that satisfy the condition
                 For j = 1: img_num % read images one by one
                         Image_name = img_path_list(j).name;% image name
            image =  imread(strcat(file_path,image_name));
                         Fprintf('%d %d %s\n',i,j,strcat(file_path,image_name));% shows the name of the image being processed
            
            I=imrotate(image,270);
                         Imwrite(uint8(I),['C:\Users\yyy\Desktop\process\rotated\', '\', image_name, '.jpg']); %Save
        end
end

Reprinted at: https://www.jianshu.com/p/0192b089af5f

Intelligent Recommendation

Images are downloaded in batches and packaged into zip

Need to introduce two js files: js file download address: link: Extraction code: 1q2w The image data format data format imported below: //The only picture information used is: gz_qrcode Below is the s...

Download sentinel2 images in batches with python

Keywords: sentinel2, python, batch download First download and unzip the aria2 archive. (Official account replies to the keyword 'aria2' to obtain) After adding the required data to the shopping cart,...

Rename images in batches using python

Simple python program that can rename images in batches in order of numbers The code is as follows: in: path_in is the path to rename the folder class_name is the suffix name of the renamed file. The ...

Convert images to 3D images in WPF and rotate them

Original: Convert images to 3D images in WPF and rotate them The time stolen by the time is always precious that cannot be seen under our eyes.   First of all, let's take a look at the initial ru...

More Recommendation

Use TensorFlow to randomly rotate images

useTensorFlow rotates images randomly When using deep learning to train images, random rotation of the images helps to improve the model generalization ability. However, before doing preprocessing suc...

Use jQuery to rotate multiple images

Record how to get, save the next time, this kind of approach I only tried to support Chrome and IE11, and other other can not be used. Introduce JS HTML code: JS code:...

Python uses opencv to add subtitles to images in batches

Among them, the path is the location of the picture. Fonts.txt stores subtitles, one per line, and the number of lines is the same as the number of pictures. Very simplified code, the function is very...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top