如何在 OSX 中使用 QT 设置 OpenCV?
我想使用新的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我实际上做到了这一点,而且相当简单。您可以从 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 文件中:
所以,就这样。祝你好运!
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:
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.