使用SWIG将OpenCV的C++ API封装到GO中。

huangapple go评论101阅读模式
英文:

Use SWIG to wrap OpenCV's C++ API in GO

问题

我正在尝试使用SWIG来封装OpenCV的C++ API。目前,我已经在系统中安装了OpenCV。我的问题是:

  1. 是否可以在不将它们放入SWIG文件所在目录的情况下封装“系统级”库?例如,我的OpenCV头文件位于/usr/local/opt/opencv/opencv2/opencv.hpp。我可以在SWIG中使用%include "opencv2/opencv.hpp"吗?

  2. 我应该如何开始这项工作?我应该先封装常量吗?

谢谢。

英文:

I'm trying to use SWIG to wrap OpenCV's C++ API. For now, I have system-wise OpenCV installed. My questions are:

  1. Is it possible to wrap "system-wise" library without putting them into the same directory of my SWIG files? For example, my opencv's header files are in /usr/local/opt/opencv/opencv2/opencv.hpp. Can I use %include "opencv2/opencv.hpp" in SWIG?

  2. How should I start with this work? Should I wrap the CONSTANTs first?

thanks.

答案1

得分: 1

你可以包含任何你喜欢的头文件。它不一定要在同一个目录下。

我建议首先考虑你想要向Go程序提供的API。一个好的Go API通常与一个好的C API不同。

英文:

You can %include any header file you like. It doesn't have to be in the same directory.

I would start by thinking about the API you want to present to Go programs. A good Go API is often different from a good C API.

huangapple
  • 本文由 发表于 2015年2月7日 16:38:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/28380168.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定