图像插值
您好,在我的项目中,我想在这些图像中提供一些静止图像,我应该将洗牌图像作为输入,但输出将像连续图像一样,它可以通过使用插值方法比较最近的邻居,我如何实现该功能,请告诉我.我有一些代码告诉我它是如何工作的。
public InterpolationMethod method = InterpolationMethod.Bilinear;
public int newWidth = 0;
public int newHeight = 0;
try {
this.newWidth = Math.Max(1, Math.Min(5000, int.Parse(widthBox.Text)));
this.newHeight = Math.Max(1, Math.Min(5000, int.Parse(heightBox.Text)));
this.method = (methodCombo.SelectedIndex == 0)
? InterpolationMethod.NearestNeighbor
: (methodCombo.SelectedIndex == 1)
? InterpolationMethod.Bilinear
: InterpolationMethod.Bicubic;
this.DialogResult = DialogResult.OK;
this.Close();
}
catch (Exception)
{
MessageBox.Show(this, "Incorrect values are entered", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
hi in my project i want to give some number of still images in those images i should take shuffling images as input but the out put will cme like sequential images it can compare the nearest neighbor by using interpolation methods how can i implement that plz tell me .i have some code tell me how it wrks.
public InterpolationMethod method = InterpolationMethod.Bilinear;
public int newWidth = 0;
public int newHeight = 0;
try {
this.newWidth = Math.Max(1, Math.Min(5000, int.Parse(widthBox.Text)));
this.newHeight = Math.Max(1, Math.Min(5000, int.Parse(heightBox.Text)));
this.method = (methodCombo.SelectedIndex == 0)
? InterpolationMethod.NearestNeighbor
: (methodCombo.SelectedIndex == 1)
? InterpolationMethod.Bilinear
: InterpolationMethod.Bicubic;
this.DialogResult = DialogResult.OK;
this.Close();
}
catch (Exception)
{
MessageBox.Show(this, "Incorrect values are entered", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从最近邻插值开始——这是最简单的。基本上,该方法的工作原理如下:
(row, col)
,计算出旧图像中相应的位置(row_o, col_o)
。例如,如果旧图像大小为一半,则row_o = row/2
和col_o = col/2
。请注意,由于所有像素位置都是整数,因此会涉及一些舍入。对于最近邻插值来说,这是一种不可避免的罪恶,你无法避免它。(row_o, col_o)
位置的像素值row, col)的新图像
一旦你从这样,其他方法应该更有意义。
扫描线遍历:
它看起来像什么:
Start with nearest neighbor interpolation -- it's the simplest. Basically, the approach works like this:
(row, col)
, work out the corresponding position(row_o, col_o)
in the old image. For example, if the old image is half the size, thenrow_o = row/2
andcol_o = col/2
. Note that since all the pixel positions are integers, there will be some rounding involved. With nearest neighbor interpolation, it's a necessary evil and you can't avoid it.(row_o, col_o)
in the old imagerow, col)
Once you get that out of the way, the other approaches should make more sense.
Scanline traversal:
What it looks like: