using OpenCvSharp; using System; namespace OpenCV { class OpenCVClass : IDisposable { IplImage gray; public IplImage GrayScale(IplImage src) { gray = new IplImage(src.Size, BitDepth.U8, 1); Cv.CvtColor(src, gray, ColorConversion.BgrToGray); return gray; } public void Dispose() { if (gray != null) Cv.ReleaseImage(gray); } } }