資源簡介
使用C#語言實現了幾種常用的圖像清晰度評價的算法,在機器視覺當中非常實用

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Drawing.Imaging;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?System.Runtime.InteropServices;
using?System.Threading;
using?System.Threading.Tasks;
using?System.Collections.Concurrent;
using?System.Diagnostics;
namespace?圖像處理多線程技術
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????????myTimer?=?new?HiPerfTimer();
????????}
????????private?HiPerfTimer?myTimer;
????????private?string?curFileName;//文件名
????????Bitmap?curBitmap;//圖像對象
????????private?void?button1_Click_1(object?sender?EventArgs?e)
????????{
????????????OpenFileDialog?opnDlg?=?new?OpenFileDialog();
????????????opnDlg.Filter?=?“所有圖像文件?|?*.bmp;?*.pcx;?*.png;?*.jpg;?*.gif;“?+
????????????????“*.tif;?*.ico;?*.dxf;?*.cgm;?*.cdr;?*.wmf;?*.eps;?*.emf|“?+
????????????????“位圖(?*.bmp;?*.jpg;?*.png;...)?|?*.bmp;?*.pcx;?*.png;?*.jpg;?*.gif;?*.tif;?*.ico|“?+
????????????????“矢量圖(?*.wmf;?*.eps;?*.emf;...)?|?*.dxf;?*.cgm;?*.cdr;?*.wmf;?*.eps;?*.emf“;
????????????opnDlg.title?=?“打開圖像文件“;
????????????opnDlg.ShowHelp?=?true;
????????????if?(opnDlg.ShowDialog()?==?DialogResult.OK)
????????????{
????????????????curFileName?=?opnDlg.FileName;
????????????????try
????????????????{
????????????????????curBitmap?=?(Bitmap)Image.FromFile(curFileName);
????????????????}
????????????????catch?(Exception?exp)
????????????????{
????????????????????MessageBox.Show(exp.Message);
????????????????}
????????????}
????????????pictureBox1.Invalidate();
????????}
????????private?void?button2_Click(object?sender?EventArgs?e)
????????{
????????????if?(curBitmap?==?null)?//如果沒有創建圖像,則退出
????????????????return;
????????????SaveFileDialog?saveDlg?=?new?SaveFileDialog();//調用SaveFileDialog
????????????saveDlg.title?=?“保存為“;//設置對話框標題
????????????saveDlg.OverwritePrompt?=?true;//改寫已存在文件是提醒用戶
????????????saveDlg.Filter?=?“BMP文件(*.bmp)|*.bmp|“?+?“Gif文件(*.gif)|*.gif|“?+
????????????????“JPEG文件(*.jpg)|*.jpg|“?+?“PNG文件(*.png)|*.png“;//為圖像選擇一個篩選器
????????????saveDlg.ShowHelp?=?true;//啟用幫助按鈕
????????????if?(saveDlg.ShowDialog()?==?DialogResult.OK)//如果選擇格式,則保存圖像
????????????{
????????????????string?fileName?=?saveDlg.FileName;
????????????????string?strFilExtn?=?fileName.Remove(0?fileName.Length?-?3);
????????????????switch?(strFilExtn)
????????????????{
????????????????????case?“bmp“:
????????????????????????curBitmap.Save(fileName?System.Drawing.Imaging.ImageFormat.Bmp);
????????????????????????break;
????????????????????case?“jpg“:
????????????????????????curBitmap.Save(fileName?System.Drawing.Imaging.ImageFormat.Jpeg);
????????????????????????break;
????????????????????case?“gif“:
????????????????????????curBitmap.Save(fileName?System.Drawing.Imaging.ImageFormat.Gif);
????????????????????????break;
????????????????????case?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2014-11-20?16:24??清晰度評價\
?????文件???????26199??2014-11-18?20:05??清晰度評價\QQ圖片20141118200536.jpg
?????目錄???????????0??2014-11-18?20:10??清晰度評價\圖像處理多線程技術\
?????文件???????14972??2014-12-19?10:41??清晰度評價\圖像處理多線程技術\Form1.Designer.cs
?????文件???????22985??2015-01-16?10:34??清晰度評價\圖像處理多線程技術\Form1.cs
?????文件????????5817??2014-12-19?10:41??清晰度評價\圖像處理多線程技術\Form1.resx
?????文件????????1564??2013-10-31?18:59??清晰度評價\圖像處理多線程技術\HiPerfTimer.cs
?????文件?????????508??2013-10-31?18:29??清晰度評價\圖像處理多線程技術\Program.cs
?????目錄???????????0??2014-11-18?20:10??清晰度評價\圖像處理多線程技術\Properties\
?????文件????????1396??2013-10-31?18:29??清晰度評價\圖像處理多線程技術\Properties\AssemblyInfo.cs
?????文件????????2905??2013-10-31?18:29??清晰度評價\圖像處理多線程技術\Properties\Resources.Designer.cs
?????文件????????5612??2013-10-31?18:29??清晰度評價\圖像處理多線程技術\Properties\Resources.resx
?????文件????????1113??2013-10-31?18:29??清晰度評價\圖像處理多線程技術\Properties\Settings.Designer.cs
?????文件?????????249??2013-10-31?18:29??清晰度評價\圖像處理多線程技術\Properties\Settings.settings
?????目錄???????????0??2015-07-01?10:05??清晰度評價\圖像處理多線程技術\Service?References\
?????目錄???????????0??2014-11-18?20:10??清晰度評價\圖像處理多線程技術\bin\
?????目錄???????????0??2014-11-18?20:10??清晰度評價\圖像處理多線程技術\bin\Debug\
?????文件???????21504??2015-01-16?10:35??清晰度評價\圖像處理多線程技術\bin\Debug\圖像處理多線程技術.exe
?????文件???????40448??2015-01-16?10:35??清晰度評價\圖像處理多線程技術\bin\Debug\圖像處理多線程技術.pdb
?????文件???????11600??2015-01-16?10:36??清晰度評價\圖像處理多線程技術\bin\Debug\圖像處理多線程技術.vshost.exe
?????文件?????????490??2010-03-17?22:39??清晰度評價\圖像處理多線程技術\bin\Debug\圖像處理多線程技術.vshost.exe.manifest
?????目錄???????????0??2014-11-18?20:10??清晰度評價\圖像處理多線程技術\obj\
?????目錄???????????0??2014-11-18?20:10??清晰度評價\圖像處理多線程技術\obj\x86\
?????目錄???????????0??2015-01-16?10:35??清晰度評價\圖像處理多線程技術\obj\x86\Debug\
?????文件????????4501??2013-11-01?10:48??清晰度評價\圖像處理多線程技術\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件????????6317??2015-01-16?10:35??清晰度評價\圖像處理多線程技術\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件????????1684??2014-12-19?10:41??清晰度評價\圖像處理多線程技術\obj\x86\Debug\GenerateResource.read.1.tlog
?????文件????????4122??2014-12-19?10:41??清晰度評價\圖像處理多線程技術\obj\x86\Debug\GenerateResource.write.1.tlog
?????文件????????8031??2013-11-04?15:41??清晰度評價\圖像處理多線程技術\obj\x86\Debug\ResolveAssemblyReference.cache
?????目錄???????????0??2015-07-01?10:05??清晰度評價\圖像處理多線程技術\obj\x86\Debug\TempPE\
?????文件?????????180??2014-12-19?10:41??清晰度評價\圖像處理多線程技術\obj\x86\Debug\圖像處理多線程技術.Form1.resources
............此處省略7個文件信息
- 上一篇:C#簡易計算器.zip
- 下一篇:C#星星程序
評論
共有 條評論