
23.04.2013, 19:42
|
Новичок
|
|
Регистрация: 25.12.2011
Сообщения: 75
Репутация: 10
|
|
Работа с изображениями в потоке
Вот код, если он как обычная процедура то работает, если как поток то не работает!!! Нужен поток не люблю когда что нибудь тормозит!!!
Код:
procedure TCapth.execute;
var
i,x,y,l,j,iz:integer;
s:integer;
stop:Boolean;
cap:String;
proz,posx,posy,all:Integer;
begin
inherited;
cap:='';
for posx := 3 to 77 do begin
for posy := 3 to 15 do begin
s:=0;
iz:=3;
repeat
iz:=iz+1;
all:=0;
s:=0;
proz:=0;
x:=TImage(Form1.FindComponent('Image'+IntToStr(iz))).Width-1;
y:=TImage(Form1.FindComponent('Image'+IntToStr(iz))).Height-1;
for l := 0 to x do begin
for j := 0 to y do begin
if (TImage(Form1.FindComponent('Image'+IntToStr(iz))).Canvas.Pixels[l,j]<>RGB(255,255,255)) then begin
all:=all+1;
end;
end;
end;
for l := 0 to x do begin
for j := 0 to y do begin
if (TImage(Form1.FindComponent('Image'+IntToStr(iz))).Canvas.Pixels[l,j]=Form1.image2.Canvas.Pixels[l+posx,j+posy])
and (TImage(Form1.FindComponent('Image'+IntToStr(iz))).Canvas.Pixels[l,j]<>RGB(255,255,255)) then
begin
s:=s+1;
end;
end;
end;
proz:=round(s/all*100);
if proz>60 then begin
case iz of
3..7:cap:=cap+'0';
8..12:cap:=cap+'1';
13..17:cap:=cap+'2';
18..22:cap:=cap+'3';
23..27:cap:=cap+'4';
28..32:cap:=cap+'5';
33..37:cap:=cap+'6';
38..42:cap:=cap+'7';
43..47:cap:=cap+'8';
48..52:cap:=cap+'9';
end;
end;
until iz=52;
end;
end;
Form1.sEdit2.Text:=cap;
end;
Последний раз редактировалось ProDaNTe, 24.04.2013 в 07:41.
|