Reputation: 131
Looking for a method to determine adjacent superpixels, I found this interesting solution. However, as I know, there is need to consider adjacency between superpixels which are located in the left and right boundaries. Also the adjacency for superpixels in top and bottom boundaries should be taken into account.
For example, in the above figure the red-filled superpixels should be considered as neighbor ones.
Any idea for that?
Upvotes: 3
Views: 239
Reputation: 60680
The simplest way to extend the given answer to a toroidal boundary condition (periodicity along the vertical axis and along the horizontal axis corresponds to mapping the image onto the surface of a torus) is to add the first row of the image as a new, last row, and similarly for the columns. That is, we explicitly make the labels in the first column to be neighbors to the labels in the last column.
This one-liner accomplishes the required replication:
L = L([1:end,1],[1:end,1]);
Insert this line after creating L
through the call to superpixels
, and before calling graycomatrix
.
Upvotes: 2