unit UnitUtama; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtDlgs, Menus,
StdCtrls, ComCtrls, Clipbrd, ExtCtrls, TeeProcs, TeEngine, Chart, Series, CPort; type TFormUtama = class(TForm) PanelAtas: TPanel; ButtonAmbilCitra: TButton; StatusBar: TStatusBar; OpenPictureDialog: TOpenPictureDialog; ButtonSegmentasi: TButton; ButtonDeteksiTepi: TButton; ButtonHitam: TButton; ButtonPutih: TButton; ButtonReset: TButton; ButtonSave: TButton; ButtonClose: TButton; Shape1: TShape; Shape2: TShape; Memo1: TMemo; SaveDialog1: TSaveDialog; SavePictureDialog1: TSavePictureDialog; ComPort1: TComPort; Edit1: TEdit;
Button1: TButton; Edit2: TEdit; Button2: TButton; ButtonPrint: TButton; Label1: TLabel; Label3: TLabel; Label2: TLabel; Label4: TLabel; procedure ButtonAmbilCitraClick(Sender: TObject); procedure Segmentasi; procedure DeteksiTepi; procedure ButtonSegmentasiClick(Sender: TObject); procedure ButtonDeteksiTepiClick(Sender: TObject); procedure ButtonCloseClick(Sender: TObject); procedure ButtonSaveClick(Sender: TObject); procedure ButtonHitamClick(Sender: TObject); procedure ButtonPutihClick(Sender: TObject); procedure ComPort1RxChar(Sender: TObject; Count: Integer); procedure FormCreate(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Edit1Change(Sender: TObject); procedure Button2Click(Sender: TObject); procedure ButtonPrintClick(Sender: TObject); private { Private declarations } public
{ Public declarations } end; var FormUtama: TFormUtama; implementation uses UnitCitra; var FormHasil: TFormCitra; xx, yy, C , R, G, B, ii, jj, brs, klm : Integer; terimaserial: string; urutan : integer; {$R *.dfm} procedure [Link](Sender: TObject); var fc: string; begin if ([Link]) then begin if (FormCitra = nil) then [Link](TFormCitra, FormCitra); [Link]( [Link]);
pf1bit : fc := 'biner'; pf8bit : fc := 'keabuan'; pf24bit : fc := 'true color'; end; [Link] := [Link] + ' (' + IntToStr([Link]) + 'x' + IntToStr([Link]) + ', ' + fc + ')'; if (FormHasil = nil) then [Link](TFormCitra, FormHasil); [Link] := 'Citra Hasil'; [Link] := [Link]; [Link] := [Link]; [Link] := [Link]; [Link] := [Link]; [Link] := [Link]; [Link] := [Link]; end; end; procedure [Link]; begin for xx:=1 to [Link] do
[Link] :=[Link]; for yy:=1 to [Link] do [Link] :=[Link]; [Link] := [Link]; case ([Link]) of begin C:=[Link][xx,yy]; R:= C mod $100; G:= (C div $100)mod $100;
B:= C div $10000; R:= ((r*4) div 256) *(255 div (3)); G:= ((g*4) div 256) *(255 div (3)); B:= ((b*4) div 256) *(255 div (3));
begin if (FormCitra = nil) then begin ShowMessage('Ambil dulu citra yang akan diolah');
[Link][xx,yy]:=B*$1 exit; 0000+G*$100+R; end;
[Link][xx,yy]:=B*$1 Segmentasi; 0000+G*$100+R; end; end; procedure [Link]; Begin for xx:=0 to [Link] do for yy:=0 to [Link] do begin C:= [Link][xx,yy]; end; procedure [Link](Sender: TObject); begin if (FormCitra = nil) then begin ShowMessage('Ambil dulu citra yang akan diolah'); exit; end;
[Link][xx,yy]:=clWh Segmentasi; ite; for ii:=-1 to +1 do for jj:=-1 to +1 do if C<>[Link] [xx+ii,yy+jj] then [Link]. Pixels [xx,yy]:=clBlack; end; end; procedure [Link](Sender: TObject); DeteksiTepi; end; procedure [Link](Sender: TObject); begin if (FormCitra = nil) then begin ShowMessage('Ambil dulu citra yang akan diolah'); exit; end;
for brs:=0 to [Link] do for klm:=0 to [Link] do begin if
end; end; procedure [Link](Sender: TObject); begin
[Link][brs,klm]=Sha if (FormCitra = nil) then [Link] then begin ShowMessage('Ambil dulu citra yang akan diolah');
[Link][brs,klm]:=clB exit; lack; end; end; end; if [Link] then [Link]([Link]
procedure [Link](Sender: TObject); Name); begin if (FormCitra = nil) then begin ShowMessage('Ambil dulu citra yang akan diolah'); exit; end; for brs:=0 to [Link] do for klm:=0 to [Link] do begin if end; procedure [Link](Sender: TObject); begin Close; end; procedure TFormUtama.ComPort1RxChar(Sender: TObject; Count: Integer); Var dataterima: String; begin [Link](dataterima,count);
[Link][brs,klm]=Sha terimaserial := terimaserial+dataterima; [Link] then if pos(#13+#10,terimaserial)> 0 then begin
[Link][brs,klm]:=cl [Link]:= terimaserial; White; terimaserial := '';
end; end; procedure [Link](Sender: TObject); begin terimaserial :=''; end; procedure TFormUtama.Button1Click(Sender: TObject); begin [Link]([Link][0]+'00'+ #13); urutan := 0; [Link]:= Timetostr(now); end; procedure TFormUtama.Edit1Change(Sender: TObject); begin if pos('-OK', [Link]) > 0 then begin urutan := urutan+1; [Link]([Link][urutan]+'00'+ #13); [Link]:=timetostr(now); end; end; procedure TFormUtama.Button2Click(Sender: TObject); begin [Link]([Link] + #13); end; procedure [Link](Sender: TObject);
var xx,yy,warnaawal,putih,hitam: integer; ADAHITAM:BOOLEAN; begin [Link]:=''; YY:=0; REPEAT hitam:=0; putih:=0; warnaawal:=[Link][ 00,yy]; ADAHITAM:=FALSE; for xx:=0 to [Link]-1 do begin if [Link][xx,yy]=clblac k then ADAHITAM:=TRUE; END; IF ADAHITAM THEN BEGIN hitam:=0; putih:=0; warnaawal:=[Link][ 00,yy]; for xx:=0 to [Link]-1 do begin
if
[Link]('E10') ;
[Link][xx,yy]=clblac end k then begin if warnaawal<>clBlack then [Link]('A'+inttostr(putih)); putih:=0; hitam:=hitam+1; warnaawal:=clBlack; end else begin if warnaawal<>clwhite then begin [Link]('F10') ; [Link]('A'+inttostr(hitam)) ; [Link]('E10') ; end; hitam:=0; putih:=putih+1; warnaawal:=clwhite; end; end; if warnaawal<>clwhite then begin [Link]('F10') ; [Link]('A'+inttostr(hitam)) ; else [Link]('A'+inttostr(putih)); [Link]('C1'); END ELSE BEGIN [Link]('C1'); END; YY:=YY+1; UNTIL YY=[Link]-1 end; end.