数字图像处理对图像的放缩
来源:互联网 发布:linux挂载阵列 编辑:程序博客网 时间:2024/06/09 16:38
function newImage=resample1(image,newRow,newCol)
% 功能:对图像进行缩放
% 输入:image-需要进行缩放的灰度图像;
% newRow-缩放后新图像的行数;
% newCol-缩放后新图像的列数;
% 输出:newImage-缩放后的图像。
[row,col]=size(image);
image_larger=zeros((row+1),(col+1));
image_larger(1:row,1:col)=image;
image=image_larger;
newImage=zeros(newRow,newCol);
for i=0:(newRow-1)
for j=0:(newCol-1)
x=j*(col-1)/(newCol-1);
y=i*(row-1)/(newRow-1);
fx=floor(x);
fy=floor(y);
area_ul=(x-fx)*(y-fy);
area_ur=(fx+1-x)*(y-fy);
area_bl=(x-fx)*(fy+1-y);
area_br=(fx+1-x)*(fy+1-y);
newImage(i+1,j+1)=...
image(fy+1,fx+1)*area_br+...
image(fy+1,fx+2)*area_bl+...
image(fy+2,fx+1)*area_ur+...
image(fy+2,fx+2)*area_ul;
end
end
****
% 功能:对图像进行缩放
% 输入:image-需要进行缩放的灰度图像;
% newRow-缩放后新图像的行数;
% newCol-缩放后新图像的列数;
% 输出:newImage-缩放后的图像。
[row,col]=size(image);
image_larger=zeros((row+1),(col+1));
image_larger(1:row,1:col)=image;
image=image_larger;
newImage=zeros(newRow,newCol);
for i=0:(newRow-1)
for j=0:(newCol-1)
x=j*(col-1)/(newCol-1);
y=i*(row-1)/(newRow-1);
fx=floor(x);
fy=floor(y);
area_ul=(x-fx)*(y-fy);
area_ur=(fx+1-x)*(y-fy);
area_bl=(x-fx)*(fy+1-y);
area_br=(fx+1-x)*(fy+1-y);
newImage(i+1,j+1)=...
image(fy+1,fx+1)*area_br+...
image(fy+1,fx+2)*area_bl+...
image(fy+2,fx+1)*area_ur+...
image(fy+2,fx+2)*area_ul;
end
end
****
0 0
- 数字图像处理对图像的放缩
- 对用Mat表示的图像进行放缩处理
- 数字图像处理,图像的伪彩色处理
- 【数字图像处理】图像的gamma校正
- 【数字图像处理】图像的简单几何变换
- 数字图像处理标准图像Lena的故事
- 数字图像处理标准图像Lena的故事
- 数字图像处理标准图像Lena的故事
- 【数字图像处理一】BMP图像的读取
- 数字图像处理-图像的边缘检测
- 数字图像处理-图像的平滑和锐化。
- python数字图像处理:图像的绘制
- 数字图像处理之一 对图像进行傅立叶变换
- 数字图像处理——用Java对图像做镜像变换
- 【数字图像处理】图像金字塔
- 数字图像处理-图像金字塔
- 图像压缩-数字图像处理
- python数字图像处理(6):图像的批量处理
- mysql中locate和position函数的使用方法
- acdream 1089 二分
- untu 下操作目录,出现Permission denied的解决办法
- Java中关于list的深拷贝与浅拷贝
- 802.11协议帧间间隔-SIFS,DIFS,PIFS,EIFS 及 slottime
- 数字图像处理对图像的放缩
- 最美好的事,是看到某人的微笑;更美好的事,是TA因你而微笑
- 软件开发者需要知道国外技术网站
- Working with JSON in C#
- 黑马程序员——C语言之预处理命令
- PHP 文件打开/读取
- Android多线程分析之一:使用Thread异步下载图像
- 权限修饰符
- Android 4.0 Launcher2源码分析——桌面快捷图标的拖拽