简体   繁体   English

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

[英]EmguCV: Create Image Histogram - Error

I just switched from OpenCV to EmguCV because C++ applications can't be directly hosted on my target cloud platform -- now my Histogram code won't work after making the necessary changes for the conversion. 我只是从OpenCV切换到EmguCV,因为C ++应用程序无法直接托管在目标云平台上-现在,在对转换进行必要的更改后,我的直方图代码将无法工作。

Here is a snippet of what I have done: 这是我所做的摘要:

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);

An unhandled exception of type 'System.NullReferenceException' occurred in Emgu.CV.dll Emgu.CV.dll中发生类型为'System.NullReferenceException'的未处理异常

I will appreciate your kind help if you may tell me how I can fix this. 如果您能告诉我如何解决此问题,将不胜感激。 Also, how can I read the processed image from "hist" after the operation. 另外,手术后如何从“历史”中读取处理后的图像。 I am using EmguCv 3.0.0. 我正在使用EmguCv 3.0.0。 Thanks 谢谢

Image<Gray, Byte> img_gray = new Image<Gray, Byte(frame1_hist.Image.Bitmap);
DenseHistogram hist = new DenseHistogram(256, new RangeF(0.0f, 255.0f));

// Histogram Computing //直方图计算

hist.Calculate<Byte>(new Image<Gray, byte>[] { img_gray }, true, null);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM