Image boundary based on superpixels

412 views Asked by At

Superpixels that located in the image boundary can be specified manually using appropriate index (such as the following example for the second superpixel, L==2):

Segmented Image

Selected superpixel

In some cases it is needed to specify all of those superpixels located in the image boundary in an systematic and non-manual way, something similar to the image below:

superpixel image without edge superpixels

Is there any standard method to do that?

1

There are 1 answers

0
Cris Luengo On BEST ANSWER

Given the labeled image L,

lr = L([1,end],:);

are all pixels along the left and right edges, and

tb = L(:,[1,end]);

are all pixels along the top and bottom edges. We can find all labels that touch the image edge by taking the unique values in those to sets:

labels = unique([lr(:);tb(:));