BingObjectnessCVPR14源码编译环境由vs2012+64位转换为vs2012+32位机过程

来源:互联网 发布:p2p网络信贷风险准备金 编辑:程序博客网 时间:2024/05/16 00:33

一、版本转换

1.将源码中vs2012版本转换为vs2010版本。

 

二、在vs编译环境中,openmp环境配置。

1.ConfigurationProlperties->c/c++->Language->Open MP Support->Yes

 

三、用_popcnt函数实现_popcnt64函数功能,需要自己动手在INT64类型基础上写函数。要加头文件#include<intrin.h>在stdafx.h中。

inline INT64 __popcount64(INT64x)

{

       return __popcnt((unsignedint)(x )) +__popcnt((unsignedint)(x>> 32));

}

四、在LibLinear工程中编译生成LibLinear.lib文件,具体如下:

1. objectness下的properties->general->linker->linklibrary dependency 后面改成yes

2.在linear.cpp中函数voidset_print_string_function(void(*print_func)(const char*))前加入extern “c”;

3.build Liblinear工程,然后在ConfigurationProperties->Linker->General->Additional Library Directories中添加LibLinear.lib所在的位置路径。

五、Debugging information *.exe cannot be found or does not match(C++不能调试解决方法)

用这个方法,摘自某英文论坛

To enable debugging: 
1) Goto Project->HelloWorld Properties 
2) On the left expand "Configuration Properties" 
3) Expand "C/C++" 
4) On the left, Select "General" 
5) On the right, change "Debug Information Format" to "ProgramDatabase For Edit And Continue (/ZI)" 
5) On the left, Select "Optimization" 
6) On the right, change "Optimization" to "Disabled (/Od)" 
7) On the left, expand "Linker" 
8) On the left, select "Debugging" 
9) On the right, change "Generate Debug Info" to "Yes" 
10) Click ok 
11) Set your breakpoints 
12) Rebuild your application

六、代码中Mat无法解析问题

1.具体原因暂时无法知道,可能是opencv中Mat_对INT64(unsignedlong long)类型的支持问题,可以用以下matchTemplate()函数替换FilterTIP.cpp文件中的matchTemplate原函数。

引用:(http://www.cvchina.info/2014/02/25/14cvprbing/comment-page-5/#comment-7391)中第16楼上的Liuyu.

void FilterTIG::matchTemplate(const Mat &mag1u, Mat &matchCost1f){const int H = mag1u.rows, W = mag1u.cols;const Size sz(W+1, H+1); // Expand original size to avoid dealing with boundary conditionsMat_<float> scores(sz);// @ 2013.3.22 by ly;const int sizeSZ = sz.width * sz.height;INT64 * Tig1 = (INT64 *)malloc(sizeSZ * sizeof(INT64));INT64 * Tig2 = (INT64 *)malloc(sizeSZ * sizeof(INT64));INT64 * Tig4 = (INT64 *)malloc(sizeSZ * sizeof(INT64));INT64 * Tig8 = (INT64 *)malloc(sizeSZ * sizeof(INT64));byte * Row1 = (byte *)malloc(sizeSZ * sizeof(byte));byte * Row2 = (byte *)malloc(sizeSZ * sizeof(byte));byte * Row4 = (byte *)malloc(sizeSZ * sizeof(byte));byte * Row8 = (byte *)malloc(sizeSZ * sizeof(byte));memset(Tig1, 0, sizeSZ * sizeof(INT64)); memset(Tig2, 0, sizeSZ * sizeof(INT64));memset(Tig4, 0, sizeSZ * sizeof(INT64)); memset(Tig8, 0, sizeSZ * sizeof(INT64));memset(Row1, 0, sizeSZ * sizeof(byte)); memset(Row2, 0, sizeSZ * sizeof(byte));memset(Row4, 0, sizeSZ * sizeof(byte)); memset(Row8, 0, sizeSZ * sizeof(byte));for (int y=1; y<= H; y++){const byte * G = mag1u.ptr(y-1);INT64 * T1 = Tig1 + y*sz.width;INT64 * T2 = Tig2 + y*sz.width;INT64 * T4 = Tig4 + y*sz.width;INT64 * T8 = Tig8 + y*sz.width;INT64 * Tu1 = Tig1 + (y-1)*sz.width;INT64 * Tu2 = Tig2 + (y-1)*sz.width;INT64 * Tu4 = Tig4 + (y-1)*sz.width;INT64 * Tu8 = Tig8 + (y-1)*sz.width;byte * R1 = Row1 + y*sz.width;byte * R2 = Row2 + y*sz.width;byte * R4 = Row4 + y*sz.width;byte * R8 = Row8 + y*sz.width;float *s = scores.ptr<float>(y);for (int x=1; x<= W; x++){byte g = G[x-1];R1[x] = (R1[x-1] << 1) | ((g >> 4) & 1);R2[x] = (R2[x-1] << 1) | ((g >> 5) & 1);R4[x] = (R4[x-1] << 1) | ((g >> 6) & 1);R8[x] = (R8[x-1] << 1) | ((g >> 7) & 1);T1[x] = (Tu1[x] << 8) | R1[x];T2[x] = (Tu2[x] << 8) | R2[x];T4[x] = (Tu4[x] << 8) | R4[x];T8[x] = (Tu8[x] << 8) | R8[x];s[x] = dot(T1[x], T2[x], T4[x], T8[x]);}}free(Tig1);free(Tig2);free(Tig4);free(Tig8);free(Row1); free(Row2); free(Row4); free(Row8);scores(Rect(8, 8, W-7, H-7)).copyTo(matchCost1f);}


0 0
原创粉丝点击