当前位置:网站首页>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
边栏推荐
- Taylor formula and common expansion
- What is the production process of enterprise website? How long does it take to design and build a website?
- 不容错过 | 华为内部资料--成功的项目管理PPT(123页)
- 暑假第一周
- Grpc security -2: fast implementation of server-side JWT authentication
- 泰勒公式及常用展开
- Gbase observation: extended analytical database
- Unity Text组件空格换行问题
- 数字物业管理成趋势,传统物业公司如何通过转型实现数字化蝶变?
- Visual explanation of clockwise inner curve in Green's formula hole digging method
猜你喜欢

多门店药品进销存系统源码 大型连锁药店管理系统源码

EF Core中的三类事务(SaveChanges、DbContextTransaction、TransactionScope)

Docker redis cluster configuration

生成式对抗网络(GANs)及变体

产线工控安全有什么好的解决方案

Goodbye, 2020, this bowl of poisonous chicken soup, I'll dry it first

Idea automatically generates unit tests, doubling efficiency!

不容错过 | 华为内部资料--成功的项目管理PPT(123页)

2022山东健博会,济南国际大健康产业博览会,中国营养健康展

Taylor formula and common expansion
随机推荐
点乘和叉乘
关于H5移动端用什么自动化测试
Detailed explanation of index invalidation caused by MySQL
Notepad++实用功能分享(正则行尾行首替换常用方法、文本比对功能等)
Chrome plug-in features and case analysis of actual combat scenarios
How to achieve the turning effect of wechat video recording?
高仿书旗小说 Flutter 版,学起来
Digital supply chain management system for metallurgical industry: platform lean enterprise management to help the high-quality development of the industry
[things about gbase] gbase 8s high availability technology and case analysis (issue 02)
Some common tool functions in work
Cross domain issues of the new version of Google browser
不同物体使用同一材质,有不同的表现
为实现“双碳”目标,应如何实现节能、合理的照明管控
Idea automatically generates unit tests, doubling efficiency!
Unity text component space newline problem
[proteus simulation] example of T6963C driving pg12864 (with Chinese and English display)
一个人竟然撸了一个微博 APP
完整开源项目之诗词吧 APP
依赖倒置原则
6 大完整开源项目,一次学个够