转自:http://blog.csdn.net/cike0cop/article/details/53087995
html
%author:coplin %time:2016-10-10 %function:change the size of Image. addpath('dealImg'); addpath('Img'); ListName=dir('Img\*.jpg'); [Pm,Pn]=size(ListName); for iPm=1:1:Pm %读取文件夹全部图片循环 oriImg=imread(ListName(iPm).name); %readImg cutImg=imcrop(oriImg,[50,50,255,255]); %bi=imresize(oriImg,0.6); %bi缩放为ai的0.6倍 %endImg=imresize(cutImg,[256,256]); %把ai转成256x256的大小 iDealName=ListName(iPm).name; iDealAddress='dealImg\'; iDealAll=strcat(iDealAddress,iDealName); ID=imresize(cutImg,1); imwrite(ID,iDealAll); end转自:http://blog.csdn.net/wuzuyu365/article/details/78215268
%把一个目录下的图片缩放到指定大小 dpath = 'D:\tst测试工做\测试文件\清晰照片库1300张'; lst = dir(dpath); cnt = 0; for i=1:length(lst) if isdir(lst(i).name) continue; end tpath = [lst(i).folder,'\', lst(i).name]; im=imread(tpath); [m,n,c]=size(im); if m < 1 || n < 1 fprintf('bad image, %s\n', tpath); continue; end if m<500 || n<500 cnt = cnt+1; fprintf('%d, small image,(%d,%d), %s\n', cnt, m,n, tpath); x= min(m,n); ratio = 505 / x; im=imresize(im, ratio); imwrite(im, tpath); end end
转自:http://www.cnblogs.com/rong86/p/3558344.html算法
matlab中函数imresize简介:函数
函数功能:该函数用于对图像作缩放处理。测试
调用格式:spa