2

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

使用 boofcv 最简单的方法是在 Maven Central 上引用它的 jar。请参阅下面的 Maven 和 Gradle 代码。BoofCV 被分解成许多模块。为了更容易使用 BoofCV,它的所有核心功能都可以使用“all”模块来引用。“集成”中的各个模块仍然必须单独引用。

神器列表

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

这是自相矛盾的——我们使用“全部”还是“核心”?

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

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

4

2 回答 2

3

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

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

于 2019-01-05T18:36:49.693 回答
1

为了帮助其他正在升级的人,这里是我为升级到 current 所做的更改的示例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;
}
于 2019-01-06T11:55:40.253 回答