Installing OpenCV 2.4.9 + QT5 in Ubuntu

Installing OpenCV 2.4.9 + QT5 in Ubuntu

Hi,

Today is a small how to install OpenCV + QT5 in linux Ubuntu. For those who doesn’t know what is OpenCV, you can check here. Briefly OpenCV is a library for real time image processing created by Intel. It’s free for use under BSD license.

 

Installing QT

QT is a multiplataform application framework  developed by Digia. Some plataforms supported are: Android, Embedde Linux, iOS, Windows, Windows CE, etc.

To install QT:

 

Compiling OpenCV

First of all we need to install some required packages

Now, we get OpenCV here and we save it in a directory that we’ll call opencv5.

By default this library will be installed in /usr/local/lib. If you want to see some cmake options, read CMakeLists.txt.

In order to be able to link the lib, we need to create a file opencv.conf in /etc/ld.so.conf.d/ with the following:

and then execute

 

Testing OpenCV

If you want to test if everything is OK, you can go to the directory ./build/bin and execute one of several tests like:

 

QT5 + OpenCV together

First start QTCreator, in command line type

 

Create a new console project

 

new_project

 

Select Desktop as platform and follow the wizard until the end.

 

kit_selection

 

Now we need to tell to QT where we installed the libs. To do that open the .pro file and add the path.

Let’s test it and check if everything is working properly. In our OpenCV “hello world”, we’ll just show an image, of course, lena. You need to copie it in your project in Debug folder if you are in debug or Release if you are in release mode.

Below is our “hello world” code.

Compile and run and if everything is perfect, we should have this image

 

lena_result


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值