配置opencv1

本文详细介绍了如何在Windows 7(64位)环境下,通过CMake和Visual Studio 2010编译OpenCV2.4.2的过程。包括下载源码、安装CMake、配置编译参数、设置环境变量,并提供了一个简单的代码示例进行验证。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

已下博文转自  http://www.cnblogs.com/youth0826/archive/2012/08/13/2635684.html

Tested on: VS 2010 + Win 7 (64 bit)

(1) Download OpenCV 2.4.2 (link)

(2) Unzip opencv2.4.2.exe to a directory, take mine for example: E:\OpenCV_src

 

图像 1

 

(3) Download and Install Cmake (for windows platform, win32  installer) since you need compile OpenCV by yourself when using Win 7 (64 bit). (link)

(4) Run cmake-gui.exe. The settings are shown in the figure. Push “Configure” button and select “Vusal Studio”, then Generate.

 

图像 2

 

(5) Find Opencv.sln in E:\OpenCV, then open it with VS 2010.

(6) Solution Explorer – Solution OpenCV, Rught Click, “Rebuild Solution”. If no errors, select “INSTALL” and “Build”.

(7) Set Environment Variables.

Path: E:\OpenCV\install\bin;E:\OpenCV\install\include;E:\OpenCV\install\lib;

TBB: E:\OpenCV_src\opencv\build\common\tbb\intel64\vc10;

 

At last, test the following codes in Debug mode and x64 platform!

btw, put the image file ppl.jpg in the code folder.

#include "stdafx.h"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
 
#pragma comment( lib, "opencv_core242d.lib ")
#pragma comment( lib, "opencv_highgui242d.lib" )
 
using namespace cv;
 
int _tmain(int argc, _TCHAR* argv[])
{
    namedWindow( "show_image", WINDOW_AUTOSIZE );
    Mat src = imread( "ppl.jpg" );
    while(1)
    {
        imshow( "show_image", src );
        char c = waitKey(0);
        if( 27 == c )
            return 0;
    }
    return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值