在具有不同滤波器的MATLAB中调整大小 [英] Resizing in MATLAB w/ different filters

查看:205
本文介绍了在具有不同滤波器的MATLAB中调整大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个形象。我想调整它的大小,使原来的大小加倍,通过插值填充新的像素。我需要指定要使用的插值类型。



我看到imresize函数,它有一个'method'选项。问题是,只有3种选择:最近的,双线性的,双三次的。双线性和双三次均值/均值方法,但有没有办法设置邻域大小/权重?

主要问题是,我需要做一个'中值插值法,而不是平均值。我怎样才能告诉它使用这种方法?I / O> IMRESIZE实现插值的方式是通过计算输出中的每个像素图像(逆映射),输入图像中将要参与插值的像素的索引以及贡献权重。

邻域和权重是由所使用的内插内核的类型决定的,如下所示:@Abert(@ 指出,可以传递给IMRESIZE函数('Method'属性可以接受 {f,w} 具有内核函数和内核宽度的单元数组)

这两个组件将被用来计算所涉及的输入像素的线性组合来填充ea输出像素的ch值。这个过程是沿着每个维度单独进行的(纵向然后是水平方向)。



现在问题在于,您永远无法获得中值通过使用线性组合,这是因为中值是一个非线性排序过滤器。所以你唯一的选择是编写你自己的实现...


I have an image. I want to resize it to double the original size, filling in the new pixels by interpolation. I need to specify which type of interpolation I want to use.

I see the imresize function, which has an option for 'method'. The problem is, there are only 3 options: nearest, bilinear, bicubic. Bilinear and bicubic are averaging/mean methods, but is there any way to set the neighborhood size / weighting?

The main problem is, I need to do it with a 'median' interpolation method, instead of mean. How can I tell it to use this method?

解决方案

The way that IMRESIZE implements interpolation is by calculating for each pixel in the output image (inverse mapping), the indices of the pixels in the input image that are going to be involved in the interpolation, along with the contributing weights.

The neighborhood and the weights are determined by the type of the interpolation kernel used, which as @Albert points out, can be passed along to the IMRESIZE function (the 'Method' property can accept {f,w} a cell array with the kernel function and the kernel width)

These two components will be used to compute linear combination of the input pixels involved to fill each value of the output pixels. This process is performed along each dimension separately one-at-a-time (vertically then horizontally).

Now the problem for you is that you can never obtain the median value by using a linear combination, that's because median is a non-linear ordering filter. So your only option is to write your own implementation...

这篇关于在具有不同滤波器的MATLAB中调整大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆