Why does painted_img always remain zero in my Python code?

30 Views Asked by At

I'm encountering an issue with the following code snippet in Python. Despite my efforts, the variable painted_img always remains filled with zeros (0), it is for sure that sp_intensity[seg] is not filled with zeros (0).

self.painted_imgs = []
self.labels = labels
for idx, (sp_intensity, _, sp_order, superpixels) in enumerate(sp_data):
    painted_img = np.zeros_like(images[idx])
    for seg in sp_order:
        mask = (superpixels == seg)
        painted_img[mask] = sp_intensity[seg]
    self.painted_imgs.append(painted_img)

And the detail of shape information is below: enter image description here

0

There are 0 best solutions below