Code covered by the BSD License  

Highlights from
Region Adjacency Graph (RAG)

4.5

4.5 | 4 ratings Rate this file 26 Downloads (last 30 days) File Size: 2.81 KB File ID: #16938
image thumbnail

Region Adjacency Graph (RAG)

by David Legland

 

17 Oct 2007 (Updated 29 Jul 2010)

Computes the graph of adjacent regions in a labeled image

| Watch this File

File Information
Description

Computes region adjacency graph of a labeled 2D or 3D image.

Two regions are considered as neighbor if they are separated by a background (i. e. with color 0) pixel in the horizontal or vertical direction, as well as depth direction for 3D images.

The result is a N*2 array, containing 2 indices for each couple of neighbor regions.

usage:
ADJ = imRAG(IMG);
ADJ has the format [LBL1 LBL2], LBL1 and LBL2 being vertical arrays the same size.
 
LBL1 is given in ascending order, LBL2 is given in ascending order for each LBL1. Ex :
    [1 2]
    [1 3]
    [1 4]
    [2 3]
    [2 5]
    [3 4]
 
Alternative syntax:
[NODES, ADJ] = imRAG(IMG);
Return two arrays: the first one is a [N*2] array containing centroids of the N labeled region, and ADJ is the adjacency previously described.

For 3D images, the node array is [N*3].

MATLAB release MATLAB 7.5 (R2007b)
Other requirements image processing toolbox is not required to run the function, but is required to run the example code.
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
14 Mar 2008 Perrine Paul

Very efficient. Some example of use would be of interest, for accessing data.

31 May 2010 Joao Henriques  
20 Apr 2011 Ryan

Very useful.

21 May 2012 Chen  
Please login to add a comment or rating.
Updates
29 Jul 2010

removed dependencies to image processing toolbox, updated doc

Tag Activity for this File
Tag Applied By Date/Time
image analysis David Legland 22 Oct 2008 09:31:56
rag David Legland 22 Oct 2008 09:31:56
image David Legland 22 Oct 2008 09:31:56
adjacency David Legland 22 Oct 2008 09:31:56
watershed David Legland 06 Feb 2009 07:34:22
rag Marcelo 11 Feb 2010 12:35:28
graph David Legland 29 Jul 2010 11:39:02
watershed amjad khan 08 May 2012 09:15:57

Contact us at files@mathworks.com