% function par = imncut; or % [X,V,S,emag,ephase,W] = imncut(I,par) % Input: % I = image % par = parameters % par.nb_r = neighbour hood radius % par.sample_rate = sampling rate % par.mask = mask for bias, label matrix of image size % par.sig_ic = sigma for computing affinity from intervening contour % par.rep = offset for repulsion % par.reg = offset for regularization % par.nv = number of eigenvectors % Output: % X = K-way partition matrix % [V,S] = eigenvector and eigenvalues from constrained ncuts % [emag,ephase] = edge detection magnitudes and phases % W = affinity matrix % figure display of K-way discrete segmentation % Reference: % www.cs.berkeley.edu/~stellayu/thesis.html % Examples: % par = imncut; % return the default parameters % imncut(I); % ncuts using the default parameters % Stella X. Yu, July 13 2003. function [X,V,S,emag,ephase,W] = imncut(I,par) if nargin==0, par.nb_r = 8; par.sample_rate = 0.15; par.mask = []; par.sig_ic = 0.15; par.rep = 0; par.reg = 0; par.nv = 3; X = par; return; end if nargin<2, par = imncut; end nb_r = par.nb_r; sample_rate = par.sample_rate; mask = par.mask; sig_ic = par.sig_ic; rep = par.rep; reg = par.reg; nv = par.nv; % sampling sz = size(I); np = prod(sz); if length(sample_rate)==1, samp = double(rand(sz)