MATLAB之图片简单处理

有更好的解决方式,欢迎赐教!
1.图片切割
RGB=imread(‘path_to_picture’);
RGB2=imcrop(RGB,[157,71,931,732]);
figure(‘visible’,’off’);
axis off
imwrite(RGB2,’path_to_storage_picture’,’jpeg’);
close(gcf);
其中,对于函数imcrop(RGB,[a,b,c,d]),a、b表示裁剪后左上角像素在原始图片中的位置,c、d分别表示裁剪后的图像宽与高。

2.图片大小更改
使用imresize函数实现:
one=imread(‘path_to_picture’);
two=imresize(one,[256 256]);#设置更改后的大小为256*256

3.图片重命名
文件重命名的实现有多种方式,其中可以使用movefile函数来实现,即复制文件:
movefile(‘path_to_old_name_picture’,’path_to_storage_new_name_file’,’f’);

posted @ 2017-05-16 17:50  朝云出岫  阅读(18)  评论(0)    收藏  举报  来源