Neighbouring image segments

3 次查看(过去 30 天)
randomName
randomName 2011-2-3
回答: Greg 2014-3-28
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 个评论
Ashish Uthama
Ashish Uthama 2011-2-4
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.

请先登录,再进行评论。

回答(2 个)

Brett Shoelson
Brett Shoelson 2011-2-4
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 2014-3-28
Intels entry into the developer board market are the Edison and Galileo boards. https://communities.intel.com/docs/DOC-22192

类别

Help CenterFile Exchange 中查找有关 Biological and Health Sciences 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by