void __fastcall TForm1::Button13Click(TObject *Sender)
{
Graphics::TBitmap *Bmp = new Graphics::TBitmap();
Byte *ptr;
int r,g,b;
int i,j,XX,YY;
int sum=0,X=0,Y=0;
Bmp->Assign(Image1->Picture->Bitmap);
Bmp->PixelFormat=pf24bit;
for (int i=0;iHeight;i++ )
{
ptr=(Byte*)Bmp->ScanLine;
for (int j=0;jWidth; j++ )
{
b=ptr[j*3];
g=ptr[j*3+1];
r=ptr[j*3+2];