如何在OSX中使用QT设置OpenCV? [英] How do you set up OpenCV with QT in OSX?

查看:108
本文介绍了如何在OSX中使用QT设置OpenCV?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用新的C ++ OpenCV接口在OS X Snow Leopard的Qt Creator中创建Qt应用程序。我如何做到这一点?这个很好的解释很难在网上。

解决方案

我实际上做到了,这是相当容易。您可以从qt网站下载QtSDK作为一个dmg,安装只是点击和播放。



之后,我使用MacPorts,MacPorts是一个包管理(如aptitude,portage,pacman等)为osx。 http://www.macports.org/ ,下载并再次:点击即播。 / p>

要使用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 /
}
pre>

所以,你去。好运!



PS:我不是新的整个linux / gnu / posix的东西,但我是新的osx。因此,如果有一个更干净的方法来做到这一点,随时评论。


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.

解决方案

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.

这篇关于如何在OSX中使用QT设置OpenCV?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆