資源簡介
BGRtoGRAY.rar

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?Emgu.CV;
using?Emgu.CV.CvEnum;
using?Emgu.CV.Structure;
using?System.Runtime.InteropServices;
namespace?BGRtoGRAY
{
????public?partial?class?ToGrayImage?:?Form
????{
????????public?ToGrayImage()
????????{
????????????InitializeComponent();
????????}
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????if?(openFileDialog1.ShowDialog()?==?DialogResult.OK)
????????????{
????????????????//IntPtr?ptrImage?=?CvInvoke.cvLoadImage(openFileDialog1.FileName?LOAD_IMAGE_TYPE.CV_LOAD_IMAGE_UNCHANGED);
????????????????/*?IplImage*?轉(zhuǎn)換為Bitmap?*/
????????????????//圖片讀取
????????????????Image?image?=?new?Image(openFileDialog1.FileName);
????????????????pictureBox1.Image?=?image.Bitmap;//ConvertIntPrToBitmap(ptrImage);
????????????????Image?imageGray?=?image.Convert();
????????????????imageGray.Save(@“C:\temp\b.bmp“);
????????????????pictureBox2.Image?=?imageGray.Bitmap;
????????????????//顯示灰度圖像
????????????????//IntPtr?grayImage?=?CvInvoke.cvCreateImage(CvInvoke.cvGetSize(ptrImage)?IPL_DEPTH.IPL_DEPTH_8U?1);
????????????????//CvInvoke.cvCvtColor(ptrImage?grayImage?COLOR_CONVERSION.CV_BGR2GRAY);
????????????????////pictureBox2.Image?=?ConvertIntPrToBitmap(grayImage);?//用該方法灰度圖像會有三個圖片
????????????????//MIplImage?mi?=?(MIplImage)Marshal.PtrToStructure(grayImage?typeof(MIplImage));
????????????????//Image?image?=?new?Image(mi.width?mi.height?mi.widthStep?mi.imageData);
????????????????//pictureBox2.Image?=?image.ToBitmap();
????????????????//CvInvoke.cvReleaseImage(ref?ptrImage);
????????????????//CvInvoke.cvReleaseImage(ref?grayImage);
????????????}
????????}
????????///?將IplImage*轉(zhuǎn)換為Bitmap(注:在OpenCV中IplImage*?對應(yīng)EmguCV的IntPtr類型)????????
????????public?static?Bitmap?ConvertIntPrToBitmap(IntPtr?ptrImage)
????????{
????????????//將IplImage指針轉(zhuǎn)換成MIplImage結(jié)構(gòu)
????????????MIplImage?mi?=?(MIplImage)Marshal.PtrToStructure(ptrImage?typeof(MIplImage));
????????????Image?image?=?new?Image(mi.width?mi.height?mi.widthStep?mi.imageData);
????????????return?image.ToBitmap();
????????}
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????5875??2014-08-27?20:14??BGRtoGRAY\BGRtoGRAY\BGRtoGRAY.csproj
?????文件?????828478??2014-08-27?20:20??BGRtoGRAY\BGRtoGRAY\bin\Debug\a.bmp
?????文件???????9728??2014-11-10?16:51??BGRtoGRAY\BGRtoGRAY\bin\Debug\BGRtoGRAY.exe
?????文件??????32256??2014-11-10?16:51??BGRtoGRAY\BGRtoGRAY\bin\Debug\BGRtoGRAY.pdb
?????文件??????11600??2014-11-10?16:51??BGRtoGRAY\BGRtoGRAY\bin\Debug\BGRtoGRAY.vshost.exe
?????文件????????490??2010-03-17?22:39??BGRtoGRAY\BGRtoGRAY\bin\Debug\BGRtoGRAY.vshost.exe.manifest
?????文件?????322048??2014-04-16?12:18??BGRtoGRAY\BGRtoGRAY\bin\Debug\Emgu.CV.dll
?????文件??????42496??2014-04-16?12:18??BGRtoGRAY\BGRtoGRAY\bin\Debug\Emgu.CV.GPU.dll
?????文件?????112128??2014-04-16?12:18??BGRtoGRAY\BGRtoGRAY\bin\Debug\Emgu.CV.GPU.pdb
?????文件?????148820??2014-04-16?12:18??BGRtoGRAY\BGRtoGRAY\bin\Debug\Emgu.CV.GPU.xm
?????文件??????36864??2013-09-23?20:41??BGRtoGRAY\BGRtoGRAY\bin\Debug\Emgu.CV.ML.dll
?????文件?????146004??2013-09-23?20:41??BGRtoGRAY\BGRtoGRAY\bin\Debug\Emgu.CV.ML.xm
?????文件???????8192??2014-04-16?12:18??BGRtoGRAY\BGRtoGRAY\bin\Debug\Emgu.CV.OCR.dll
?????文件??????15872??2014-04-16?12:18??BGRtoGRAY\BGRtoGRAY\bin\Debug\Emgu.CV.OCR.pdb
?????文件???????9792??2014-04-16?12:18??BGRtoGRAY\BGRtoGRAY\bin\Debug\Emgu.CV.OCR.xm
?????文件??????40960??2013-09-23?20:41??BGRtoGRAY\BGRtoGRAY\bin\Debug\Emgu.CV.OpenCL.dll
?????文件??????94430??2013-09-23?20:41??BGRtoGRAY\BGRtoGRAY\bin\Debug\Emgu.CV.OpenCL.xm
?????文件?????929280??2014-04-16?12:18??BGRtoGRAY\BGRtoGRAY\bin\Debug\Emgu.CV.pdb
?????文件???????5632??2014-04-16?12:18??BGRtoGRAY\BGRtoGRAY\bin\Debug\Emgu.CV.Stitching.dll
?????文件??????13824??2014-04-16?12:18??BGRtoGRAY\BGRtoGRAY\bin\Debug\Emgu.CV.Stitching.pdb
?????文件???????1153??2014-04-16?12:18??BGRtoGRAY\BGRtoGRAY\bin\Debug\Emgu.CV.Stitching.xm
?????文件?????113664??2014-04-16?12:18??BGRtoGRAY\BGRtoGRAY\bin\Debug\Emgu.CV.UI.dll
?????文件?????140800??2014-04-16?12:18??BGRtoGRAY\BGRtoGRAY\bin\Debug\Emgu.CV.UI.pdb
?????文件??????35149??2014-04-16?12:18??BGRtoGRAY\BGRtoGRAY\bin\Debug\Emgu.CV.UI.xm
?????文件????1227431??2014-04-16?12:18??BGRtoGRAY\BGRtoGRAY\bin\Debug\Emgu.CV.xm
?????文件??????25088??2014-04-16?12:17??BGRtoGRAY\BGRtoGRAY\bin\Debug\Emgu.Util.dll
?????文件??????58880??2014-04-16?12:17??BGRtoGRAY\BGRtoGRAY\bin\Debug\Emgu.Util.pdb
?????文件??????22455??2014-04-16?12:17??BGRtoGRAY\BGRtoGRAY\bin\Debug\Emgu.Util.xm
?????文件?????307200??2013-02-09?07:33??BGRtoGRAY\BGRtoGRAY\bin\Debug\ZedGraph.dll
?????文件????1492968??2013-02-09?07:33??BGRtoGRAY\BGRtoGRAY\bin\Debug\ZedGraph.xm
............此處省略38個文件信息
- 上一篇:FlyingShootGame2.zip
- 下一篇:PADS最全封裝庫.zip
評論
共有 條評論