I have areas of an image that contains polygons of know coordinates that I'm trying to get an average RGB from.
What is the best way to define the nodes of the polygon, select that polygon, then get the average RGB of the pixels from only within the polygon.
There is an example of CalcAverageRGB in a Demo, but it appears to only work from an interactive selection.
Here is what I have tried...
Image1.BeginSelect;
for x := 0 to Length(Mask.Polygon[0])-1 do
Image1.AddSelPoint(Mask.Polygon[0][x].X, Mask.Polygon[0][x].Y);
Image1.EndSelect;
Image1.Update;
RGB := Image1.Proc.CalcAverageRGB(0);
ListBox1.Items.Add('Avg RGB : '+CxIn(RGB.r,4)+CxIn(RGB.g,4)+CxIn(RGB.b,4));
But it appears to still give the average of the entire image, not just within the polygon.
Also, is there anything like GetDominantColor that can be used within a selection?
Thanks
HM Arnold