欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

Python中的逻辑运算符:与、或和非的符号表示

最编程 2024-01-16 16:54:43
...
【Matlab】如何对二维矩阵进行线性/非线性插值?

@Sean_: 写成了函数供大家参考 [code=plain] src = magic(10); scale_factor_width = 8; scale_factor_height = 8; [dst_bilinear, dst_bicubic] = test_interp(src,scale_factor_width,scale_factor_height); function [dst_bilinear, dst_bicubic] = test_interp(src, factor_width, factor_height) if ~isa(src, 'double') src = double(src); end width = size(src,2); height = size(src,1); x = 1:factor_width:get_index(width,factor_width); y = 1:factor_height:get_index(height,factor_height); [X,Y] = meshgrid(x,y); x = 1:get_index(width,factor_width); y = 1:get_index(height,factor_height); [Xq,Yq] = meshgrid(x,y); dst_bilinear = interp2(X,Y,src,Xq,Yq); dst_bicubic = interp2(X,Y,src,Xq,Yq,'bicubic'); figure(1); title("result of bilinear interpolate"); surf(dst_bilinear); colorbar; figure(2); title("result of bicubic interpolate"); surf(dst_bicubic); colorbar; end function index = get_index(i, scale_factor) index = (i - 1) * scale_factor + 1; end [/code]

推荐阅读