//--------------------------------------------------------------------------- #include #pragma hdrstop #include "main.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender) { if (OpenPictureDialog1->Execute()) { I = new imagepro(); I->LoadBMPImage(Image1, OpenPictureDialog1->FileName); } } //--------------------------------------------------------------------------- void __fastcall TForm1::Button2Click(TObject *Sender) { I->SobelOperator(Image1); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button3Click(TObject *Sender) { I->BlurImage(Image1); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button6Click(TObject *Sender) { I->CopyPtrToImage(I->img, Image1); Image1->Refresh(); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button4Click(TObject *Sender) { I->CopyPtrToImage(I->B, Image1); Image1->Refresh(); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button5Click(TObject *Sender) { I->CopyPtrToImage(I->dS, Image1); Image1->Refresh(); } //--------------------------------------------------------------------------- void __fastcall TForm1::Image1MouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { if (CheckBox1->Checked) { Label1->Caption = "Value = " + (AnsiString)(I->ReturnIntensity(X,Y)); Label10->Caption = "X = " + (AnsiString)X + " Y = " + (AnsiString)Y; } } //--------------------------------------------------------------------------- void __fastcall TForm1::Image1MouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { I->DrawX(X,Y,3,Image1); if (I->nOfPts == 0) I->FirstPointToList(X,Y,ListBox1); else I->AddPointToList(X,Y,ListBox1); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button7Click(TObject *Sender) { I->Algorithm(Image1, Edit1->Text.ToDouble(), Edit2->Text.ToDouble(), Edit3->Text.ToDouble(), Edit4->Text.ToInt(), Edit5->Text.ToInt()); Label2->Caption = "Number of Iterations = " + (AnsiString)I->nOfIterations; for (int i = 0; i < I->nOfPts; i++) ListBox2->Items->Add("x = "+(AnsiString)I->xL[i]+" y = "+(AnsiString)I->yL[i]); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button8Click(TObject *Sender) { I->RemoveLastPixelFromList(ListBox1, Image1); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button10Click(TObject *Sender) { I->DisplaySnakeResult(Image1, I->img, 1); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button12Click(TObject *Sender) { I->DisplaySnakeResult(Image1, I->img, 2); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button9Click(TObject *Sender) { I->DisplaySnakeResult(Image1, I->wrk, 1); } //--------------------------------------------------------------------------- void __fastcall TForm1::Button11Click(TObject *Sender) { I->DisplaySnakeResult(Image1, I->wrk, 2); } //---------------------------------------------------------------------------