Matlab 数字图像处理1---图像的收缩和放大
内插是在放大、收缩、旋转和几何校正等任务中广泛应用的基本工具。
最近邻内插法(nearest): 原图像中寻找最接近的像素,并把该像素的灰度赋给新像素。
双线性内插法(bilinear):用4个最近邻去估计给定位置的灰度。(最实用)
v(x, y) = ax + by + cxy + d;
v(x, y)灰度值; a,b,c,d通过四个最近邻点求得。
双三次内插法(bicubic):用16个最近邻点赋予给定位置的灰度值.(商业图像编辑程序的标准内插方法).(数字图像处理(P37))
v(x, y) = ∑∑aijxiyj
v(x, y)灰度值; 0≤i≤3; 0≤j≤3; aij通过四个最近邻点求得。
Matlab Keyword: imresize
code:
Image_original = imread(D:图像处理image ice1.jpg); Image_shrink2_1 = imresize(Image_original,[128 128]); Image_shrink2_2 = imresize(Image_original,0.5); Image_enlarge2_nearest = imresize(Image_original,2,nearest); Image_enlarge2_bilinear = imresize(Image_original,2,bilinear); Image_enlarge2_bicubic = imresize(Image_original,2,bicubic); subplot(231) imshow(Image_original) title(Original) subplot(232) imshow(Image_shrink2_1) title(Shrink 2 times_1) subplot(233) imshow(Image_shrink2_2) title(Shrink 2 times_2) subplot(234) imshow(Image_enlarge2_nearest) title(Enlarge 2 times.nearest) subplot(235) imshow(Image_enlarge2_bilinear) title(Enlarge 2 times.bilinear) subplot(236) imshow(Image_enlarge2_bicubic)
title(Enlarge 2 times.bicubic)
处理结果:
相关链接:
内插是在放大、收缩、旋转和几何校正等任务中广泛应用的基本工具。 最近邻内插法(nearest): 原图像中寻找最接近的像素,并把该像素的灰度赋给新像素。 双线性内插法(bilinear):用4个最近邻去估计给定位置的灰度。(最实用) v(x, y) = ax + by + cxy + d; v(x, y)灰度值; a,b,c,d通过四个最近邻点求得。 双三次内插法(bicubic):用16个最近邻点赋予给定位置的灰度值.(商业图像编辑程序的标准内插方法).(数字图像处理(P37)) v(x, y) = ∑∑aijxiyj v(x, y)灰度值; 0≤i≤3; 0≤j≤3; aij通过四个最近邻点求得。 Matlab Keyword: imresize code: Image_original = imread(D:图像处理image ice1.jpg); Image_shrink2_1 = imresize(Image_original,[128 128]); Image_shrink2_2 = imresize(Image_original,0.5); Image_enlarge2_nearest = imresize(Image_original,2,nearest); Image_enlarge2_bilinear = imresize(Image_original,2,bilinear); Image_enlarge2_bicubic = imresize(Image_original,2,bicubic); subplot(231) imshow(Image_original) title(Original) subplot(232) imshow(Image_shrink2_1) title(Shrink 2 times_1) subplot(233) imshow(Image_shrink2_2) title(Shrink 2 times_2) subplot(234) imshow(Image_enlarge2_nearest) title(Enlarge 2 times.nearest) subplot(235) imshow(Image_enlarge2_bilinear) title(Enlarge 2 times.bilinear) subplot(236) imshow(Image_enlarge2_bicubic) title(Enlarge 2 times.bicubic) 处理结果: 相关链接: