1 function [SegLabel,NcutDiscrete,NcutEigenvectors,NcutEigenvalues,W,imageEdges]= NcutImage(I,nbSegments);
2 % [SegLabel,NcutDiscrete,NcutEigenvectors,NcutEigenvalues,W,imageEdges]= NcutImage(I);
3 % Input: I = brightness image
4 % nbSegments = number of segmentation desired
5 % Output: SegLable = label map of the segmented image
6 % NcutDiscrete = Discretized Ncut vectors
8 % Timothee Cour, Stella Yu, Jianbo Shi, 2004.
16 [W,imageEdges] = ICgraph(I);
18 [NcutDiscrete,NcutEigenvectors,NcutEigenvalues] = ncutW(W,nbSegments);
20 %% generate segmentation label map
23 SegLabel = zeros(nr,nc);
24 for j=1:size(NcutDiscrete,2),
25 SegLabel = SegLabel + j*reshape(NcutDiscrete(:,j),nr,nc);