gpt4 book ai didi

java - opencv_core.Mat 与 opencv.core.Mat 之间的区别以及如何相互转换?

转载 作者:行者123 更新时间:2023-12-02 01:44:12 25 4
gpt4 key购买 nike

两者有什么区别?

org.bytedeco.javacpp.opencv_core.Mat

org.opencv.core.Mat

它们如何相互转换?

我认为 javacpp 是 opencv 的包装器,并且认为它们是相同的。但事实并非如此。

最佳答案

使用 JavaCPP 生成的包装器更加完整,如 http://bytedeco.org/faq/ 中所述。 :

How does it differ from wrappers in OpenCV, TensorFlow, etc?

JavaCPP was designed for maximum performance and flexibility. It strives to map as much of C++ as the Java language can reasonably handle, offering a level of usability to native functionality unmatched by any other solutions that we are aware of. It also provides a common foundation, a set of basic classes, to increase the interoperability between different native libraries on the Java platform. Plus, its integration with standard tools such as Maven facilitates development and deployment.

JavaCV 捆绑了这两个 API,因此我们可以毫无问题地一起使用它们。我们还可以使用 OpenCVFrameConverter 轻松地在两者之间进行转换。 ,例如:

OpenCVFrameConverter.ToMat converter1 = new OpenCVFrameConverter.ToMat();
OpenCVFrameConverter.ToOrgOpenCvCoreMat converter2 = new OpenCVFrameConverter.ToOrgOpenCvCoreMat();
Mat mat = ...;
org.opencv.core.Mat cvmat = converter2.convert(converter1.convert(mat));
Mat mat2 = converter2.convert(converter1.convert(cvmat));

关于java - opencv_core.Mat 与 opencv.core.Mat 之间的区别以及如何相互转换?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53952743/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com