//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::openPicClick(TObject *Sender)
{
if (OpenPictureDialog1->Execute())
{
Image1->AutoSize=true;
Image1->Picture->LoadFromFile(OpenPictureDialog1->FileName);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Image1MouseMove(TObject *Sender, TShiftState Shift,
int X, int Y)
{
TColor a = Image1->Canvas->Pixels[X][Y];
unsigned char R,G,B;
int y,u,v;
//unsigned char b;
R = char(a);
Label7->Caption = int(R);
a >>= 8;
G = char(a);
Label8->Caption = int(G);
a >>= 8;
B = char(a);
Label9->Caption = int(B);
y=0.299*R + 0.587*G + 0.114*B;
u=(R-y)*0.713 + 128;
v=(B-y)*0.564 + 128;
Label10->Caption = int(y);
Label11->Caption = int(u);
Label12->Caption = int(v);
Label14->Caption = X;
Label16->Caption = Y;
}
//---------------------------------------------------------------------------