LeadTools中文圖像處理開發(fā)教程(5):圖像去噪_第1頁
LeadTools中文圖像處理開發(fā)教程(5):圖像去噪_第2頁
LeadTools中文圖像處理開發(fā)教程(5):圖像去噪_第3頁
LeadTools中文圖像處理開發(fā)教程(5):圖像去噪_第4頁
LeadTools中文圖像處理開發(fā)教程(5):圖像去噪_第5頁
已閱讀5頁,還剩10頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

們將其稱為含噪圖像或噪聲圖像。減少數(shù)字圖像中噪聲的過程稱為圖像去噪。LeadTools在去噪方面也提供了多種類,具有非常強大的功能。本文主要為大家介紹:1創(chuàng)建“圖像去噪”應用程序的具體步驟2LeadTools“圖像去噪”相關類的介紹3傅里葉變換:A知識簡介BLeadTools傅里葉變換類的介紹4“圖像去噪”支持WCF簡介創(chuàng)建“圖像去噪”應用程序的具體步驟1.打開VisualStudio.NET。點擊文件->新建->項目…。打開新建項目對話框后,在模板中選擇“VisualC#”或“Visual”,隨后選擇“Windows窗體應用程序RemoveNoise按鈕選擇您工程的存儲路徑,點擊“確定”。2.在“解決方案資源管理器”中,右擊“引用”,選擇“添加引用”。根據(jù)當前工程的FrameworkLeadTools控件,例如工程中的版本為Framework4.0、生成目標平臺是x86,則瀏覽選擇LeadtoolsFor.NET文件夾”<LEADTOOLS_INSTALLDIR>\Bin\DotNet4\Win32”,選擇以下的Leadtools.dllLeadtools.Codecs.dllLeadtools.Codecs.Cmp.dllLeadtools.Codecs.Bmp.dllLeadtools.Codecs.Tif.dllLeadtools.ImageProcessing.Color.dllLeadtools.ImageProcessing.Core.dllLeadtools.ImageProcessing.Effects.dllLeadtools.WinForms.dll3.從工具箱7個RadioButton控件(將RadioButton的TextPanel控件(Name分別修改為panelBefore和panelAfter)。如下圖:NameTextradioButton1使用DespeckleCommand去除一位圖像斑點radioButton2使用MedianCommand去除椒鹽噪聲radioButton3使用AverageCommand去除均勻、高斯噪聲radioButton4使用AutoBinaryCommand將圖像轉為二值圖像radioButton5使用SmoothEdgesCommand平滑圖像的邊緣radioButton6對圖像進行離散傅里葉變換radioButton7對圖像進行快速傅里葉變換4.切換至Form1的代碼視圖(右擊Form1,選擇查看代碼),將下面幾行代碼添加到文件開始處:1:usingLeadtools;2:usingLeadtools.Codecs;3:usingLeadtools.Codecs.Tif;4:usingLeadtools.ImageProcessing;5:usingLeadtools.ImageProcessing.Core;6:usingLeadtools.ImageProcessing.Effects;7:usingLeadtools.ImageProcessing.Color;8:usingLeadtools.WinForms;5.將以下變量添加至Form1類:1:privateRasterImageViewerbeforePic;2:privateRasterImageViewerafterPic;3:privateRasterCodecscodecs;4:privateRasterImagetemp;6.添加Form1Load事件句柄,在其中添加以下代碼:1:beforePic=newRasterImageViewer();2:beforePic.BackColor=Color.DarkCyan;3:beforePic.Dock=DockStyle.Fill;4:beforePic.InteractiveMode=RasterViewerInteractiveMode.Pan;5:beforePic.HorizontalAlignMode=RasterPaintAlignMode.Center;6:beforePic.VerticalAlignMode=RasterPaintAlignMode.Center;7:beforePic.AutoResetScaleFactor=false;8:panelBefore.Controls.Add(beforePic);9:beforePic.BringToFront();10:11:afterPic=newRasterImageViewer();12:afterPic.BackColor=beforePic.BackColor;13:afterPic.Dock=beforePic.Dock;14:afterPic.InteractiveMode=beforePic.InteractiveMode;15:afterPic.HorizontalAlignMode=beforePic.HorizontalAlignMode;16:afterPic.VerticalAlignMode=beforePic.VerticalAlignMode;17:afterPic.AutoResetScaleFactor=beforePic.AutoResetScaleFactor;18:panelAfter.Controls.Add(afterPic);19:afterPic.BringToFront();20:21:codecs=newRasterCodecs();22:codecs.ThrowExceptionsOnInvalidImages=true;7.雙擊radioButton1,在radioButton1CheckedChanged事件句柄中添加以下代碼:(本段代碼為DespeckleCommand類的使用)1:beforePic.Image=codecs.Load(Path.Combine(Application.StartupPath,..\..\Pic\clean.tif"));2:3:temp=beforePic.Image.Clone();4:5:DespeckleCommandcommand=newDespeckleCommand();6:7:command.Run(temp);8:afterPic.Image=temp;8.雙擊radioButton2,在radioButton2CheckedChanged事件句柄中添加以下代碼:(本段代碼為MedianCommand類的使用)1:beforePic.Image=codecs.Load(Path.Combine(Application.StartupPath,..\..\Pic\Master.jpg"));2:3:temp=beforePic.Image.Clone();4:5:MedianCommandcommand=newMedianCommand();6:7:command.Dimension=9;8:command.Run(temp);9:afterPic.Image=temp;9.雙擊radioButton3,在radioButton3CheckedChanged事件句柄中添加以下代碼:(本段代碼為AverageCommand類的使用)1:beforePic.Image=codecs.Load(Path.Combine(Application.Sta

rtupPath,..\..\Pic\Master.jpg"));2:3:temp=beforePic.Image.Clone();4:5:AverageCommandcommand=newAverageCommand();6:7:command.Dimension=3;8:command.Run(temp);9:afterPic.Image=temp;10:codecs.Save(temp,Path.Combine(Application.StartupPath,@"..\..\Pic\AverageCommandResult.jpg"),RasterImageFormat.Jpeg,24);10.雙擊radioButton4,在radioButton4CheckedChanged事件句柄中添加以下代碼:(本段代碼為AutoBinaryCommand類的使用)1:beforePic.Image=codecs.Load(Path.Combine(Application.StartupPath,..\..\Pic\Master.jpg"));2:3:temp=beforePic.Image.Clone();4:5:AutoBinaryCommandcommand=newAutoBinaryCommand();6:7:command.Run(temp);8:afterPic.Image=temp;9:codecs.Save(temp,Path.Combine(Application.StartupPath,@"..\..\Pic\AutoBinaryCommand.jpg"),RasterImageFormat.Jpeg,24);11.雙擊radioButton5,在radioButton5CheckedChanged事件句柄中添加以下代碼:(本段代碼為SmoothEdgesCommand類的使用)1:beforePic.Image=codecs.Load(Path.Combine(Application.StartupPath,..\..\Pic\Master.jpg"));2:3:temp=beforePic.Image.Clone();4:5:SmoothEdgesCommandcommand=newSmoothEdgesCommand();6:command.Amount=50;7:command.Threshold=0;8:9:command.Run(temp);10:afterPic.Image=temp;12.雙擊radioButton6,在radioButton6CheckedChanged事件句柄中添加以下代碼:(本段代碼為DiscreteFourierTransformCommand類的使用)1:beforePic.Image=codecs.Load(Path.Combine(Application.StartupPath,..\..\Pic\Master.jpg"));2:3:temp=beforePic.Image.Clone();4:5:FourierTransformInformationFTArray=newFourierTransformInformation(temp);6:LeadRectrcRange=newLeadRect(0,0,temp.Width-1,temp.Height-1);7:DiscreteFourierTransformCommandcommand=newDiscreteFourierTransformCommand();8:9:command.FourierTransformInformation=FTArray;10:command.Range=rcRange;11:command.Flags=DiscreteFourierTransformCommandFlags.DiscreteFourierTransform|12:DiscreteFourierTransformCommandFlags.Gray|13:DiscreteFourierTransformCommandFlags.Range|14:DiscreteFourierTransformCommandFlags.InsideX|15:DiscreteFourierTransformCommandFlags.InsideY;16:17:18:FourierTransformDisplayCommanddisCommand=newFourierTransformDisplayCommand();19:disCommand.Flags=FourierTransformDisplayCommandFlags.Log|FourierTransformDisplayCommandFlags.Magnitude;20:disCommand.FourierTransformInformation=command.FourierTransformInformation;21:22:disCommand.Run(temp);23:24:afterPic.Image=temp;13.雙擊radioButton7,在radioButton7CheckedChanged事件句柄中添加以下代碼:(本段代碼為FastFourierTransformCommand類的使用)1:beforePic.Image=codecs.Load(Path.Combine(Application.StartupPath,..\..\Pic\Master.jpg"));2:3:temp=beforePic.Image.Clone();4:5:SizeCommandsizecommand=newSizeCommand(256,256,Leadtools.RasterSizeFlags.Bicubic);6:7:sizecommand.Run(temp);8:FourierTransformInformationFTArray=newFourierTransformInformation(temp);9:10:FastFourierTransformCommandcommand=newFastFourierTransformCommand(FTArray,FastFourierTransformCommandFlags.FastFourierTransform|FastFourierTransformCommandFlags.Gray);11:command.Run(temp);12:LeadRectrcRect=newLeadRect(0,0,temp.Width/2,temp.Height/2);13:FrequencyFilterCommandFreqCommand=newFrequencyFilterCommand(FTArray,rcRect,FrequencyFilterCommandFlags.InsideX|FrequencyFilterCommandFlags.OutsideY);14:15:FastFourierTransformCommandInvCommand=newFastFourierTransformCommand(FTArray,FastFourierTransformCommandFlags.InverseFastFourierTransform|FastFourierTransformCommandFlags.Gray|FastFourierTransformCommandFlags.Scale|FastFourierTransformCommandFlags.Both);16:InvCommand.Run(temp);17:18:afterPic.Image=temp;14.編譯運行程序。本文DEMO使用了DespeckleCommand、MedianCommand、AverageCommand、AutoBinaryCommand、SmoothEdgesCommand速傅里葉變換對圖像進行了處理。結果如下圖:LeadTools“圖像去噪”相關類的介紹類名說明專門用于去除1位圖像上的斑點,例如傳真或DespeckleCommand掃描文件。它是去除任何種類圖像椒鹽噪聲的有效方法。您可以設置鄰域的大?。ㄓ糜谟嬎阒虚g值的周MedianCommand圍像素)來控制方法的強度。這個方法會導致圖像的最小模糊。它可以移除均勻和高斯噪聲,但是有的圖像使用中值濾波器圖像會變得更加模糊。您可以設AverageCommand置鄰域的大?。ㄓ糜谟嬎闼阈g平均值的周圍像素)來控制類的強度。此類可在一個列表平均圖像,消除圖像中的隨AddCommand機噪聲。此類可在一個列表平均圖像,消除圖像中的隨機噪聲。通常情況下,調用此類可在短的時間AddWeightedCommand間隔內獲取同一對象的一系列圖像。此類通過加權平均可以消除隨機噪聲。此類通過將高斯濾波器應用于圖像的每個像GaussianCommand素,平滑和模糊圖像。模糊的量由類使用的鄰域大小決定?!綝ocument/Medical專用】二進制過濾器(用于黑色物體的膨脹和腐蝕)可用于噪聲去除。BinaryFilterCommand類使用了定向二

BinaryFilterCommand進制過濾器。MaximumCommand和MinimumCommand類可以控制膨脹和腐蝕的鄰域大小。這些方法的一種噪聲移除技術創(chuàng)建了一個圖像的兩個副本,將膨脹過濾器應用于一個副本,腐蝕過濾器應用于另一個副本。然后使用設置了OperationAverage(averaging)標志的CombineCommand類合并處理后的兩個圖像。【Document/Medical專用】此類基于圖像AutoBinaryCommand的統(tǒng)計特性,使用自動計算的閾值,將圖像轉換為二值圖像?;叶葓D像會獲取最佳的效果。去除隔行掃描視頻信號源圖像的黑線。它在圖DeinterlaceCommand像中合并線和/或將線混合在一起。SmoothEdgesCommand平滑圖像的邊緣不改變每像素的位數(shù),將圖像轉換為黑白圖DynamicBinaryCommand像。傅立葉變換A知識簡介傅里葉變換在去除諧波噪聲時非常有用,如:圖像視頻中的人字斜紋圖案正弦波樣式莫爾樣式半色調圖案干擾模式傅里葉變換在去除視頻信號和CCD的噪聲時也十分常有用的。下面我們?yōu)榇蠹医榻B下傅里葉變換的一些基本概念和原理:1傅里葉變換將一個圖像在空間上的強度變化變?yōu)樵陬l率上的強度變化。當一個圖像被描述為一系列的頻率和相位時,便可以使用功率譜分析分析這些信息。功率譜是繪制出像素強度值頻率的二維示意圖。低頻接近源點,高頻接近邊緣。使用inversecommand標記,圖像可被轉換回原圖像,且沒有噪聲。2離散傅里葉變換使用了

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論