如何提取每个超级像素的内容并调整它们的大小?

2024-10-03 23:27:09 发布

您现在位置:Python中文网/ 问答频道 /正文

SuperPixeled image

这是图像,我只想保存非黑色区域的超级像素,然后将它们调整为56x56。我正在研究超级像素分类。在


Tags: 图像image区域分类像素黑色superpixeled
1条回答
网友
1楼 · 发布于 2024-10-03 23:27:09

您可以使用skimage.measure.regionprops。在

from skimage.segmentation import slic
from skimage.measure import regionprops

# Assume image is given
segments = slic(image, n_segments=numSegments, compactness=0.1,enforce_connectivity=True)
props = regionprops(segments,intensity_image=image)

segmentsToExclude = []
for s, segment in enumerate(segments):
    if props[s].mean_intensity < 5: # basically black
        segmentsToExclude.append(s)

沿着这些线索。有关regionprops的详细信息,请查看this skimage link。在

相关问题 更多 >