今天的风儿甚是喧嚣 JiaoPan 
  • 主页
  • 归档
  • 分类
  • 标签
  •     
leetcode(9) Array Partition I

leetcode(9) Array Partition I

difficult:easy #561Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), …, (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as possible. Example 1:Input: [1,4,3,2] Output: 4Explanation: n is 2, and the maximum sum of pairs is 4 = min(1, 2) + min(3, 4).Note:n is a positive integer, which is in the range of [1, 10000].All the integers in the array will be in the range of [-10000, 10000]. 解法: #include<vector>
 2018-07-18   leetcode    leetcode 
leetcode(8) SelfDividingNumbers

leetcode(8) SelfDividingNumbers

difficult:easy #728A self-dividing number is a number that is divisible by every digit it contains.For example, 128 is a self-dividing number because 128 % 1 == 0, 128 % 2 == 0, and 128 % 8 == 0.Also, a self-dividing number is not allowed to contain the digit zero.Given a lower and upper number bound, output a list of every possible self dividing number, including the bounds if possible. Example : Input: left = 1, right = 22 Output: [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 15, 22] Note:The boundari
 2018-07-16   leetcode    leetcode 
数字图像处理(1) 图像基础

数字图像处理(1) 图像基础

图像采样和量化 图像采样数字化坐标值称为采样,对二维空间中连续的图像在水平和垂直方向上等间距地分割成矩形网状结构,所形成的微小方格称为像素点,小方格中的值由灰度值(方格区域亮度的平均值)表示,采样的实质就是用多少个像素点来描述一幅图像.采样时,若横向的像素数(列数)为M,纵向的像素数(行数)为N,则图像总像素数为M*N个像素; 采样间隔越大,即行列数少,则图像像素数越少,空间分辨率低,质量差,严重时出现马赛克效应;采样间隔越小,即行列数大,则图像像素数越多,空间分辨率高,图像质量好,数据量大;如下图,上述采样点分别为a:1024x1024 , b:512x512 , c:256x256 , d:128x128 , e:64x64, f:32x32 采样过程: 图像量化采样后所得各像素的灰度模拟量到离散量的转换为图像灰度量化像素灰度级/灰度值/灰度:表示像素明暗程度的整数灰度级数:数字图像中不同灰度值的个数(G)若连续的灰度值用z表示,则满足于z{i} < z < z{i+1} 的z值都量化为整数值z{i},z{i}称为像素灰度值量化后的的灰度值用比特位数(g:存储图像灰度值
 2018-07-13   数字图像处理    数字图像处理 
blob detect

blob detect

斑点检测斑点:与周围区域存在颜色差异或灰度差异的区域斑点检测的主要思路是检测出图像中比周围像素灰度大或者比周围区域灰度值小的区域  1.基于求导的微分方法  2.基于局部极值的分水岭算法,基于此OPENCV中提供simpleBlobDetector特征检测器 #include<iostream> #include<vector> #include<opencv2\opencv.hpp> using namespace cv; int main() { Mat im = imread("D:/learn/jiaopan/source/images/opencv3/blob.jpg",IMREAD_GRAYSCALE); imshow("im", im); Ptr<SimpleBlobDetector> detector = SimpleBlobDetector::create(); std::vector<KeyPoint> keypoints; d
 2018-07-12   opencv3    opencv samples 
leetcode(7) PeakIndexInMountainArray

leetcode(7) PeakIndexInMountainArray

difficult:easy #852Let’s call an array A a mountain if the following properties hold: A.length >= 3 There exists some 0 < i < A.length - 1 such that A[0] < A[1] < … A[i-1] < A[i] > A[i+1] > … > A[A.length - 1]Given an array that is definitely a mountain, return any i such that A[0] < A[1] < … A[i-1] < A[i] > A[i+1] > … > A[A.length - 1]. Example 1: Input: [0,1,0] Output: 1 Example 2: Input: [0,2,1,0] Output: 1 Note:3 <= A.length <= 100000 &l
 2018-07-12   leetcode    leetcode 
leetcode(6)  JudgeRouteCircle

leetcode(6) JudgeRouteCircle

difficult:easy #657Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the original place. The move sequence is represented by a string. And each move is represent by a character. The valid robot moves are R (Right), L (Left), U (Up) and D (down). The output should be true or false representing whether the robot makes a circle. Example 1: Input: "UD" Output: true Example 2: Input: "LL"
 2018-07-11   leetcode    leetcode 
opencv3(3) opencv数据类型

opencv3(3) opencv数据类型

基础数据类型 Point 坐标类Point有两种,2维Point和3维Point,Point可以转换为其他数据类型,比如vector或者matrix ScalaScalar继承于vectorScalar(b, g, r) :b->蓝色分量 g->绿色分量 r->红色分量Scalar(0, 0, 255) -> 红色像素点 Size 大小类Size和Point类似,两者可以互相转换,不同之处在于Point的数据成员名为x和y,Size的数据成员名为width和height Rect 矩形类Rect成员包含Point类型的x,y和Size类型的width,height RotatedRect 旋转矩形类RotatedRect包含中心点(Point),大小(Size),旋转角度 InputArray OutputArrayInputArray和OutputArray区别在于 InputArray为只读,上述基础数据类型都可转换为 InputArray或OutputArray,以此保持函数的简洁性工具函数 cv::alignPtr() 指针对齐// Return ali
 2018-07-10   opencv3    opencv3 
leetcode(5)  HammingDistance

leetcode(5) HammingDistance

difficult:easy #461 The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, calculate the Hamming distance. Example: Input: x = 1, y = 4 Output: 2 Explanation: 1 (0 0 0 1) 4 (0 1 0 0) ↑ ↑ The above arrows point to positions where the corresponding bits are different.解法一 int hammingDistance(int x, int y) { int res = 0, exc = x ^ y; while (exc){ ++res; exc &= (exc - 1)
 2018-07-10   leetcode    leetcode 
leetcode(4)  uniqueMorseCodeWords

leetcode(4) uniqueMorseCodeWords

difficult:easy #804 International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: “a” maps to “.-“, “b” maps to “-…”, “c” maps to “-.-.”, and so on. For convenience, the full table for the 26 letters of the English alphabet is given below: [".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..",&q
 2018-07-10   leetcode    leetcode 
leetcode(3) Jewels and Stones

leetcode(3) Jewels and Stones

difficult:easy #771 You’re given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many of the stones you have are also jewels. The letters in J are guaranteed distinct, and all characters in J and S are letters. Letters are case sensitive, so “a” is considered a different type of stone from “A”.Example 1: Input: J = "aA", S = "aAAbbbb" Output: 3 Example
 2018-07-08   leetcode    leetcode 
1…4567

検索

Hexo Fluid
 总访问量 次   总访客数 人