![]() |
Microscopy Image Browser 2.91
MIB
|
IMRAG Region adjacency graph of a labeled image. More...
Functions | |
function varargout = | imRAG (img, varargin) |
IMRAG Region adjacency graph of a labeled image. | |
IMRAG Region adjacency graph of a labeled image.
function varargout = imRAG | ( | img, | |
varargin ) |
IMRAG Region adjacency graph of a labeled image.
LBL1 is given in ascending order, LBL2 is given in ascending order for
[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 nodes array is [N*3].
Example (requires image processing toolbox) % read and display an image with several objects img = imread(coins.png
); figure(1); clf; imshow(img); hold on; % compute the Skeleton by influence zones using watershed bin = imfill(img>100, holes
); dist = bwdist(bin); wat = watershed(dist, 4); % compute overlay image for display tmp = uint8(double(img).*(wat>0)); ovr = uint8(cat(3, max(img, uint8(255*(wat==0))), tmp, tmp)); imshow(ovr); % show the resulting graph [n e] = imRAG(wat); for i = 1:size(e, 1) plot(n(e(i,:), 1), n(e(i,:), 2), linewidth
, 4, color
, g
); end plot(n(:,1), n(:,2), bo
, markerfacecolor
, b
);
% Create a basic 3D image with labels, and compute RAG germs = [50 50 50;... 20 20 20;80 20 20;20 80 20;80 80 20; ... 20 20 80;80 20 80;20 80 80;80 80 80]; img = zeros([100 100 100]); for i = 1:size(germs, 1) img(germs(i,1), germs(i,2), germs(i,3)) = 1; end wat = watershed(bwdist(img), 6); [n e] = imRAG(wat); figure; drawGraph(n, e); view(3);
Author: David Legland e-mail: david.nosp@m..leg.nosp@m.land@.nosp@m.grig.nosp@m.non.i.nosp@m.nra..nosp@m.fr Created: 2004-02-20,
Copyright 2007 INRA - BIA PV Nantes - MIAJ Jouy-en-Josas.
Referenced by mibSupervoxelClassifierController.calcFeaturesBtn_Callback(), mibGraphcutController.mibGraphcut_CalcSupervoxels(), and mibGraphcutController.superpixelsBtn_Callback().