
C++
文章平均质量分 54
丁路人
这个作者很懒,什么都没留下…
展开
-
诡异的VideoCapture
#include "opencv2/opencv.hppusing namespace cv;using namespace std;int main( int argc, char** argv ){ Mat background; Mat frame; int delay = 1; VideoCapture captRefrnc(0原创 2012-10-29 16:10:56 · 881 阅读 · 0 评论 -
Johnson's Algorithm
#ifndef DIJKSTRA_H#define DIJKSTRA_H#include #include #include using namespace std;typedef struct{ int head; int tail; int cost;} Edge;void Dijkstra(vector &E, vector> &Vtail, int nV,原创 2015-04-26 15:45:38 · 2340 阅读 · 0 评论 -
Knapsack-Dynamic Programming
#include #include #include #include using namespace std;typedef struct{ int v; int w;} Item;int Knapsack(vector &items, int size, int numItems){ int** A = new int*[numItems+1];原创 2015-04-12 21:44:00 · 881 阅读 · 0 评论 -
Max space clustering (Hamming)
In this question your task is again to run the clustering algorithm from lecture, but on a MUCH bigger graph. So big, in fact, that the distances (i.e., edge costs) are only defined implicitly, rather原创 2015-04-06 22:01:26 · 1027 阅读 · 0 评论 -
Max-Spacing k-clustering
这里主要用到的知识点是Union-find数据结构:In this programming problem and the next you'll code up the clustering algorithm from lecture for computing a max-spacing k-clustering. Download the text file here. This fi原创 2015-04-06 21:54:24 · 1811 阅读 · 0 评论 -
临时添加环境变量
一、在VC2010里面添加环境变量参考【1】中给出了5种方法:1. 直接添加到系统的 PATH 变量里: 这个方法最简单,也最直接,但是坏处是会影响全局的 PATH 设置,尤其是你包含着大量测试用的dll 时。2. 在 Visual Studio 全局设置里,把 dll 所在目录添加到 PATH 里: 通过 Visual Studio 菜单 ==> 工具 ==>原创 2015-03-17 20:49:02 · 3013 阅读 · 0 评论 -
Prim's minimum spanning tree algorithm
#include #include #include #include #include using namespace std;typedef struct{ int head; int tail; int cost;} Edge;int heap[3000];int prior[3000];int heapSize = 0;int id2Pos[3000];原创 2015-03-23 20:25:04 · 813 阅读 · 0 评论 -
error MSB8013: 此项目不包含配置和平台组合 Debug|Win32
原来根据【2】:When building a project that has dependencies on other projects, an error occurs if one of the dependent projects do not contain a configuration named "Debug".这个是因为没有添加它所依赖的工程。参考:【1】原创 2015-03-17 22:55:34 · 9718 阅读 · 0 评论 -
MinGw以及临时加路径
Min 的管理工具路径为:C:\MinGW\libexec\mingw-get\guimain.exe按照参考[2]中在MinGw文件夹下新建一个_Start_apo.bat,这样可以临时向系统变量里面添加路径之后在代码所在的文件夹下面,新建一个快捷方式,在在键入项目的位置中输入以下内容:%SystemRoot%\system32\cmd.exe /K C:\MinGW\_原创 2015-01-28 12:28:57 · 2563 阅读 · 0 评论 -
Cmake+OpenCV 2
接着上面,在CMake之后,进行程序的编译:结果出现了14个错误:其中的错误为:34>d:\program files\opencv_3.0\sources\modules\opencv_contrib-master\modules\line_descriptor\src\bitops.hpp(104): error C2059: syntax error : 'bad原创 2015-06-08 17:24:28 · 1648 阅读 · 1 评论 -
Cmake+Opencv 1
【1】Compiling OpenCV-3.0 with Matlab Support http://seevisionc.blogspot.com/2014/03/compiling-opencv-30-with-matlab-support.html【1】Windows下利用CMake和VS2013编译OpenCV http://www.nmtree.net/2014/03/19/wind原创 2015-06-08 16:15:01 · 1068 阅读 · 0 评论 -
关于“(”:“::”右边的非法标记
今天在用Matlab 2016+VS2013编译matconvnet-1.0-beta21时,vl_imreadjpeg.cpp函数中出现“(”:“::”右边的非法标记错误:根据[1],错误产生的原因是函数模板max与Visual C++中的全局的宏max冲突,最简单的办法是在编译mex时,添加选项 '-DNOMINMAX'命令。所以在后面的选项中添加改选项:但由于将Vis原创 2016-09-16 17:20:51 · 4531 阅读 · 0 评论 -
基于排列的数列顺序对
题目描述:洋洋的作业本上有一个长度为n的排列A,这个排列包含了从1到n的n个数,但是因为一些原因,其中一些位置(不超过10个)看不清了,但是洋洋记得这个数列顺序对的数量为k,顺序对是指满足i输入描述:每个输入包含一个测试用例。每个测试用例的第一行包含两个整数n和k(1 输出描述:输出一行表示合法的排列数目。输入例子:5 54 0 0 2 0原创 2016-08-02 22:21:19 · 1683 阅读 · 10 评论 -
基于组合的分田地
题目描述:洋洋和15个朋友来玩打土豪分田地的游戏,洋洋决定让你来分田地,地主的田地可以看成是一个矩形,每个位置有一个价值,分割田地的方法是横竖各切三刀,分成16份,作为领导干部,洋洋总是会选择其中价值最小的一份田地,作为洋洋最好的朋友,你希望洋洋取得的田地价值和尽可能大,你知道这个值最大可以是多少吗?输入描述:每个输入包含1个测试用例。每个测试用例的第一行包含两个整数n和m(1原创 2016-08-03 09:28:33 · 1251 阅读 · 6 评论 -
Error: HEAP CORRUPTION DETECTED
产生堆内存的错误,调试是参考[1],在头文件加上:#define CRTDBG_MAP_ALLOC#include 在调试的代码处加上:_ASSERTE(_CrtCheckMemory());输入是参考上一篇(http://blog.youkuaiyun.com/lsxpu/article/details/52100370)6 6323212323312333原创 2016-08-08 10:59:24 · 656 阅读 · 0 评论 -
判断一个字符串是否为另外一个字符串的子串
#include#includeusing namespace std;bool checkchild(string &s, string &t){ int j = 0; for (int i = 0; i < t.size(); i++) { while (j < s.size() && t[i] != s[j]) j++; if (j == s.size()原创 2016-08-02 21:57:08 · 6899 阅读 · 4 评论 -
使用MinGW编译Efficient graph-based image segmentation
1. 首先下载MinGW-w64[1],一路安装下来,并不知道是否设置了环境变量:编写一个简单的程序实验一下,同时用cmd命令重新开了一个窗口,也可以运行出结果:2. 编译Efficient graph-based image segmentation根据其提供的Makefile:INCDIR = -I.DBG = -gOPT = -O3CPP原创 2015-10-06 15:40:27 · 1138 阅读 · 0 评论 -
CLAPACK
根据[1]中的指示进行编译:全部过程采用默认,在第3步时,有一堆warning,接下来的编译都正确,但到第7步时,test产生了很多的error:不知道这些error对自己的实验有影响没,参考:【1】http://icl.cs.utk.edu/lapack-for-windows/clapack/#libraries原创 2015-09-05 17:30:15 · 680 阅读 · 0 评论 -
Bing2014CVPR在win32上面运行
环境为:win7+VC2013设置调试环境为:DeBug设置(1)设置LibLinear属性页面:之后进行编译,会在E:\code\download\CmCode-master\Debug文件夹下产生一个LibLineard.lib文件2. 设置Objectness,将它设置为启动项目,之后需要去VC++目录下面配置Opencv,详见【】,但在链接器中不需要配置Open原创 2015-03-17 15:53:06 · 1295 阅读 · 0 评论 -
在mfc中用opencv显示视频
在mfc中用opencv显示视频为:while(pFrame=cvQueryFrame(pCapture)) { DrawPicToHDC(pFrame, IDC_STATIC); cvShowImage("Show",pFrame); if(cvWaitKey(33)>0) break; }但如果将cvShowImage("Show", pFrame)注释掉原创 2015-03-05 19:52:05 · 1509 阅读 · 0 评论 -
MENU可重用的子系统
/**************************************************************************************************//* Copyright (C) mc2lab.com, SSE@USTC, 2014-2015 *原创 2015-01-18 22:37:55 · 601 阅读 · 0 评论 -
the cmd of OpenCV and C++
这个主要记录自己看到的OpenCV和MSDN函数:OpenCV:【1】BackgroundSubtractorMOGMSDN:【1】GetPrivateProfileInt原创 2014-03-24 16:05:44 · 1058 阅读 · 0 评论 -
Failure during conversion to COFF: file invalid or corrupt
参考:【1】【error】LINK1123: failure during conversion to COFF: file invalid or corrupt原创 2014-04-20 12:19:11 · 1323 阅读 · 0 评论 -
C++ error: 无法启动此程序,因为计算机丢失liblas.dll
产生的错误如下:错误的原因应该是计算机找不到这个liblas.dll,解决的办法参考【1】,首先将该liblas.dll所在的路径加到Path的环境变量里面,然后加倒VC++目录中的可执行文件目录:程序就可以运行了参考:【1】VC 2010下安装OpenCV2.4.4 http://wiki.opencv.org.cn/index.php/VC_2010%E原创 2014-02-27 20:46:56 · 2788 阅读 · 0 评论 -
Error: QWidget: Cannot create a QWidget without QApplication
自己在新建QT工程时,没有选择Qt Widgets应用,而是选择Qt 控制台程序:(现在还不清楚这些具体各个应用程序的区别)结果自己在建主窗口程序时,出现下面的错误(QWidget: Cannot create a QWidget without QApplication):产生这个错误的原因是这个QWidget 是建立在QApplication 上的,(From th原创 2014-01-04 11:50:27 · 16833 阅读 · 1 评论 -
win32控制台程序读取access
因为自己觉得新建一个MFC工程太复杂,就在win32控制台下,读取access数据库,这篇主要是记录自己在写这个程序时,遇见的问题:(vs2010 + access2007)(1)首先在stdafx.h文件后面加上#import "c:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF",原创 2014-01-03 15:43:46 · 2265 阅读 · 0 评论 -
Error: Cannot find or open the PDB file
想用vs2010+opencv2.4.4做一下grabcut实验,结果出现下面的错误:Cannot find or open the PDB file参考【1】是参考【2】的总结,它给出了几种解决办法,最简单的两种方法是Ctrl + F5或加一个断点就可以运行了。【1】Cannot find or open the PDB file http://blog.163.com/ch原创 2013-10-16 16:25:43 · 1502 阅读 · 0 评论 -
The MFC error(1)
这一篇主要是记录自己在编写MFC(Opencv 2.3.1 + VS2010)程序,出现的错误:【1】 VS2010 的问题 MFC 中 MessageBox()用法 http://zhidao.baidu.com/question/421081367.html(改一下unicode编码就行了,用AfxMessageBox("提示")比较好)【2】图像在MFC中的显示http://blog原创 2012-11-07 20:00:53 · 604 阅读 · 0 评论 -
Error: no matching symbolic information found
下载别人的vc6.0程序,出现这个错误,不过解决方法很简单,删除debug文件夹,就没有错误提示了。参考:http://topic.youkuaiyun.com/u/20091117/14/3216b6c9-616b-42a3-919a-57fbad79e899.html原创 2012-10-25 09:31:19 · 3360 阅读 · 1 评论 -
收集一些知乎上好的帖子
【1】 如何更深入地学习 Linux?原创 2014-06-16 23:11:24 · 2065 阅读 · 0 评论 -
MinCut
The file contains the adjacency list representation of a simple undirected graph. There are 200 vertices labeled 1 to 200. The first column in the file represents the vertex label, and the particular原创 2014-11-08 16:55:08 · 1360 阅读 · 0 评论 -
可重用的链表模块来实现命令行菜单小程序
/**************************************************************************************************//* Copyright (C) LS, 2014-2015 *原创 2014-12-28 20:07:55 · 1280 阅读 · 0 评论 -
callback增强链表模块
/********************************************************************//* Copyright (C) SSE-USTC, 2012-2013 *//*原创 2015-01-10 17:05:23 · 1014 阅读 · 0 评论 -
Median Maintenance
The goal of this problem is to implement the "Median Maintenance" algorithm (covered in the Week 5 lecture on heap applications). The text file contains a list of the integers from 1 to 10000 in uns原创 2014-11-30 10:09:22 · 1115 阅读 · 0 评论 -
2-SUM algorithm
The goal of this problem is to implement a variant of the 2-SUM algorithm (covered in the Week 6 lecture on hash table applications).The file contains 1 million integers, both positive and negat原创 2014-11-30 10:29:10 · 1365 阅读 · 0 评论 -
Dijkstra's algorithm
#include #include #include #include #include #include using namespace std;int heap[1000];int prior[1000];int heapSize = 0;//int pos2Id[1000];int id2Pos[1000];bool boolX[1000];void Inse原创 2014-11-24 14:56:46 · 1298 阅读 · 0 评论 -
深度搜索的变形
题目:题目分析,原创 2014-09-24 17:47:40 · 918 阅读 · 0 评论 -
寻找相反的个数
比如对于: 3 5 4 6 1 2中与i<j,a[i] < a[j]原创 2014-10-27 12:38:07 · 900 阅读 · 0 评论 -
Quicksort
#include #include #include using namespace std;void PivotRules(int *arr, int n, int method){ switch (method) { case 1: { // ----- select the first element ------ break; } case 2:原创 2014-11-02 20:47:01 · 682 阅读 · 0 评论 -
堆棋子
题目描述:小易将n个棋子摆放在一张无限大的棋盘上,第i个棋子放在第x[i]行y[i]列。同一个格子允许放置多个棋子。每一次操作小易可以把一个棋子拿起并将其移动到原格子的上、下、左、右的任意一个格子中。小易想知道要让棋盘上出现一个格子至少有i(1输入描述:输入包括三行,第一行一个整数n(1第二行为n个棋子的横坐标x[i](1第三行为n个棋子的纵坐标y[i](1原创 2017-08-12 22:31:21 · 1037 阅读 · 4 评论