Home > Back-end >  C Builder area selection problem. The great god help me... Thank you very much
C Builder area selection problem. The great god help me... Thank you very much

Time:10-01

C + + Builder process, display a picture, and select the specified pixel area, calculating the average area image grey,

CodePudding user response:

 
Double GetGrayAverage (Bitmap BMP, int w, int h)
{
Double sum=0;
Use the average value of the//
for (int i=0; I & lt; w; I++)
For (int j=0; J & lt; H; J++)
{
Color=c BMP. GetPixel (I, j);
Sum=sum + (int) (0.299 * c.R be sad) chtistina georgina rossetti.british poetess mount + 0.114 + 0.587 * *;
}
Double aver=sum/(w * h);
Return aver.
}
  • Related