Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
是否可以在MATLAB中使用插值而不调整图像大小?_Matlab_Image Processing_Interpolation - Fatal编程技术网

是否可以在MATLAB中使用插值而不调整图像大小?

是否可以在MATLAB中使用插值而不调整图像大小?,matlab,image-processing,interpolation,Matlab,Image Processing,Interpolation,我有一个图像,其中一些像素被故意更改为零。现在我想做一个双线性插值,像双线性插值一样使用邻域来找出新的像素值。但是,我不想调整图像的大小(MATLAB只能通过调整大小功能进行双线性插值) 是否可以在不调整大小的情况下在MATLAB中进行双线性插值?我读到双线性核的卷积可以解决这个问题。你知道这是哪个内核吗?有可能做我想做的吗 您可以尝试使用以下支持的选项之一: 示例 % create sample data [X, Y] = meshgrid(1:10, 1:10); Z_original =

我有一个图像,其中一些像素被故意更改为零。现在我想做一个双线性插值,像双线性插值一样使用邻域来找出新的像素值。但是,我不想调整图像的大小(MATLAB只能通过调整大小功能进行双线性插值)


是否可以在不调整大小的情况下在MATLAB中进行双线性插值?我读到双线性核的卷积可以解决这个问题。你知道这是哪个内核吗?有可能做我想做的吗

您可以尝试使用以下支持的选项之一:

示例

% create sample data
[X, Y] = meshgrid(1:10, 1:10);
Z_original = X.*Y;

% remove a data point
Z_distorted = Z_original;
Z_distorted(5, 5) = nan;

% reconstruct
valid = ~isnan(Z_distorted);
Z_reconstructed = Z_distorted;
Z_reconstructed(~valid) = griddata(X(valid),Y(valid),Z_distorted(valid),X(~valid),Y(~valid));

% plot the result
figure
surface(Z_original);

figure
surface(Z_distorted);

figure
surface(Z_reconstructed);

您可能会发现这很有用。我不认为它有那些具体的方法,不幸的是,我自己经常用它来做图像插值,它非常好。如果你有这个特定的要求,你可能想去别的地方看看。请看这个相关的。简而言之,您可以使用inplant_nans()或TriScatteredInterp/scatteredInterpolant,它们都支持线性插值,但不支持立方。什么叫“不调整大小”?如果不创建新值,您希望插值什么?这需要更多的解释。interp2提供各种类型的interpolation@AnderBiguri他们希望将0值替换为通过插值邻域找到的值。在您的示例中,有矩阵X、Y和Z,Z由X和Y构成。我只有一个矩阵Z,尺寸为1500x1500x3。如何将Z矩阵拆分为矩阵X和Y,如您的示例所示?
[X,Y]=meshgrid(1:1500,1:1500)
。请注意,X,Y是计算Z的每个点的坐标。您可能希望独立插值第三维。
% create sample data
[X, Y] = meshgrid(1:10, 1:10);
Z_original = X.*Y;

% remove a data point
Z_distorted = Z_original;
Z_distorted(5, 5) = nan;

% reconstruct
valid = ~isnan(Z_distorted);
Z_reconstructed = Z_distorted;
Z_reconstructed(~valid) = griddata(X(valid),Y(valid),Z_distorted(valid),X(~valid),Y(~valid));

% plot the result
figure
surface(Z_original);

figure
surface(Z_distorted);

figure
surface(Z_reconstructed);