Ed,
You do not need to loop:
>> a = magic(5)
a =
17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 19 21 3
11 18 25 2 9
>> vi = (a > 5) & (a < 10)
vi =
0 0 0 1 0
0 0 1 0 0
0 1 0 0 0
0 0 0 0 0
0 0 0 0 1
You can see how this statement could be expanded for RGB and such. I would make a function
function out = isFlesh(in)
%% put flesh checking code here
I suspect you are going to want a range of these (isCaucasian, isAsian, etc...) The problem is going to be that there is a huge range of flesh colors, so you are going to want to check for proximity to neighbors of a similar color range.
This part of the problem is easy, but the larger problem is fraught with peril.
-Doug