0% found this document useful (0 votes)
19 views6 pages

Histogram Image

The document provides instructions on creating a histogram image program in Delphi. It includes providing the user interface code, testing the program by recording RGB values from images, creating a test video, and submitting the program and test video for grading as part of an exam.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views6 pages

Histogram Image

The document provides instructions on creating a histogram image program in Delphi. It includes providing the user interface code, testing the program by recording RGB values from images, creating a test video, and submitting the program and test video for grading as part of an exam.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

HISTOGRAM IMAGE

1. Buat program seperti pada user interface dan lengkapi programnya


User Interface :

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, TeEngine, Series, TeeProcs, Chart;

type
TForm1 = class(TForm)
Image1: TImage;
ScrollBar1: TScrollBar;
Chart1: TChart;
Series1: TLineSeries;
Series2: TLineSeries;
Series3: TLineSeries;
OpenDialog1: TOpenDialog;
Timer1: TTimer;
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Button3: TButton;
Button4: TButton;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure ScrollBar1Change(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
gambar2:TBitmap;
Aa : integer;
mrh,merah,merah1,hju,hijau,hijau1,br,biru,biru1 : integer;

implementation
{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);


begin
gambar2:=TBitmap.Create;
Scrollbar1.max:=Image1.Picture.Height;
end;

procedure TForm1.Timer1Timer(Sender: TObject); //program otomatis scrollbar


begin
Aa:=Aa+1;
Scrollbar1.Position := Aa;
edit1.Text := inttostr(Aa);
end;

procedure TForm1.Button1Click(Sender: TObject);


var
open : string;
begin
timer1.Enabled:=false; //program penormalan nilai
Aa:=0;
edit1.Text:=inttostr(Aa);
merah1 := 0;
edit2.Text:=inttostr(Merah);
hijau1 := 0;
edit3.Text:=inttostr(hijau);
biru1 := 0;
edit4.Text:=inttostr(biru1);
OpenDialog1.Execute; //program membuka gambar
open:=OpenDialog1.FileName;
Image1.Picture.LoadFromFile(Open);
Scrollbar1.Enabled := True;
gambar2.Assign(Image1.Picture);
Scrollbar1.Max:=Image1.Picture.Height;
end;

procedure TForm1.Button2Click(Sender: TObject);


begin
Timer1.Enabled:= True;
end;

procedure TForm1.ScrollBar1Change(Sender: TObject);


var
red,green,blue:byte;
i,j,lebar:integer;
warna:TColor;
garis:TBitmap;

begin
Series1.Clear;
Series2.Clear;
Series3.Clear;
j:=Scrollbar1.Position;
lebar:=image1.Picture.Bitmap.Width;
garis:=TBitmap.Create;
garis.Assign(gambar2);
garis.Canvas.MoveTo(0,j);
garis.Canvas.LineTo(lebar,j);

for i:=0 to lebar -1 do


begin
warna:=Image1.Picture.Bitmap.Canvas.Pixels[i,j];
red:=GetRValue(warna);
green:=GetGValue(warna);
blue:=GetBValue(warna);
Series1.AddXY(i,red);
Series2.AddXY(i,green);
Series3.AddXY(i,blue);
if (red = 255) or (red = 254) or (red = 253) or (red = 252) or (red = 251) or (red = 250) then
begin
mrh:=0;
merah1 := merah1+mrh;
edit2.Text:=inttostr(merah1);
end
else
begin
mrh:=red;
merah1 := merah1+mrh;
edit2.Text:=inttostr(merah1);
end;

if (green = 255) or (green = 254) or (green = 253) or (green = 252) or (green = 251) or (green
= 250) then
begin
hju:=0;
hijau1 := hijau1+hju;
edit3.Text:=inttostr(hijau1);
end
else
begin
hju:=green;
hijau1 := hijau1+hju;
edit3.Text:=inttostr(hijau1);
end;

if (blue = 255) or (blue = 254) or (blue = 253) or (blue = 252) or (blue = 251) or (blue = 250)
then
begin
br:=0;
biru1 := biru1+br;
edit4.Text:=inttostr(biru1);
end
else
begin
br:=blue;
biru1 := biru1+br;
edit4.Text:=inttostr(biru1);
end;
end;
image1.Picture.Assign(garis);
garis.Free;
end;

procedure TForm1.Button3Click(Sender: TObject);


begin
Application.Terminate;
end;

procedure TForm1.Button4Click(Sender: TObject);


begin
Timer1.Enabled:= False;
end;

end.

2. Uji program, catat nilai histogram masing nilai RGB setiap image yang anda uji
3. Buat video uji.
4. Kumpulkan program dan video uji yang dibuat pada account masing-masing pada
classroom.google.com.
5. Jangan sampai tidak membuat tugas ini, karena ini adalah UTS, karena nilai kuliah
otomatis dari tugas.
6. Laporan pada buku besar dikumpulkan saat kuliah tatap muka dilakukan
7. Selamat bekerja

You might also like