dtr43
dtr43

Reputation: 155

Image boundary based on superpixels

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?

Upvotes: 0

Views: 425

Answers (1)

Cris Luengo
Cris Luengo

Reputation: 60680

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(:));

Upvotes: 5

Related Questions