seg = GaborTextureSegment(I, K, gamma, Lambda, b, Theta, phi, shape);
%imseg = uint8(seg) * floor(255 / K); % cluster id to gray scale (max 255)
[nRow, nCol] = size(seg);
color = [0 0 0; 255 255 255; 255 0 0; 0 255 0; 0 0 255]; % 5 colors reserved
imseg = zeros(nRow*nCol, 3);
for i=1:K
idx = find(seg == i);
imseg(idx, :) = repmat(color(i, :), [], length(idx));
%repma复制个数组
错误使用 repmat
复制因子必须为整数行矢量或整数标量。
出错 demo_GaborTextureSegment (line 22)
imseg(idx, :) = repmat(round(color(i, :)), round([]), round(length(idx)));