为什么ImageStatistics.Gray为null?
我正在使用AForge.net,我想在文本框中显示标准偏差的值。以下代码无效:
AForge.Imaging.ImageStatistics stat = new AForge.Imaging.ImageStatistics(btm_1);
AForge.Math.Histogram gray = stat.Gray;
this.textB_1.Text = gray.StdDev.ToString();
它失败并出现以下错误:
你调用的对象是空的。
gray
和stat.Gray
均为空。
没有找到相关结果
已邀请:
2 个回复
哭木算
朗排谎纷瘟
财产的官方文件说: 注意:该属性仅对灰度图像有效(请参阅IsGrayscale属性)。 我猜你的图像不是灰度图像,
属性返回null。它最好抛出一个
,因为它可以提供一些有关错误原因的见解,并且它会快速失败。