資源簡介
C#是.net平臺上的明星語言,可以很容易做出漂亮的界面。EmguCV是將opencv封裝的一個.net庫可以被VC++,VC#,VB.net調(diào)用。網(wǎng)上對于EmguCV的介紹很少,本人整理了一些資料Emgu和C#相結合的一些例子,對大家的學習一定會有幫助
代碼片段和文件信息
//----------------------------------------------------------------------------
//??Copyright?(C)?2004-2018?by?EMGU?Corporation.?All?rights?reserved.???????
//----------------------------------------------------------------------------
using?System;
using?System.Collections.Generic;
using?System.Data;
using?System.Drawing;
using?System.Drawing.Printing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?Emgu.CV;
using?Emgu.CV.Aruco;
using?Emgu.CV.CvEnum;
using?Emgu.CV.Structure;
using?Emgu.CV.Util;
namespace?Aruco
{
????public?partial?class?MainForm?:?Form
????{
????????public?MainForm()
????????{
????????????InitializeComponent();
????????????_detectorParameters?=?DetectorParameters.GetDefault();
????????????try
????????????{
????????????????_capture?=?new?VideoCapture();
????????????????if?(!_capture.IsOpened)
????????????????{
????????????????????_capture?=?null;
????????????????????throw?new?NullReferenceException(“Unable?to?open?video?capture“);
????????????????}
????????????????else
????????????????{
????????????????????_capture.ImageGrabbed?+=?Processframe;
????????????????}
????????????}
????????????catch?(NullReferenceException?excpt)
????????????{
????????????????MessageBox.Show(excpt.Message);
????????????}
????????????UpdateMessage(String.Empty);
????????}
????????private?VideoCapture?_capture?=?null;
????????private?bool?_captureInProgress;
????????private?bool?_useThisframe?=?false;
????????int?markersX?=?4;
????????int?markersY?=?4;
????????int?markersLength?=?80;
????????int?markersSeparation?=?30;
????????private?Dictionary?_dict;
????????private?Dictionary?ArucoDictionary
????????{
????????????get
????????????{
????????????????if?(_dict?==?null)
????????????????????_dict?=?new?Dictionary(Dictionary.PredefinedDictionaryName.Dict4X4_100);
????????????????return?_dict;
????????????}
????????}
????????private?GridBoard?_gridBoard;
????????private?GridBoard?ArucoBoard
????????{
????????????get
????????????{
????????????????if?(_gridBoard?==?null)
????????????????{
????????????????????_gridBoard?=?new?GridBoard(markersX?markersY?markersLength?markersSeparation?ArucoDictionary);
????????????????}
????????????????return?_gridBoard;
????????????}
????????}
????????private?void?printArucoBoardButton_Click(object?sender?EventArgs?e)
????????{
????????????Size?imageSize?=?new?Size();
????????????int?margins?=?markersSeparation;
????????????imageSize.Width?=?markersX?*?(markersLength?+?markersSeparation)?-?markersSeparation?+?2?*?margins;
????????????imageSize.Height?=?markersY?*?(markersLength?+?markersSeparation)?-?markersSeparation?+?2?*?margins;
????????????int?borderBits?=?1;
????????????Mat?boardImage?=?new?Mat();
????????????ArucoBoard.Draw(imageSize?boardImage?margins?borderBits);
????????????bmIm?=?boardImage.Bitmap;
????????????PrintImage();
????????}
????????private?void?PrintImage()
????????{
????????????PrintDocument?pd?=?new?PrintDocument();
????????????//pd.DefaultPageSettings.Margi
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????184??2018-07-11?21:37??Emgu.CV.Example\Aruco\App.config
?????文件???????4260??2018-07-11?21:37??Emgu.CV.Example\Aruco\Aruco.csproj
?????文件???????9580??2018-07-11?21:37??Emgu.CV.Example\Aruco\MainForm.cs
?????文件???????4986??2018-07-11?21:37??Emgu.CV.Example\Aruco\MainForm.Designer.cs
?????文件???????5698??2018-07-11?21:37??Emgu.CV.Example\Aruco\MainForm.resx
?????文件????????483??2018-07-11?21:37??Emgu.CV.Example\Aruco\Program.cs
?????文件???????1386??2018-07-11?21:37??Emgu.CV.Example\Aruco\Properties\AssemblyInfo.cs
?????文件???????2653??2018-07-11?21:37??Emgu.CV.Example\Aruco\Properties\Resources.Designer.cs
?????文件???????5496??2018-07-11?21:37??Emgu.CV.Example\Aruco\Properties\Resources.resx
?????文件???????1036??2018-07-11?21:37??Emgu.CV.Example\Aruco\Properties\Settings.Designer.cs
?????文件????????242??2018-07-11?21:37??Emgu.CV.Example\Aruco\Properties\Settings.settings
?????文件???????2997??2018-07-11?21:37??Emgu.CV.Example\CameraCapture\CameraCapture.cs
?????文件???????5029??2018-11-22?15:15??Emgu.CV.Example\CameraCapture\CameraCapture.csproj
?????文件??????15900??2018-07-11?21:37??Emgu.CV.Example\CameraCapture\CameraCapture.Designer.cs
?????文件???????5695??2018-07-11?21:37??Emgu.CV.Example\CameraCapture\CameraCapture.resx
?????文件???????5632??2018-11-22?18:54??Emgu.CV.Example\CameraCapture\CameraCapture.v11.suo
?????文件????????457??2018-11-22?15:12??Emgu.CV.Example\CameraCapture\CommonAssemblyInfo.cs
?????文件????????180??2018-11-22?15:15??Emgu.CV.Example\CameraCapture\obj\Debug\CameraCapture.CameraCapture.resources
?????文件???????1281??2018-11-22?18:54??Emgu.CV.Example\CameraCapture\obj\Debug\CameraCapture.csproj.FileListAbsolute.txt
?????文件????????782??2018-11-22?15:14??Emgu.CV.Example\CameraCapture\obj\Debug\CameraCapture.csproj.GenerateResource.Cache
?????文件??????19429??2018-11-22?14:57??Emgu.CV.Example\CameraCapture\obj\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????6970??2018-11-22?15:15??Emgu.CV.Example\CameraCapture\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件??????12800??2018-11-22?15:15??Emgu.CV.Example\CameraCapture\obj\Debug\Example.CameraCapture.exe
?????文件??????19968??2018-11-22?15:15??Emgu.CV.Example\CameraCapture\obj\Debug\Example.CameraCapture.pdb
?????文件?????331432??2018-01-14?01:32??Emgu.CV.Example\CameraCapture\obj\Debug\x64\concrt140.dll
?????文件???31313920??2018-10-15?19:02??Emgu.CV.Example\CameraCapture\obj\Debug\x64\cvextern.dll
?????文件????2429582??2018-10-15?19:02??Emgu.CV.Example\CameraCapture\obj\Debug\x64\cvextern.lib
?????文件?????641696??2018-01-14?01:32??Emgu.CV.Example\CameraCapture\obj\Debug\x64\msvcp140.dll
?????文件???18054144??2018-10-15?18:27??Emgu.CV.Example\CameraCapture\obj\Debug\x64\opencv_ffmpeg343_64.dll
?????文件??????87728??2018-01-14?01:32??Emgu.CV.Example\CameraCapture\obj\Debug\x64\vcruntime140.dll
............此處省略355個文件信息
評論
共有 條評論