C# EmguCV:创建图像直方图-错误

C# EmguCV:创建图像直方图-错误,c#,histogram,emgucv,C#,Histogram,Emgucv,我刚从OpenCV切换到EmguCV,因为C++应用程序不能直接托管在我的目标云平台上——现在,在对转换进行必要的更改后,我的直方图代码将无法工作 以下是我所做工作的一个片段: Image<Gray, Byte> img_gray = new Image<Gray, byte>(frame1_hist.Rows, frame1_hist.Cols); frame1_hist.CopyTo(img_gray, null); DenseHistogram hist = new

我刚从OpenCV切换到EmguCV,因为C++应用程序不能直接托管在我的目标云平台上——现在,在对转换进行必要的更改后,我的直方图代码将无法工作

以下是我所做工作的一个片段:

Image<Gray, Byte> img_gray = new Image<Gray, byte>(frame1_hist.Rows, frame1_hist.Cols);
frame1_hist.CopyTo(img_gray, null);
DenseHistogram hist = new DenseHistogram(256, new RangeF(0, 256));
hist.Calculate(new Image<Gray, Byte>[] { img_gray }, true, null);
Image img_gray=新图像(frame1_hist.Rows,frame1_hist.Cols);
frame1_hist.CopyTo(图像灰色,空);
DenseShistogram hist=新的DenseShistogram(256,新范围F(0,256));
计算历史(新图像[]{img_gray},真,空);
“System.NullReferenceException”类型的未处理异常 发生在Emgu.CV.dll中

如果您能告诉我如何解决这个问题,我将非常感谢您的帮助。此外,如何在操作后从“hist”读取处理后的图像。我正在使用EmguCv 3.0.0。谢谢

图像img\u gray=新图像
Image<Gray, Byte> img_gray = new Image<Gray, Byte(frame1_hist.Image.Bitmap);
DenseHistogram hist = new DenseHistogram(256, new RangeF(0.0f, 255.0f));
hist.Calculate<Byte>(new Image<Gray, byte>[] { img_gray }, true, null);