如何在 OSX 中使用 QT 设置 OpenCV?

发布于 2024-12-04 11:48:49 字数 93 浏览 1 评论 0原文

我想使用新的 C++ OpenCV 接口在 OS X Snow Leopard 上的 Qt Creator 中创建 Qt 应用程序。我该怎么做?网上很难找到对此的良好解释。

I want to use the new C++ OpenCV interface to create Qt applications in Qt Creator on OS X Snow Leopard. How can I do this? Good explanations of this are very hard to come by online.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

与酒说心事 2024-12-11 11:48:50

我实际上做到了这一点,而且相当简单。您可以从 qt 网站下载 QtSDK 作为 dmg,只需点击即可安装。

此后我使用了 MacPorts,MacPorts 是 osx 的包管理器(如 aptitude、portage、pacman 等)。 http://www.macports.org/,下载它,然后再次:点击即可播放。

要使用 MacPorts,您首先需要 make 和 gcc/g++ 等工具才能工作。这些包含在 xcode 包中(位于苹果商店)。当然,这些工具对于开发者来说就像CPU一样重要。你首先会想要它们。

安装 xcode 后,make/g++/gcc 就在你的系统上,但它们不在你的路径中。在终端中,命令将不存在。要解决此问题,请打开 xcode ide(如果允许我称其为 ide,是吗?)。然后转到 XCode(向左屏幕)->首选项->下载。您可以在那里安装“命令行工具”,然后执行此操作。

那么 make 应该在那里。使用终端进行验证。只需输入 make 就可能会显示消息“make: * 未指定目标且未找到 makefile”。停止。”,但不是“找不到命令”。

然后,要安装 opencv,我安装了 MacPorts,输入“sudo port install opencv”,等待一段时间,如果一切顺利,您应该已经安装了 opencv。它安装在/opt/local 中。因此,您可能需要将这些添加到您的 .pro 文件中:

CONFIG += MYHOTOSXMACHINE

MYHOTOSXMACHINE {
    INCLUDEPATH += /opt/local/include/
    LIBS += -L/opt/local/lib/
}

所以,就这样。祝你好运!

PS:我对整个 linux/gnu/posix 并不陌生,但我对 osx 很陌生。因此,如果有更干净的方法来做到这一点,请随时发表评论。

I actually did this, and it was fairly easy. You can download QtSDK from the qt-website as a dmg, installing that is just click-and-play.

After this I used MacPorts, MacPorts is a package-manager (like aptitude, portage, pacman, etc) for osx. http://www.macports.org/, download it, and again: click-and-play.

To use MacPorts, you first need tools like make and gcc/g++ to work. These are included in the package xcode (which is in the apple store). Of course, these tools are as important as a cpu to a developer. You would want them in the first place.

After installing xcode, make/g++/gcc are on your system, yet they are not in your path. In a terminal, the commands won't exist. To fix this, open the xcode ide (If I am allowed to call it an ide, am I?). Then goto XCode (lop left screen)-> Preferences -> Downloads. There you can install the 'Command Line Tools', do this.

Then make should be there. Use a terminal to verify. Just typing make will probably message you 'make: * No targets specified and no makefile found. Stop.', but not 'command not found'.

Then, to install opencv I installed MacPorts, type 'sudo port install opencv', wait a while and if all went well, you should have opencv. It is installed in /opt/local. Therefore you might need to add these to your .pro-file:

CONFIG += MYHOTOSXMACHINE

MYHOTOSXMACHINE {
    INCLUDEPATH += /opt/local/include/
    LIBS += -L/opt/local/lib/
}

So, there you go. Good luck!

PS: I not new to the whole linux/gnu/posix thing, yet I am new to osx. So if there is a cleaner way to do this, feel free to comment.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文