发布时间:2011-11-19作者:智汇小新
【CVCORE项目】
cxmisc.h, line 125 to
#elif defined WIN32 || defined WIN64 || defined WINCE
cxswitcher.cpp,由于这个文件修改很多,所以建议从尾部往上修改,这样容易根据行数查找。
第六步line 57 to
#if defined WIN32 || defined WIN64 || defined WINCE
第五步 line 90 to
#if defined WIN32 && !defined WIN64 && !defined WINCE
第四步 line 137:
#ifndef WINCE
“HARDWARE\\DESCRIPTION\\SYSTEM\\CentralProcessor\\0\\”,
#else
L”HARDWARE\\DESCRIPTION\\SYSTEM\\CentralProcessor\\0\\”,
#endif
第三步 line 140:
#ifndef WINCE
“~MHz”,
#else
L”~MHz”,
#endif
第二步 line 435:
#ifdef WINCE
size_t origsize = strlen(name) + 1;
WCHAR wname[100];
MultiByteToWideChar(CP_ACP,0,name,origsize,wname,100);
addr = (uchar*)GetProcAddress( plugins[idx].handle, wname );
#else
addr = (uchar*)GetProcAddress( plugins[idx].handle, name );
#endif
第一步 line 600: 。..。..修改方法同line 435
cxerror.cpp line 45 to
#if defined WIN32 || defined WIN64 || defined WINCE
line 92 加入
#define TLS_OUT_OF_INDEXES ((DWORD)0xFFFFFFFF)
line with DllMain to
#if defined WIN32 || defined WIN64
BOOL WINAPI DllMain(
#ifdef WINCE
HANDLE
#else
HINSTANCE
#endif
, DWORD fdwReason, LPVOID )
a fragment in cvGuiBoxReport to
sprintf( message, “%s (%s)\nin function %s, %s(%d)\n\n”
“Press \”Abort\” to terminate application.\n”
“Press \”Retry\” to debug (if the app is running under debugger)。\n”
“Press \”Ignore\” to continue (this is not safe)。\n”,
cvErrorStr(code), err_msg ? err_msg : “no description”,
func_name, file, line );
sprintf( title, “OpenCV GUI Error Handler” );
#ifdef WINCE
WCHAR wmsg[2048];
MultiByteToWideChar(CP_ACP,0,title,strlen(message),wmsg,2048);
int answer = MessageBox( NULL, wmsg, L”OpenCV GUI Error Handler”,
MB_ICONERROR|MB_ABORTRETRYIGNORE);
#else
int answer = MessageBox( NULL, message, title,
MB_ICONERROR|MB_ABORTRETRYIGNORE|MB_SYSTEMMODAL );
#endif
cvtypes.h的#include 《emmintrin.h》的宏定义改为:
#if defined WIN32 && (!defined WIN64 || defined EM64T) &&(!defined WINCE)&& \
(_MSC_VER 》= 1400 || defined CV_ICC) \
|| (defined __SSE2__ && defined __GNUC__ && __GNUC__ 》= 4)
【CV工程】
_cvkdtree.hpp的accum_type maxvar = -std::numeric_limits 《 accum_type 》::max(); 加上#undef max
公共问题:
错误 131 error LNK2001: 无法解析的外部符号 “const type_info::`vftable‘” (??_7type_info@@6B@)
cvsmooth.obj.
引入Ccrtrtti.lib解决
工程转换
把原cv和cvcore工程直接转换为wince (PPC 2003 (ARM V4))的时候,工程--》属性--》平台--》把WIN32新建为 PPC 2003,
属性--》C/C++--》预处理器:
NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_WINDOWS;_USRDLL;CV_CE_EXPO
RTS;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE。
最好把C/C++的优化改为最大化速度(/O2),代码速度优先(/Ot)。
总结,移植opencv到wince,概括来说,只需要用宏定义设置好(区分WINCE和WIN32),以及把字符编码的转换搞定了,CV和CVCORE是很容易移植到wince的,同样道理,也可以移植到其他支持平台。不过针对运算部分的优化,就要靠用户自己了,OPENCV跨平台的时候是使用C/C++标准的Math类库。
Copyright © 2015 ilinki.net Inc. All rights reserved. 智汇工业版权所有
电话:010-62314658 邮箱:service@ilinki.net
主办单位:智汇万联(北京)信息技术有限公司