opencv中的图像缩放/清晰度
当我在任何图像编辑软件中打开黑色背景上带有一些灰色文本的图像并放大时,我会得到“像素完美”的字母放大。
我怎样才能用opencv得到同样的结果?
我尝试使用 cv::resize 来完成此操作,但这会产生非常模糊/不清晰的结果。
顺便说一句,我可能在这里错了,但在我看来,所有图像在 opencv 中都会变得有点模糊/不清晰?
提前致谢!
When i open a image with some gray text on a black background in any image editing software and i zoom in i get "pixel perfect" zoomed in letters.
how can i get the same with opencv??
i tried doing it with cv::resize but that gives very blurry/unsharp results.
on a side note and im probably wrong here but it seems to me that all images tend to get a little blurry/unsharp with opencv?
thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从文档您可以看到,有几种不同的可用于
cv::resize()
的插值方法:默认情况下使用的双线性插值方法尝试通过“计算”中间像素值来平滑结果图像。根据您的要求,请使用最近邻方法 (INTER_NEAREST)。它只是选择最接近新像素位置的像素值。
有关常见插值方法的简短概述,请查看 wikipedia。
From the docs you can see, that there are several different interpolation methods available for
cv::resize()
:The bilinear interpolation method that is used by default, tries to smooth the resuling image by "calculating" intermediate pixel values. For your requirements use the nearest-neighbor method (INTER_NEAREST). It simply picks the pixel value closest to the new pixels position.
For a short overview of common interpolation methods take a look at wikipedia.