图像干扰处理1
来源:互联网 发布:蘑菇中毒知乎 编辑:程序博客网 时间:2024/04/30 07:55
图像识别是一个复杂的过程,分别要经过图像处理、图像分割、图像校正、图像识别等过程
其中第一步就是去掉干扰
以下是itpub.net中的图灵 经过处理后的样子
代码如下
procedure TForm1.BitBtn1Click(Sender: TObject);
var
Bmp: TBitmap;
Color: TColor;
x, y: Integer;
begin
Bmp := TBitmap.Create;
Bmp.Assign(Image1.Picture.Graphic);
Bmp.PixelFormat := pf4bit;
Color := BTColorIndex(Bmp, 2);
for x := 0 to Bmp.Width - 1 do for y := 0 to Bmp.Height - 1 do
begin
if Bmp.Canvas.Pixels[x, y] = Color then Bmp.Canvas.Pixels[x, y] := ClBlack else Bmp.Canvas.Pixels[x, y] := ClWhite;
end;
Image2.Picture.Bitmap := Bmp;
end;
function BTColorIndex(Bmp: TBitmap; Index: Integer = 0): Integer;
type
TColorInfo = record
Color: TColor;
Count: Integer;
end;
pColorInfo = ^TColorInfo;
function GetColorIndex(List: TList; Color: TColor): pColorInfo;
var
i: Integer;
begin
for i := 0 to List.Count - 1 do begin Result := List[i]; if Result.Color <> Color then Continue; Exit; end;
Result := nil;
end;
function Compare(Item1, Item2: pColorInfo): Integer;
begin
Result := Item2.Count - Item1.Count;
end;
var
List: TList;
x, y: Integer;
pCI: pColorInfo;
Color: TColor;
begin
Result := -1;
List := TList.Create;
try
Bmp.PixelFormat := pf24bit;
for x := 0 to Bmp.Width - 1 do for y := 0 to Bmp.Height - 1 do
begin
Color := Bmp.Canvas.Pixels[x, y];
pCI := GetColorIndex(List, Color);
if pCI = nil then begin New(pCI); pCI.Color := Color; pCI.Count := 0; List.Add(pCI); end;
Inc(pCI.Count);
end;
List.Sort(@Compare);
if List.Count < Index + 1 then Exit;
pCI := List[Index];
Result := pCI.Color;
finally
while List.Count <> 0 do begin pCI := List[0]; Dispose(pCI); List.Delete(0); end;
FreeAndNil(List);
end;
end;
- 图像干扰处理1
- 变频器干扰分析处理
- EMC辐射干扰与静电干扰之处理方法
- 视频图像干扰的产生和解决办法
- usb的干扰后的故障处理
- 处理干扰的一些小技巧
- 图片干扰背景处理,简单易懂
- Android图像处理1
- 图像处理1-17
- 图像处理学习1
- 眼底图像处理1
- opencv-图像处理1 图像基本操作
- 图像处理书籍笔记1--基本图像处理运算1
- 图像处理笔记(1)
- 图像形态学处理(1)
- 医学图像处理笔记(1)
- Python与图像处理1
- 图像处理基础知识总结1
- 终于考完试了
- cygwin——让你做LINUX下才能做的事
- .net设计模式之观察者模式
- Lorem Ipsum
- 按钮初始化不可用
- 图像干扰处理1
- JSP:response.sendRedirect("../loginfail")导致request的setAttribute的值丢失
- 抄近路上谷歌 — 谷歌最简网址 G.cn 上线
- JNI中jstring类型与c语言中的字符串的转换
- 眼前的越秀山与遥远的斯坦福桥
- Firewall Survey
- Windows API一日一练(60)CreateIoCompletionPort和GetQueuedCompletionStatus函数
- 笔试赛芯归来
- FreeTextBox控件的使用