升级到最新版本的 Boofcv

Upgrading to latest version of Boofcv

我目前 运行 是 Boofcv 的旧版本 (0.17),想升级。文档 (https://boofcv.org/index.php?title=Download ) 令人困惑:

The easiest way to use boofcv is to reference its jars on Maven Central. See below for Maven and Gradle code. BoofCV is broken up into many modules. To make it easier to use BoofCV all of its core functionality can be referenced using the 'all' module. Individual modules in "integration" still must be referenced individually.

Artifact List

boofcv-core : All the core functionality of BoofCV
boofcv-all : All the core and integration packages in BoofCV. YOU PROBABLY WANT CORE AND NOT THIS

这是自相矛盾的——我们用"all"还是"core"?

当我引入0.32版本的boofcv-core时,我得到了很多未解决的引用,比如 Description Resource Path Location Type ImageFloat32 cannot be resolved to a type BoofCVTest.java

我的问题分三部分: 图像的基本类型是否已重命名? 遗留代码需要如何编辑? Maven 中的默认库集是什么?

自 0.17 以来已经进行了大量重构,因为事情变得越来越冗长并简化了 API。例如,ImageFloat32 现在是 GrayF32。找出所有更改的最简单方法是查看相关示例代码。

对于模块,从 boofcv-core 开始。然后根据需要添加集成中列出的模块。例如,如果您需要 android 支持,请添加 boofcv-android。如果你包含 boofcv-all,你将拥有很多你可能不需要的东西,比如 Kinect 支持。

为了帮助正在升级的其他人,这里是我为升级到当前 Boofcv 所做的更改示例。它们似乎并不太难;我只是用过 s/ImageUInt/GrayU/g 和其他类型类似。到目前为止,我只找到了一种需要更改的方法 (VisualizeBinaryData.renderBinary)。

/** thresholds an image
 * uses BoofCV 0.32 or later
 * NOT YET TESTED
 * 
 * @param image
 * @param threshold 
 * @return thresholded BufferedImage
 */

/* WAS Boofcv 0.17
public static BufferedImage boofCVBinarization(BufferedImage image, int threshold) {
    ImageUInt8 input = ConvertBufferedImage.convertFrom(image,(ImageUInt8)null);
    ImageUInt8 binary = new ImageUInt8(input.getWidth(), input.getHeight());
    ThresholdImageOps.threshold(input, binary, threshold, false);
    BufferedImage outputImage = VisualizeBinaryData.renderBinary(binary,null);
    return outputImage;
}
The changes are ImageUInt8 => GrayU8 (etc.) 
VisualizeBinaryData.renderBinary(binary,null) => ConvertBufferedImage.extractBuffered(binary)

It compiles - but haven't yet run it.

 */
public static BufferedImage boofCVBinarization(BufferedImage image, int threshold) {

    GrayU8 input = ConvertBufferedImage.convertFrom(image,(GrayU8)null);
    GrayU8 binary = new GrayU8(input.getWidth(), input.getHeight());
    ThresholdImageOps.threshold(input, binary, threshold, false);
    BufferedImage outputImage = ConvertBufferedImage.extractBuffered(binary);
    return outputImage;
}