about summary refs log tree commit diff
path: root/sourcecodes/bnt-master/KPMtools/rgb2grayKPM.m
blob: e15434f00489413bc749a3fb339a4226b7b3c550 (plain)
1
2
3
4
5
6
7
8
9
10
11
function g = rgb2grayKPM(rgb)
% function g = rgb2grayKPM(rgb)
% rgb2grayKPM Like the built-in function, but if r is already gray, does not cause an error

[nr nc ncolors] = size(rgb);
if ncolors > 1
  g = rgb2gray(rgb);
else
  g = rgb;
end