我正在做一个用热感应器追踪物体的项目。传感器的输出将是温度读数,我将其转换成黑白图像,其中白色像素描绘物体。但是由于一些噪声,所获得的形状是不规则的,我想将图像重塑为圆形,如图2所示。是否有任何方法可以使用python将图1的白色像素转换成特定的形状(最好是圆圈)。任何帮助都是非常感谢的。
我所拥有的:

我想要的:

发布于 2022-09-29 11:47:32
如果您不需要它是一个椭圆,您可以使用您的形状的凸壳,如下所示:

使用scikit图像可以很容易地做到这一点:
from skimage.morphology import convex_hull_image
from skimage import data, img_as_float
from skimage.util import invert
# The original image is inverted as the object must be white.
image = invert(data.horse())
chull = convex_hull_image(image)https://stackoverflow.com/questions/73893444
复制相似问题