
codes
lcmssd
这个作者很懒,什么都没留下…
展开
-
stl sort 涉及相等的元素可能导致core
参考网址: http://blog.sina.com.cn/s/blog_79d599dc01012m7l.html解决方法复制于此:一、问题std::sort()在排序的时候,如果对排序中的仿函数对相等的值返回true,会导致程序core掉。二、解决办法让比较函数对相等的值返回false...转载 2018-03-21 09:45:25 · 1237 阅读 · 1 评论 -
Eigen for pinv
BLAS => Blasc Linear Algebra Subprograms#include #include "Eigen/SVD"using namespace std;using namespace Eigen;typedef JacobiSVD XF_SVD;void pinv(MatrixXf& MatIn, M转载 2015-01-14 12:50:55 · 1724 阅读 · 0 评论 -
python计算阶乘
N = 10, reduce(lambda x,y:x*y, range(1,N+1))N的阶乘reduce: reduce(FuncA, SeqB), FuncA是一个两输入一输出的函数, SeqB是一个可以iterate的结构, reduce把FuncA从左到右依次作用在SeqB上,这样最终得到一个值lambda:快递定义单行函数的方法转载 2015-01-11 14:06:06 · 1305 阅读 · 0 评论 -
遗忘症
有时提示找不到函数, 比如_imp_func()文件前缀_imp暗示函数声明时有dllimport修饰转载 2014-06-14 21:41:36 · 355 阅读 · 0 评论 -
消除fscanf()读取float误差
float fValue;char zsTmp[100];fscanf(hFile, "%f", &fValue);//如此fValue读取出来会有一定误差fscanf(hFile, "%s", zsTmp);fValue = atof(zsValue);//误差要小很多另外C++的fstream也可以减少误差转载 2014-06-14 21:38:43 · 1888 阅读 · 0 评论 -
R语言备忘
1. 加载csv read.csv() 2. 查看数据 head(), tail() 3. package install/usage 从菜单安装, 用library()加载 4. 转换成factor as.factor() 5. 查看是否是factor is.factor() 6. 关于脚本转载 2014-07-13 22:22:01 · 1141 阅读 · 0 评论 -
GDI+
OpenCV自身不支持在图像上显示中文字符, GDI+是一个可选的替代方案,以下是把IplImage数据导入GDI+ voidDrawTextOnIplImage(IplImage *pIplImg, WCHAR *szText, int nTextLeft,int nTextTop, int nFontSize){ BITMAPINFOstInfo; stIn转载 2014-06-14 21:39:59 · 472 阅读 · 0 评论 -
基于 minidom的python xml操作
import xml.dom.minidom as minidom转载 2014-09-10 22:49:11 · 644 阅读 · 0 评论 -
matlab调用c dll
matlab可以直接调用dll,但是需要对dll头文件做修改,此处考虑使用mexFunction()作为中介,避免修改dll头文件1. 编写mex文件,调用dll接口2. mex编译mex文件, 和gcc类似,支持设置头文件搜索目录和库文件搜索路径,如下在当前目录下搜索x.lib库(动态库lib和dll文件都需要) mex mexFile.cpp -L./ -lxPS: 有时重转载 2014-08-02 19:56:28 · 1175 阅读 · 0 评论 -
matlab cell无法扩展的问题求解:
预分配足够大的内存,最后删除空的cell, 以下的代码可以删除空的cell ind = find((~cellfun('isempty', vImg)) == 1); vImg = vImg(ind);转载 2014-08-02 19:54:56 · 657 阅读 · 0 评论 -
matlab中关闭特定的warning
%get message id by warning('query', 'last') after the warning coming outwarning('off', 'MATLAB:imagesci:jpg:libraryMessage');转载 2014-08-02 19:53:52 · 3355 阅读 · 0 评论 -
python dictionary的使用
#遍历目录,打印文件重复数目,并排序import osimport sysimport stringfrom operator import itemgetterdef stat(pathname): dict = {"null":0} dict.clear() for root, dirs, files in os.walk(pa转载 2014-12-26 12:51:03 · 402 阅读 · 0 评论 -
python opencv
import cv2import numpy as npimg = cv2.imread('dog.jpg')#print img.shape[1]scaled = cv2.resize(img, (img.shape[1]/3, img.shape[0]/3))for y in range(scaled.shape[1]/2): fo转载 2014-12-26 13:17:54 · 604 阅读 · 0 评论 -
local git
1. 创建bare库 git init -bare xxx.git 1) bare库不会存储working tree(即仅有配置文件),容易共享,否则容易提交时发生冲突 2) 库用.git结束只是一种惯例2. clone it git clone repo/xxx.git ./working 1)从版本库中clone出xxx.git,到本地目转载 2015-07-09 18:44:34 · 526 阅读 · 0 评论 -
linux处理dll hell的机制
1. 共享库命名以libmath.so.1.2.3, 其中1是主版本号, 2是小版本号,3是build号. 主版本号的修改意味着接口的变化, 小版本号和build号 的变化意味着bug fix 这个名字称为动态库的real name2. libmath.so.1这个名字,这个成为动态库的soname, 共享库build时会把soname写入共享库文件头内3. 应用程转载 2014-07-12 11:45:14 · 1093 阅读 · 0 评论 -
opencv中的HoG cascadede
opencv中的HoG cascadede是使用HoG特征,但是实际比真正的HoG特征要简化不少(HOGDescriptor中的才是完整的HoG,包括了各种normlization和overlaping)以下是HoG cascade中的一些关键点1. HoG feature由一个五元组表示(x,y,w,h,fid), 其中(x,y,w,h)表示一个矩形的1/4,而且左上角的1/4,即矩形的原创 2015-06-23 10:56:30 · 1446 阅读 · 0 评论 -
python 自制package
目录结构如下mypkg __init__.py myfile.py myfile.py 内有一个函数 myfunc()如果__init__.py 内容 如下:import myfile则使用时需要如下 调用import mypkg mypkg.myfile.myfunc()如果__init__.p转载 2015-05-06 16:53:45 · 1243 阅读 · 0 评论 -
std::fstream的中文目录问题
std::fstream无法直接处理中文目录,解决方法之一如下locale::global(locale(""))file.open("d:\\中文路径.txt");locale::global(locale("C")); //还原,否则cout有问题不过如此一来, filelocale::global(locale("",locale::all转载 2015-04-24 23:08:45 · 816 阅读 · 0 评论 -
HOGDescriptor::SetSVMDetector()
HOGDescriptor::SetSVMDetector()有些限制1. linear kernel only2. imgsize == winsize转载 2015-04-09 14:23:28 · 2948 阅读 · 2 评论 -
python 如何判断一个array是否是空?
if x is not None: #not nullelse: #null转载 2015-04-12 20:21:29 · 18071 阅读 · 1 评论 -
least square method
[ ui vi ]' = [ a1 a2; a3 a4 ]*[ xi yi ]' + [ tx ty ]' A * x = B; A = [ x1 y1 0 0 1 0; x2 y2 0 0 1 0; : : : ......…………; ..................………; xn转载 2015-02-06 22:39:17 · 424 阅读 · 0 评论 -
opencv for python
opencv : 2.3.1opencv\build\python\2.7目录下有个cv2.pyd复制到Python27\Lib\site-packages即可否则import cv2提示找不到module cv2转载 2015-01-18 14:26:24 · 457 阅读 · 0 评论 -
并行开发
openmp: 需要编译器支持,不过主流的编译器都支持, vs直接在工程中开启openMP支持即可TBB: intel推出的并行开发工具, thread building blockopencl: 免费的标准似乎openmp入手比较简单些转载 2015-01-15 21:06:06 · 370 阅读 · 0 评论 -
fatal error C1047 解决方法
project属性->General->Project Defaults分栏下的 Whole Program Optimization 由 Use Link Time Code Generation 改为No Whole Program Optimization 即可转载 2014-08-02 19:51:23 · 2645 阅读 · 0 评论 -
matlab 中 train和adapt的区别
train()就是batch-trained method, 而adapt()是针对序列样本, 比如两个样本集{1,2,3,4,55}和{1,2,55,3,4},用train()训练结果应该是相似的, 但用adapt()训练结果却又较大差异, 因为adapt()认为样本分布会随着时间而变化,另外adapt()没有所谓的训练完成, 它在的预测和训练过程是同步的, 即adapt()是一个onl转载 2014-08-02 19:54:25 · 1404 阅读 · 0 评论 -
stringstream清空缓存
stringstream::clear()只是清空状态,不释放缓存正确方法stringstreamstream;stream.str("");stream.clear()原创 2014-06-14 21:37:10 · 545 阅读 · 0 评论 -
error C2859 the precompiled head…
REFerror C2859: XXX/debug/vc90.pdb is not the pdb file that was usedwhen this precompiled header was created, recreate the precompiledheader.error C2859: XXX/debug/vc90.idb is not the idbfile原创 2014-06-14 21:38:02 · 696 阅读 · 0 评论 -
C++ 矩阵库 eigen
REF原创 2014-06-14 21:37:46 · 414 阅读 · 0 评论 -
我的坏习惯 or BUG
opencv 2.3.1 使用imread()时,必须版本对应,否则crash即release版使用release libdebug版使用debug lib原创 2014-06-14 21:37:15 · 406 阅读 · 0 评论 -
VC2008 下 R6030错误
REF一个解决方法,实验通过#pragma comment(linker,"\"/manifestdependency:type='Win32' name='Microsoft.VC90.CRT'version='9.0.21022.8' processorArchitecture='X86'publicKeyToken='1fc8b3b9a1e18e3b'language='*'原创 2014-06-14 21:37:08 · 1971 阅读 · 0 评论 -
VC: 多个 project configure
1. Project->PropertyPages->Configuration Manager 增加需要的工程名字 Active SolutionConfiguration Configuration 两项都可以修改 2.Project->Property Pages Configuration Properties 列表 “General”-> "Con原创 2014-06-14 21:37:01 · 382 阅读 · 0 评论 -
MD(多线程DLL)和MT(MultiThread…
MD link to MSVCR80.DLLMT link to LIBCMT.lib原创 2014-06-14 21:36:55 · 599 阅读 · 0 评论 -
INI 文件读写
GetPrivateProfileString()WritePrivateProfileString()原创 2014-06-14 21:36:11 · 494 阅读 · 0 评论 -
R6034
似乎是同时引用了不同版本的库,增加如下的代码,Copy来的,看不懂,不过确实可用#ifdef _DEBUG#pragmacomment(linker,"/manifestdependency:\"type='win32' " \ "name='"__LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' "原创 2014-06-14 21:35:40 · 681 阅读 · 0 评论 -
[ZZ]MFC 自定义消息
1. 定义全局变量或宏#define WM_MyMessage (WM_USER + n)n为数字到少大于100或者用 const UINT WM_MYMESSAGE = WM_USER + n一般可以加在stdafx.h 或resource.h 或*.app.h中。他们都是全局变量头文件所以都可以.2. 在所在类的*.H文件增加消息函数声明.protected://{{原创 2014-06-14 21:34:37 · 396 阅读 · 0 评论 -
如何正确选择Runtime library
REF工程和和其中使用的库一律采用相同的runtime libraryvc6之后取消了single thread选项在linker选项的command line增加/verbose:lib可以跟踪是加载哪一个库是出了问题原创 2014-06-14 21:37:33 · 534 阅读 · 0 评论 -
MFC 对话框背景
1. 增加bitmap资源 以import方式导入,分配ID2. 对话框初始化时,加载bitmap m_BackgroundBMP.LoadBitmap(IDB_BITMAP_WATER_BLUE_A);3. 重载OnEraseBkgnd() CDialog::OnEraseBkgnd(pDC);if(!m_BackgroundBMP.m_hObject)r原创 2014-06-14 21:37:42 · 473 阅读 · 0 评论 -
python 备忘录
python regex1. import regex2. re.compile()3. findall()4. greed/non-greed: .* vs .*?转载 2014-08-02 19:49:24 · 360 阅读 · 0 评论 -
fatal error C1900
编译64位库时发生错误:fatal error C1900: “P1”(第“20081201”版)和“P2”(第“20080116”版)之间 Il 不匹配解决方法: 替换编译器下的c2.dll转载 2014-08-02 19:49:36 · 1594 阅读 · 1 评论 -
vc反应变慢
插入/删除一行都有迟钝感, 删除ncb文件转载 2014-06-14 21:42:27 · 490 阅读 · 0 评论