OpenCV配置C++篇(Debug与Release下有所区别)

原始出处:http://blog.sina.com.cn/s/blog_6f7265cf0101nsob.html


配置环境:vs2013(64位)+OpenCV 2.4.8+win8.1(64位)

OpenCV安装路径:C:\Users\zhangzhizhi\Documents\Everyone\张志智\总结积累\OpenCV\opencv为例
 
1.环境变量:
C:\Users\zhangzhizhi\Documents\Everyone\张志智\总结积累\OpenCV\opencv\build\x64\vc12\bin;
2.包含目录:
C:\Users\zhangzhizhi\Documents\Everyone\张志智\总结积累\OpenCV\opencv\build\include;
3.包含库目录:
C:\Users\zhangzhizhi\Documents\Everyone\张志智\总结积累\OpenCV\opencv\build\x64\vc12\lib;
4.链接器->输入(Debug下,若为Release去掉所有的’d’;当然也可以把两种都加入,以免两种模式切换配置麻烦):
opencv_calib3d248d.lib
opencv_contrib248d.lib
opencv_core248d.lib
opencv_features2d248d.lib
opencv_flann248d.lib
opencv_gpu248d.lib
opencv_highgui248d.lib
opencv_imgproc248d.lib
opencv_legacy248d.lib
opencv_ml248d.lib
opencv_objdetect248d.lib
opencv_ts248d.lib
opencv_video248d.lib
opencv_nonfree248d.lib
5.示例程序:
用OpenCV实现SIFT特征的提取
#include “stdio.h”
#include “iostream”
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/nonfree/features2d.hpp"
#include “vector”
#include “fstream”
#include “AFXWin.h”
#include “comdef.h”
 
using namespace cv;
using namespace std;
 
void readme();
 
 
string ws2s(const wstring& ws)
{
    _bstr_t t = ws.c_str();
    char* pchar = (char*)t;
    string result = pchar;
    return result;
}
 
int main(int argc, char** argv)
{
    CFileFind finder;
    BOOL bWorking = finder.FindFile(L"C:\\Users\\zhangzhizhi\\Pictures\\国旗\\普通\\*.png");
    DWORD selectionBeforeTime = ::GetTickCount();
    if (bWorking)
    {
        bWorking = finder.FindNextFile();
        CString sFileName = finder.GetFilePath();
        Mat img = imread(ws2s(sFileName.GetString()));
        SiftFeatureDetector detector;
        vector<</SPAN>KeyPoint> keypoints;
        detector.detect(img, keypoints);
        SiftDescriptorExtractor extractor;
        Mat descr;
        extractor.compute(img, keypoints, descr);
 
        ofstream ofile;
        int n = sFileName.Replace(L".png", L".txt");
        ofile.open(ws2s(sFileName.GetString()));
        ofile << format(descr, "csv");
        ofile.close();
    }
    finder.Close();
    DWORD predictionBeforeTime = ::GetTickCount();
    DWORD selectionSpeed = predictionBeforeTime - selectionBeforeTime;
    cout << "用时:" << selectionSpeed*1.0 / 1000 << "s" << endl;
    return 0;
}
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值