图像信息的参数为指针,怎样对其进行图像处理,比如二值化处理等,
解决方案 »
- 在DELPHI中怎样动态创建一下带按钮的窗体
- 在XP SP2系统下,安装的软件为何出现错误报告?
- 几个delphi中的小问题,希望大家帮忙!
- 向各位高手讨教,怎样使用QUICKREPORT报表打印DBGRIL中指定的一条记录??
- InsertObject(Index, S, nil)用法?
- 急到非常!关于MDI子窗体下调用DLL的问题,来者有分
- lable构件上的字排列问题
- 組件問題
- 关于CopyFile?
- 编写ISAPI中所遇的问题。数据库链接的。以及Request的使用。新手只有22分,可希望您能帮帮我。
- 转帖:DELPHI用const来提高应用程序在多核多线程下的性能
- DBGridEh的字段如何实现日期格式的输入?
begin
p := Image.buf.ScanLine[y];
for x := 0 to Image.Width - 1 do
begin //首先将图像灰度化
Gray := Round(p[x * 3 + 2] * 0.3 + p[x * 3 + 1] * 0.59 + p[x
* 3] * 0.11);
if Gray >170 then //按阀值进行二值化
begin
p[x * 3] := 255;
p[x * 3 + 1] := 255;
p[x * 3 + 2] := 255;
end
else
begin
p[x * 3] := 0;
p[x * 3 + 1] := 0;
p[x * 3 + 2] := 0;
end;
end;
end;
end;
var
x,i,j:integer;
Gray:int64;
h,w:integer;
tc:tcolor;
begin
h:=ImgSource.Height;
w:=ImgSource.Width; x:=0;
for i:=0 to h do
begin
for j:=0 to w-1 do
begin
tc := imgsource.Picture.Bitmap.Canvas.Pixels[j,i];
gray:=round((getRvalue(tc)*0.3)+(getGvalue(tc)*0.59)+(getBvalue(tc)*0.11));
if Gray >170 then
begin
imgsource.Picture.Bitmap.Canvas.Pixels[j,i]:=TColor($FFFFFF);
end
else
begin
imgsource.Picture.Bitmap.Canvas.Pixels[j,i]:=TColor($000000);
end;
x:=x+3;
end;
end;
var
i,j:integer;
Gray:int64;
h,w:integer;
p:pByteArray;
begin
h:=imgsource.Height;
w:=imgsource.Width; for i:=0 to h-1 do
begin
p:=imgsource.Picture.Bitmap.ScanLine[i];
for j:=0 to w-1 do
begin
gray:=Round((p[j*3+2]*0.3)+(p[j*3+1]*0.59)+(p[j*3]*0.11));
if Gray >170 then
begin
p[j*3] :=255;
p[j*3+1]:=255;
p[j*3+2]:=255;
end
else
begin
p[j*3] :=0;
p[j*3+1]:=0;
p[j*3+2]:=0;
end;
end;
end;
self.ImgSource.Refresh;