//直方圖
Image3->Canvas->Brush->Color = clWhite;
Image3->Canvas->FillRect(TRect(0,0,Image2->Picture->Bitmap->Width, Image2->Picture->Bitmap->Height));
int px1 = Image2->Picture->Bitmap->Height;
int px2 = Image2->Picture->Bitmap->Width;
long GrayCount[256] = {0}, MaxGrayCount = 0;
for(row = 0; row)
{
ptr = (Byte*) Image2->Picture->Bitmap->ScanLine[row];
for(col = 0; col)
{
GrayCount[ptr[col]]++;
if(GrayCount[ptr[col]] > MaxGrayCount)
{
MaxGrayCount = GrayCount[ptr[col]];
}
}
}
for(index = 0; index < 256; index++)
{
Image3->Canvas->MoveTo(index,Image3->Height);
Image3->Canvas->LineTo(index,Image3->Height * (1.0 - (double)GrayCount[index] / (double)MaxGrayCount));
}
BCB6 直方圖
訂閱:
文章 (Atom)