Code covered by the BSD License  

Highlights from
Tri-hedral Junctions using lookup table

image thumbnail
from Tri-hedral Junctions using lookup table by Shripad Kondra
finds the trihedral junctions from the binary edge map

find_trihedral_junctions(edgemap)
function [junctions]= find_trihedral_junctions(edgemap)
%  [junctions]= find_trihedral_junctions(edgemap)
% finds the trihedral junctions from the edgemap
% 
% EDGEMAP is a binary image containing edge information
% JUNCTIONS returns junctions
% 
% See the configurations in 'trihedral_juctions.xls'
%
% Test the function with this simple Example :
%
% edgemap = eye(50,50);
% edgemap(12,:)=1; edgemap(37,:)=1;
% edgemap(:,12)=1; edgemap(:,37)=1; 
% edgemap(:,25)=1;
% edgemap(:,45)=1; edgemap(:,47)=1; 
% edgemap(12,46)=0; 
%
% [junctions]= find_trihedral_junctions(edgemap);
%  
% figure;
% subplot(1,2,1)
% imagesc(edgemap); colormap gray; axis equal; axis tight;
% subplot(1,2,2)
% imagesc(junctions+edgemap); colormap gray; axis equal; axis tight;
% 
%
% Shripad Kondra, SISSA, Trieste, Italy, 23-Feb-2007
% 

% Initialize the LUT
LUT = zeros(512,1);

%% Set the desired trihedral configurations (See 'trihedral_juctions.xls')

LUT(59)=1;
LUT(179)=1;
LUT(185)=1;
LUT(155)=1;
LUT(467)=1;
LUT(122)=1;
LUT(152)=1;
LUT(317)=1;
LUT(339)=1;
LUT(285)=1;
LUT(114)=1;
LUT(150)=1;
LUT(157)=1;
LUT(283)=1;
LUT(178)=1;
LUT(115)=1;
LUT(86)=1;
LUT(278)=1;
LUT(341)=1;
LUT(338)=1;
LUT(310)=1;
LUT(373)=1;
LUT(466)=1;
LUT(88)=1;
LUT(342)=1;
LUT(187)=1;

%%
% check if the edge map is thined.
edgemap=bwmorph(edgemap,'thin',inf);
% finaly apply the LUT and shrink multiple detections
junctions = applylut(edgemap,LUT);
% bridge if there is a bridge in original edgemap
bridged_junctions = junctions | (bwmorph(junctions,'bridge') & edgemap);
% eliminate multiple detections
junctions = bwmorph(bridged_junctions,'shrink',inf);

return;

Contact us at files@mathworks.com