我正在学习如何使用OpenImaj的AdaptiveLocalThresholdContrast阈值处理图像为两个“段”,然后查看处理过的图像。当我运行以下代码时:
AdaptiveLocalThresholdContrast thresholder = new AdaptiveLocalThresholdContrast(10);
MBFImage input = ImageUtilities.readMBF(new File("/path/to/file.jpg"));
FImage flat = input.flatten();
DisplayUtilities.display(flat);
thresholder.processImage(flat);
DisplayUtilities.display(flat);显示原始(扁平的)图像,然后在thresholder.processImage(平面)行中得到以下空指针异常:
Exception in thread "main" java.lang.NullPointerException
at org.openimaj.image.processing.threshold.AdaptiveLocalThresholdContrast.processImage(AdaptiveLocalThresholdContrast.java:74)我在第74行查看了AdaptiveLocalThresholdContrast的源代码,但我不清楚是什么导致了空指针异常。任何帮助都将不胜感激。
http://www.openimaj.org/openimaj-image/image-processing/xref/org/openimaj/image/processing/threshold/AdaptiveLocalThresholdContrast.html
发布于 2015-07-09 08:07:31
嗯,这是一个错误(可能是某个时候重构的结果--抱歉)。现在应该在源代码(https://github.com/openimaj/openimaj/commit/2f247e4ab0f7da02713e8545d4ac153aa08070b8)中修复&也可以在最新的jars“1.4快照”版本中找到。
https://stackoverflow.com/questions/31303233
复制相似问题