- 博客(32)
- 资源 (28)
- 收藏
- 关注
原创 Combination Sum
题目描述: 给定一个包含多个正数的set容器和目标值target,从set中找出sum等于target的组合,同样的数可以使用多次。例如 set 为 [2,3,6,7]并且target为7,结果为 [7] [2,2,3].分析:我们先将集合排序,将sum初始化为0,从最小的数开始,将其加到sum上,并存入容器mid保存,将sum与target比较,小于target递归此操作,等于target则将m
2015-07-09 23:32:52 633
原创 LeetCode的medium题集合(C++实现)十七
1 Partition List Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the nod
2015-05-30 18:56:28 486
原创 DirectX实现光照、纹理
关照的种类 环境光:经其他表面反射到达物体 漫射光:沿特定方向传播,到达某一表面后向各个方向均匀传播 镜面光:光线向同一方向反射(能模拟高亮点) directx在通过如下函数设置光照: 光源的种类 点光源:有固定位置,并向各个方向发射 方向光:没有位置信息,所以光相互平行沿一特定方向传播 聚光灯:有位置信息,向手电筒一样发出锥形光,向特定方向传播D3DXVECTOR3 dir(1.0
2015-05-30 16:44:58 1333
原创 LeetCode的medium题集合(C++实现)十六
1 Remove Duplicates from Sorted Array II Follow up for “Remove Duplicates”:What if duplicates are allowed at most twice?For example,Given sorted array nums = [1,1,1,2,2,3], Your function should retu
2015-05-29 11:08:55 576
原创 Didectx的简单画图
Directx通常采用顶点缓存和顶点索引缓存来绘制图形,使用函数CreateVertexBuffer和CreateIndexBuffer来分别创建顶点缓存和顶点索引缓存,为了访问顶点缓存和顶点索引缓存中的内容,采用Lock方法来获取指向缓存内容的指针。 绘制之前的准备步骤: (1) 使用SetStreamSource函数将顶点缓存中的内容绑定到数据流输入源中。 (2) 使用SetFVF函数设置
2015-05-28 13:37:38 756
原创 LeetCode的medium题集合(C++实现)十五
1 Subsets Given a set of distinct integers, nums, return all possible subsets. Note: Elements in a subset must be in non-descending order. The solution set must not contain duplicate subsets. For
2015-05-28 10:52:19 925
原创 cocos2d-x中的精灵类
在cocos2d-x中,精灵处理有关的类共有4个: 精灵类CCSprite、精灵批处理类CCSpriteBatchNode、精灵帧类CCSpriteFrame和精灵帧缓存类CCSpriteFrameCache在精灵类CCSprite中,创建精灵的方式有:static Sprite* create(const std::string& filename);static Sprite* create
2015-05-26 21:28:56 551
原创 LeetCode的medium题集合(C++实现)十四
1 Sort Colors Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use th
2015-05-26 09:54:45 603
原创 LeetCode的medium题集合(C++实现)十三
Set Matrix Zeroes Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. 因为没有额外的空间,我们可以采用第一个0元素所在的行和列来保存0元素的信息。void setZeroes(vector<vector<int>>& matrix) {
2015-05-25 11:26:36 551
原创 LeetCode的medium题集合(C++实现)十二
1 Sqrt(x) Implement int sqrt(int x).Compute and return the square root of x. 因为这里都是整数,可以直接采用二分法求解int mySqrt(int x) { if (x <= 1) return x; int begin = 1, end =x, mid = 0; while (begin
2015-05-24 11:41:43 643
原创 DirectX学习记录
1 环境安装 下载DirectX10按提示安装,我的安装路径为C:\Program Files\Microsoft DirectX SDK (June 2010)。在vs2013中建立一个空白的win32应用程序。在项目属性中设置: 包含目录 C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include 库目录
2015-05-23 12:48:20 590
原创 LeetCode的medium题集合(C++实现)十一
1 Unique Paths A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below).The robot can only move either down or right at any point in time. The robot is trying t
2015-05-23 10:16:29 648
原创 LeetCode的medium题集合(C++实现)十
1 Permutation Sequence The set [1,2,3,…,n] contains a total of n! unique permutations.Given nn and kk, return the kthk^{th} permutation sequence. 使用Next Permutation循环k次可以得到序列,但leetcode上提交会出现时间超过限制。下
2015-05-22 11:21:01 648
原创 LeetCode的medium题集合(C++实现)九
1 Jump Game Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determ
2015-05-21 11:23:48 594
原创 LeetCode的medium题集合(C++实现)八
1 Pow(x, n) 该题采用二分法进行递归double myPow(double x, int n) { if(n==0) return 1; if(n<0) { n=(-n); x=1/x; } double res=myPow(x,n/2); i
2015-05-19 10:44:29 542
原创 LeetCode的medium题集合(C++实现)七
1 Rotate Image You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise). 对于 n x n 的矩阵按顺时针旋转90度,相当于先将矩阵上下翻转,然后将矩阵装置。void rotate(vector<vector<int>>& matrix) {
2015-05-18 11:16:29 706
原创 LeetCode的medium题集合(C++实现)六
1 Multiply Strings Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-negative. 该题实际就是利用字符串来解决大数的乘法问题。为了
2015-05-17 15:43:28 596
原创 LeetCode的medium题集合(C++实现)五
1 Combination Sum Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same repeated number may be chosen from C
2015-05-16 10:33:07 645
原创 LeetCode的medium题集合(C++实现)四
1 Next Permutation Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the
2015-05-14 10:59:48 570
原创 LeetCode的medium题集合(C++实现)三
1 4Sum Given an array SS of nn integers, are there elements a,b,c,da, b, c, d in SS such that a+b+c+d=targeta + b + c + d = target ? Find all unique quadruplets in the array which gives the sum of t
2015-05-14 10:00:55 613
原创 LeetCode的medium题集合(C++实现)二
1 Integer to Roman Given an integer, convert it to a roman numeral. 根据罗马数字的定义规范,3999以内的整数可以由如下罗马数字组合: "M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I""M", "CM", "D", "CD", "C", "XC", "L", "
2015-05-10 11:21:16 371
原创 LeetCode的medium题集合(C++实现)一
1.Two Sum Given an array of integers, find two numbers such that they add up to a specific target number.You may assume that each input would have exactly one solution. For example:Input: numbers=2,
2015-05-04 10:49:31 411
原创 五子棋中的人工智能(一):局面估计
1.局面情况 眠二,眠三,冲四,活二,活三,活四,五连,双四,四三,三三。 其中眠二表示有两个相连的棋子,有一边被堵,眠三跟冲四也是如此。活三表示三个相连的棋子(或两个相连空一格后再连一棋子)没被堵。双四表示两个四子相连,三三表示两个活三。因为先手必胜,一般比赛时黑子有禁手,包括双四禁;三三禁;四三三禁手,即黑方一步使一个四,两个活三同时形成 ;四四三禁手,即黑方一步使两个四,一个活三同时形成
2015-05-03 15:45:12 2319
原创 LeetCode的easy题集合(C++实现)四
1.Merge Two Sorted Lists Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.ListNode *mergeTwoLists(ListNode
2015-05-03 11:17:30 425
原创 LeetCode的easy题集合(C++实现)三
1.Merge Sorted Array Given two sorted integer arrays A and B, merge B into A as one sorted array.void merge(int A[], int m, int B[], int n) { while(m>0&&n>0) { if(A[m-1]>B
2015-05-03 09:59:53 348
原创 LeetCode的easy题集合(C++实现)二
1.Intersection of Two Linked ListsWrite a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A:
2015-05-02 09:19:59 507
原创 LeetCode的easy题集合(C++实现)一
1.Happy NumberA happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process un
2015-04-28 09:14:14 796
转载 目标检测的图像特征提取之(一)HOG特征
1、HOG特征: 方向梯度直方图(Histogram of Oriented Gradient, HOG)特征是一种在计算机视觉和图像处理中用来进行物体检测的特征描述子。它通过计算和统计图像局部区域的梯度方向直方图来构成特征。Hog特征结合SVM分类器已经被广泛应用于图像识别中,尤其在行人检测中获得了极大的成功。需要提醒的是,HOG+SVM进行行人检测的方法是法国研究人员Dal
2014-09-12 20:17:13 506
原创 基于方向梯度直方图的行人检测
Dalal等提出的方向梯度直方图(HOG)是目前广泛使用的行人特征描述子。HOG刻画图像的局部梯度幅值和方向特征,基于梯度特征、对块的特征向量进行归一化处理、允许块之间相互重叠,使得对光照变化和小量的偏移有很好的鲁棒性,能有效地刻画出人体的边缘特征。
2014-09-12 11:02:06 1030
转载 LBP中等价模式即Uniform Pattern为什么是P*(P-1)+2维向量?
考察LBP算子的定义可以发现,一个LBP算子可以产生不同的二进制模式,对于LBP(R,P)将会产生2P种模式。显然,随着领域集内采样点数的增加,二进制模式的种类是急剧增加的。如3×3领域内8个采样点,则得到28种二进制模式;5×5领域内20个采样点,有220=1,048,576种二进制模式;7×7的领域内有36个采样点,则二进制模式的种类达到236,约为687×1010。显然,如此多的二值模式无论
2014-09-11 10:30:53 759
原创 LBP的c++实现
LBP的计算结果如下:(1) 将检测窗口切分为区块(cells,例如,每个区块 16x16 像素)。(2) 对区块中的每个像素,与它的八个邻域像素进行比较(左上、左中、左下、右上等)。可以按照顺时针或者逆时针的顺序进行比较。(3) 对于中心像素大于某个邻域的,设置为 1;否则,设置为 0。这就获得了一个 8 位的二进制数(通常情况下会转换为十进制数字),作为该位置的特征,计
2014-09-11 08:54:29 2114
原创 每日学习记录
一:论文Edge Detection of Image on the Local Feature 的学习1.获取局部邻域特征在图像中的同一物体上,他的局部邻域像素是平滑连续的,用下式表示: 重构 该函数:K(x,y)为惩罚因子,因为像素满足高斯分布,所以选高斯算子利用最小二乘法求a,b,c。a作用于像素平均值,b,c分别作用于水平与垂直方向亮度变化2.边缘点的估
2013-09-16 22:16:40 665
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人