⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nearest.m

📁 [matlab] DIP nearest neighbor interpolation and bilinear interploation
💻 M
字号:
function nearest(img,a)
A=double(img);
B=zeros(a.*size(A));
[br_size,bc_size]=size(B);

for i=1:br_size
    for j=1:bc_size
        x=round(i/a);
        y=round(j/a);
        if x==0
            x=1;
        end
        if y==0
            y=1;
        end
        B(i,j)=A(x,y);
    end 
end

imshow(uint8(B));
size(A)
size(B)
imwrite(uint8(B),'d:\pic\result.jpg','jpg');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -