我如何填补“漏洞”在图像? [英] How do i fill "holes" in an image?
问题描述
我有星系的照片。这些图像上有一些不需要的数据(如星星或飞机条纹)被屏蔽掉了。我不仅希望用一些平均值填充蒙版区域,而是根据周围数据对它们进行插值。我怎么在python中做到这一点?
I have photo images of galaxies. There are some unwanted data on these images (like stars or aeroplane streaks) that are masked out. I don't just want to fill the masked areas with some mean value, but to interpolate them according to surrounding data. How do i do that in python?
我们在SciPy.interpolate包中尝试了各种函数:RectBivariateSpline,interp2d,splrep / splev,map_coordinates,但所有这些函数似乎都在寻找现有的像素之间像素,我们无法让它们填充数据中的任意漏洞。
We've tried various functions in SciPy.interpolate package: RectBivariateSpline, interp2d, splrep/splev, map_coordinates, but all of them seem to work in finding new pixels between existing pixels, we were unable to make them fill arbitrary "hole" in data.
推荐答案
你想要的是什么叫 修复 。
OpenCV有一个 inpaint()
你想要什么。
What you want is called Inpainting.
OpenCV has an inpaint()
function that does what you want.
这篇关于我如何填补“漏洞”在图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!