Python 查找图像中一组点周围的不同边界

Python 查找图像中一组点周围的不同边界,python,image,opencv,Python,Image,Opencv,我有一张像这样的图片: 我需要在这些点周围画边界,以便将它们划分为簇。例如,图像的中心是一个区域。另一个区域可以是图像的顶部。最好使用python如何实现这一点?这里有一种在python/OpenCV中实现这一点的方法 - Read the input as unchanged, since it has transparency - Separate the base image and the alpha channel - Mask the base image with the

我有一张像这样的图片:


我需要在这些点周围画边界,以便将它们划分为簇。例如,图像的中心是一个区域。另一个区域可以是图像的顶部。最好使用python如何实现这一点?

这里有一种在python/OpenCV中实现这一点的方法

 - Read the input as unchanged, since it has transparency
 - Separate the base image and the alpha channel
 - Mask the base image with the alpha channel so as to make the white outer region with the text into all black
 - Convert that image into grayscale and then into black/white
 - Apply morphology close to connect all the dots in the regions
 - Find all contours larger than some minimum area
 - Draw the contours on the base image
 - Save the results

输入:


透明度变黑的基础图像:

形态学近景图像:

基础图像上的轮廓:


在Python/OpenCV中,有一种方法可以实现这一点

 - Read the input as unchanged, since it has transparency
 - Separate the base image and the alpha channel
 - Mask the base image with the alpha channel so as to make the white outer region with the text into all black
 - Convert that image into grayscale and then into black/white
 - Apply morphology close to connect all the dots in the regions
 - Find all contours larger than some minimum area
 - Draw the contours on the base image
 - Save the results

输入:


透明度变黑的基础图像:

形态学近景图像:

基础图像上的轮廓: