我已经成功地识别出图像中的特定对象,现在我想进行标记,然后将这些对象转移到新图像中以进行进一步处理。但是,我对如何实现这一点有些困惑。这是我使用的脚本。
coordinates = peak_local_max(rack_matches, min_distance=100)
coordinates = coordinates[np.argsort(rack_matches[coordinates[:,0],coordinates[:,1]])[-8:],:]
L = skime.label(imbw_open)
R = skime.regionprops(L)
rack_regions = []
for r in range(len(R)):
for c in range(8):
if np.all(coordinates[c,:]) in R[r]['Coordinates']:
print(coordinates[c,:])
rack_regions.append(region)
racks_img = np.zeros(shape(L))
for region in rack_regions:
racks_img[region['Coordinates'][:,0],region['Coordinates'][:,1]] = 1
coords_img = np.zeros(shape(L))
coords_img[coordinates[:,0], coordinates[:,1]] = 1
coords_img = skimo.binary_dilation(coords_img, skimo.disk(3))