Neighbouring image segments

2 visualizzazioni (ultimi 30 giorni)
randomName
randomName il 3 Feb 2011
Risposto: Greg il 28 Mar 2014
Hello!
I am using EDISON Wrapper to segment an image. It returns segment labels (and segmented image). What would be the best (the fastest) way to find neighbouring segments of each segment.
Any suggestion is more than welcome! Thank you!
  1 Commento
Ashish Uthama
Ashish Uthama il 4 Feb 2011
Maybe you could link/say more about what 'EDISON' is. If it just returns labels, then its probably not enough information. If you have access to the Image Processing toolbox, look at |regionprops|, it returns the centroid information of each segment which you could use.

Accedi per commentare.

Risposte (2)

Brett Shoelson
Brett Shoelson il 4 Feb 2011
randomName: I also have no idea what EDISON Wrapper is. BUT...given any list of linear indices, IDX, into your [M x N] image, you can quickly and easily find their neighbors using BSXFUN:
neighbors = bsxfun(@plus, idx, neighbor_offsets)
neighbor_offsets is a list of relative offsets; add M to get eastern neighbors, subtract M to get Western neighbors, add 1 to get southern neighbors, etc. Here's a list of the offsets for 8-connected neighbors:
% East M % Southeast M + 1 % South 1 % Southwest -M + 1 % West -M % Northwest -M - 1 % North -1 % Northeast M - 1
Thus, for example, to find all eastern and southern neighbors of pixels given by indices [200,400, 450], use:
neighbors = bsxfun(@plus, [200, 400, 450], [M, 1])
CAVEAT: Beware the edges! If you use those neighbor values to try to index outside of your image, you'll get an error. You will have to pad your image or pare your results to make sure you stay within the image borders. (Our image processing functions handle that for you.)
Cheers, Brett

Greg
Greg il 28 Mar 2014
Intels entry into the developer board market are the Edison and Galileo boards. https://communities.intel.com/docs/DOC-22192

Categorie

Scopri di più su Biological and Health Sciences in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by