删除K的背景掩码-意味着Python或C++中的集群/

Removing background mask for K -Means clustering/ in Python or C++

本文关键字:C++ 意味着 背景 掩码 删除 Python      更新时间:2023-10-16

我正在尝试使用K-Means聚类Python库对图像进行分类。然而,图像中包括一个黑色(蒙版(背景,我需要在聚类之前将其移除,因为它会影响输出结果。我希望使用k均值从图像输出中删除黑色背景类或聚类。我试着在网上寻找解决方案,但到目前为止,我还没有找到合适的解决方案。有人知道使用Python库或C++删除K-means集群算法中不需要的特定类/集群的任何解决方案吗。下面是我目前正在python中实现的K表示代码,并希望进行调整。

labels = _utils.clusterFeatureVectors(featureVectors, k_clusters)
_utils.printClassifiedImage(labels, k_clusters, img, outfile, greyOutput)

我错误地发现了这些代码,我认为它很有用。

root.overrideredirect(True)
root.wm_attributes("-transparentcolor", "#000000") #black color will be removed

有关更多信息,您可以查看此处:https://wiki.tcl-lang.org/page/wm+属性