您现在的位置是:首页 > 数码 > 

matlab自动保存图像

2025-07-26 16:06:14
matlab自动保存图像 在使用imwrite函数对图片进行保存时需要指定图像位置及图像名称,不同的图像结果进行保存不免有些麻烦,所以在此写下自动保存图像方法。 clear all;clc;close all; Img_path = ../origin-imgs/Dawn Sky.jpg ; path = ../res

matlab自动保存图像

在使用imwrite函数对图片进行保存时需要指定图像位置及图像名称,不同的图像结果进行保存不免有些麻烦,所以在此写下自动保存图像方法。

clear all;clc;close all;
Img_path = 	../origin-imgs/Dawn Sky.jpg	;
path = 	../result	;
origin_Img = imread(Img_path);
[dir, file, ext] = fileparts(Img_path);
filename = [file, 	_another	,ext];
newPath = fullfile(path,filename);
newPath = strrep(newPath,	\	,	/	);
imwrite(origin_Img, newPath);
fileparts:

获取文件名的组成部分。
** 用法:**
** [filepath, name, ext] = fileparts(filename)**
返回文件的路径名称、文件名、扩展名。

fullfile:

创建合成完整的地址字符串。
例:

file = fullfile(	C:	,	A	,	one	,		)
file =	C:\A\one\	

这得到的是绝对路径,如果使用相对路径时需要使用strrep函数将’/ 替换成 /

#感谢您对电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格的认可,转载请说明来源于"电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格

本文地址:http://www.dnpztj.cn/shuma/857236.html

相关标签:无
上传时间: 2024-02-10 10:22:56
留言与评论(共有 18 条评论)
本站网友 租房子上什么网
0秒前 发表
/ ); imwrite(origin_Img
本站网友 蚰蜓
29分钟前 发表
ext]; newPath = fullfile(path
本站网友 川沙
15分钟前 发表
one
本站网友 酒香不怕巷子深
26分钟前 发表
** 用法:** ** [filepath
本站网友 柏林时装周
29分钟前 发表
文件名
本站网友 222se
8分钟前 发表
ext]; newPath = fullfile(path
本站网友 长岭
17分钟前 发表
file
本站网友 工程质量检测
21分钟前 发表
ext]; newPath = fullfile(path
本站网友 民众眼科
23分钟前 发表
_another
本站网友 伯里曼
24分钟前 发表
filename); newPath = strrep(newPath
本站网友 豪华车库
24分钟前 发表
file
本站网友 宁津二手房
18分钟前 发表
clear all;clc;close all; Img_path = ../origin-imgs/Dawn Sky.jpg ; path = ../result ; origin_Img = imread(Img_path); [dir
本站网友 巅峰阁
27分钟前 发表
_another
本站网友 星级酒店客房
25分钟前 发表
文件名
本站网友 入围
7分钟前 发表
newPath); fileparts
本站网友 深圳东门租房
19分钟前 发表
\
本站网友 pathinfo
24分钟前 发表
文件名