carlren / gSLICr

gSLICr: Real-time super-pixel segmentation
Other
336 stars 126 forks source link

Superpixel components are disconnected #11

Open ghost opened 8 years ago

ghost commented 8 years ago

The goal (at least mine) of using superpixels is to divide image into segments, in which each segment should group connected similar pixels.

In your implementation, I noticed that many disconnected segments are considered the same superpixel even though they are separated by other superpixels. Unfortunately, _cohweight and _do_enforceconnectivity did not fix that behavior. Therefore, I am reporting it as an issue!

To make things clearer, I am providing an example! In the following input image, I selected to visualize the superpixel that the red marked pixels belongs to. input

I am using the _idximg to point to the corresponding spixel(s) inside _spixelmap, mark them, then visualize pixels that belongs to the marked spixel(s), again, through _idximg.

As you can see, the output of that returned a single superpixel, but many disconnected segments. The center of that superpixel is surrounded by four red pixels as shown. output

I would appreciate it if I get a workaround as near as possible!

buzzsuresh commented 7 years ago

Hi Carl,

I'm interested and to explore more on how each segments has been clustered.

How would I get the visualize or get the data (or the image pointer) for individual segment and the centroid associated for that segment. Will I have to apply the mask for the entire image to rule out segments that are out of interest.

Appreciate if you can help me to clarify on this.

@Sahloul : Would also be interested to know how did you come to visualize or learn data of those disconnected segments. Kindly help with your suggestions.

Thanks.

ghost commented 7 years ago

@buzzsuresh Do not bother asking, it is been almost 9 months, and they do not want to even justify their failure! I coded the visualization and masking parts myself! It is not in their library..

Unfortunately, their work was not as they claim and I got deceived by its reported speed, but as you can see, I found out it does not do real segmentation... I just wasted a month of my research on it!

meder411 commented 7 years ago

@Sahloul You're likely reading the PGM file incorrectly or processing the output segmentation wrong. I've not had any problems with this. Each superpixel has it's own label.

abhiyad commented 6 years ago

@meder411 :: Please tell me how did you get the labels of each Pixel , I am Stuck .. Thanks.

meder411 commented 6 years ago

Assuming you've saved a PGM file, use OpenCV's imread() function to read the PGM and just loop over the rows and columns of the returned Mat.

whyx007 commented 4 years ago

I have the same problem, the PGM file just a label file,then I have rewrite all the label index into txt file, as same as ghost report: many disconnected segments are considered the same superpixel even though they are separated by other superpixels. https://github.com/fderue/SLIC_CUDA I decide use this to instead