Hello,
this code loads a jpeg, select a region (50, 90, 300, 400) and count (and mark) all pixels in the Hue range 22:33, that should be orange-like.
You can remove Selection part to allow user to select using the mouse and the LoadFromFile to process a previously loaded image.
Yellow could be a combination of Hue, Saturation and Luminosity (Val).
Hope this helps.
var
i, j: integer;
Hue, Sat, Val: integer;
orangePixels: integer;
begin
ImageEnView1.IO.LoadFromFile('input.jpg');
ImageEnView1.Select(50, 90, 300, 400); // user can also select using mouse instead of this
orangePixels := 0;
ImageEnView1.SelectionBase := iesbBitmap;
for i:=ImageEnView1.SelY1 to ImageEnView1.SelY2 do
for j:=ImageEnView1.SelX1 to ImageEnView1.SelX2 do
if ImageEnView1.IsPointInsideSelection(j, i) then
begin
RGB2HSV(ImageEnView1.IEBitmap.Pixels_ie24RGB[j, i], Hue, Sat, Val);
if (Hue >= 22) and (Hue <= 33) then
begin
inc(orangePixels);
ImageEnView1.IEBitmap.Pixels_ie24RGB[j, i] := CreateRGB(255, 0, 0); // optional: just to mark orange pixels
end;
end;
ShowMessage(Format('Counted %d orange pixels', [orangePixels]));
ImageEnView1.Update();
end;