当前位置:网站首页>Batch renaming of images by MATLAB
Batch renaming of images by MATLAB
2022-06-23 23:52:00 【HH~LL】
During the experiment , Picture naming is not standardized , It may bring us a lot of trouble in subsequent data processing , Because the general program reads the image from the folder first according to the image name , If it is 1000 Zhang image , from 1 Start naming , namely 1——1000, Read order is not 1 2 3…, It is 1 10 11 12 …100 Read first 1 At the beginning Read again 2 At the beginning , It is equivalent to reading out of order . Therefore, it is necessary to name images in a standard way .
If the total number of pictures is greater than 1000, You can modify the inner layer for The conditions in the loop and 0 The number of
file_path1=' Image folders to be named in batch ';
file_path2=' Name the folder where the pictures are saved ';
img_path_list = dir(strcat(file_path1,'*.png'));% Get all... In this folder jpg Format image
img_num = length(img_path_list);% Total number of captured images
if img_num > 0 % There are images that meet the conditions
for j = 1:img_num % Read the images one by one
image_name_old = img_path_list(j).name;% Image name
if j<10
image_name_new = strcat('000',num2str(j),'.png');
image = imread(strcat(file_path1,image_name_old));
imwrite(image,strcat(file_path2,image_name_new))
elseif j>=10 && j<100
image_name_new = strcat('00',num2str(j),'.png');
image = imread(strcat(file_path1,image_name_old));
imwrite(image,strcat(file_path2,image_name_new))
elseif j>=100
image_name_new = strcat('0',num2str(j),'.png');
image = imread(strcat(file_path1,image_name_old));
imwrite(image,strcat(file_path2,image_name_new))
end
end
end
边栏推荐
- Tupu software intelligent wind power: operation and maintenance of digital twin 3D wind turbine intelligent equipment
- Solve the problem that slf4j logs are not printed
- PMP考试相关计算公式汇总!考前必看
- 一款高仿腾讯漫画的漫画阅读类 APP
- Under the background of aging, the comprehensive energy efficiency management platform escorts hospitals
- 再来一个高仿开眼的短视频APP
- Niuke.com: the double pointer problem of receiving rainwater
- 关于H5移动端用什么自动化测试
- What kind of automated test is used for H5 mobile terminal
- 冶金行业数字化供应链管理系统:平台精益化企业管理,助力产业高质量发展
猜你喜欢

三维向量场中的通量

Solve the problem that slf4j logs are not printed

UART协议时序总结

Image segmentation - data annotation

Detailed explanation of index invalidation caused by MySQL

Postman返回值中文乱码????

AutoCAD -- summarize three methods of drawing rounded corners in CAD

Docker deploy redis

老龄化下背景下,综合能效管理平台为医院保驾护航

smart-doc + Torna 兼容版本
随机推荐
老龄化下背景下,综合能效管理平台为医院保驾护航
Improvement of DC power distribution with open hall current sensor
NLP-D58-nlp比赛D27&刷题D14&读论文&mathtype
Solve the problem that slf4j logs are not printed
完整开源项目之诗词吧 APP
Detailed explanation of index invalidation caused by MySQL
Quelques fonctions d'outils couramment utilisées au travail
6. STM32 - serial port data transceiver Foundation
1004. number of maximum consecutive 1 III ●●
Revit API:明细表 ViewSchedule
不容错过 | 华为内部资料--成功的项目管理PPT(123页)
PMP Exam related calculation formula summary! Must see before examination
文言文能编程???
How to achieve energy-saving and reasonable lighting control in order to achieve the "double carbon" goal
Goodbye, 2020, this bowl of poisonous chicken soup, I'll dry it first
高仿书旗小说 Flutter 版,学起来
Setting method of bar code local segment data variable
PMP考试相关计算公式汇总!考前必看
【Try to Hack】masscan
7、STM32——LCD