OpenCV中文参考手册
OpenCV中文参考文件,应用程序接口(API)中文参考资料al OpenCV参考手册·ΩpencⅤ编程简介(矩阵/图像/姒频的基本·Ω中文参考手册读写操作)入门必读· OpenCV概述1.图像处理2.结构分析CXCore中文参考手册3.运动分析与对象跟踪4.模式识别1.基础结构5.照相机定标和三维重建2.数组操作3.动态结构HgGU中文参考手册4.绘图函数5.数椐保存和运行时类型信息1. HighGUI概述6,其它混合函数2.简单图形界面7.錯误处理和系统函数3.读取与保存图傯4.视频读写数机器学习中文参考手册5.实用涵数与系统函数OpencⅤ编码样式指南(阅读 Opencv代码前必CIMage类参考手册读CiMage中的陷阱和BUGOpenCV的Phon接口Opengν编程简介(矩阵/图像/视频的基本读写操作)Wikipedia,自由的百科全书Introduction to programming with OpenCVOpencv编程简介作者: Gady AgamDepartment of Computer ScienceJanuary 27, 2006Illinois Institute of TechnologyUrl:http://www.cs.it.edu/ragam/cs512/lect-notes/opency-intro/opency-intro. html#SECTION00040000000000000000翻译: chenyusiyuanJanuary 26, 2010.http:/blog.csdn.net/chenyusiyuan/archive/2010/01126/5259060.aspx摘要:本文旨在帮助读者快速入门 Openc,而无需阅读冗长的参考手册。掌握了 Opencv的以下基础知识后,有需要的话再查阅相关的参考手册。目录[原]1二、简介o1.11、 Openc的特点1.1.1(1)总体描述(2)功能113(3) OpenCv模块122、有用的学习资源2.1(1)参考手册;122(2)网络资源1.23(3)书籍124(4)视瓶处理例程(在< openly-root>/ samples/c/)125(5)图像处理例程(在< openly-root>/ samples/c/0133、 openc命名规则2(2)矩阵数据类型:■1.33(3)图像数据类型134(4)头文件:o144、编译建议.14.1(lInux;1.4.2(2) Windowso155、C例程2二、GUI指令2.11、窗口管理2.1.1(1)创建和定位一个新窗口∶2.12(2)载入图像2.13(3)显示图後2.14(4)关团窗口2.15(5)改变窗o222、输入处理2.2.1(1)处理鼠标事件222(2)处理键盘事件■2.23(3)处理滑动条事件·3三、 OpenCV的基本数据结构o3.11、图像数据结构3.1.1322、知阵与向量3.2,1(1)矩阵3232).元批333、其它结构类型33.1(1)点332(2)矩框大小(以像素为精度)∵■333(3)矩形框的偏置和大4四、图像处理4,11、图像的内存分配与释放411(1)分配内存给一幅新图像4.1.2(2)释放图像■4.13(3)复制图像414(4)设置/获取感兴趣区域ROI415〈5)设置/获取感兴趣通道COI422、图像读写4.2,1(1)从文件中读入图像4.2.2(2)保存图o433、访回图像像素4.3.1(1)假设你要访间第k通道、翦列的像素43,2(2)间接访间;(通用,但效可访间任意格式的图像)433(3)直接访间:(效率高,但容易岀错)434(4)基于指针的直接访闻:(简单高效435(5)基于c++ wrapper的直接访间(更简单高效a444、图像转换441(1)字节型图像的灰度-彩色转换442(2)彩色图像->灰度图像44不同彩色空间之间的转換a455、绘图指令4.5,1(1)绘制矩形452(2)绘制圆形45.3(3)绘制线段454(4)绘制一组线段455(5)绘制组填充颜色的多边形:456(6)文本标注5五、矩阵处理o5,11、矩阵的内存分配与释放32(3)为新矩阵分配达存释放矩阵内存514(4)复制矩阵5,15(5)初始化矩阵5.1.6(6)初始化矩阵为单位矩阵522、访回矩阵元焘52.1(1)假设需要访间一个2D浮点型矩阵的第(i,j个单元,5.2.2(2)间接访间5.23(3)直接访间(假设矩阵数据按4宰节行对齐)524(4)直接访间(当数据的行对齐可能存在间隙时 possible alignment gaps)5,25(5)对于初始化后的矩阵进行直接i°533、矩阵/向量运算5.3,1(1)矩阵之间的运算532(2)矩阵之间的元素级运算:53,3(3)向量乘积534(4)单一矩阵的运535(5)非齐次线性方程求解■536(6)特征債与特征向量(矩阵为方阵)6六、视频处理611、从视频流中捕捉一帧画面61.2(2)Y支从摄像头或视频文件(AM格式)中捕捉帧画面6,11(1)open个摄像头捕捉器6,1,3(3)初始化一个祕频文件捕捉器614(4)捕捉一帧画面61.5(5)释放视频流捕捉o622、获取/设置视频流信息6,2.1(1)获取视频流设备信息6,2,2(2)获取帧图信息6,23(3)设置丛视频文件抓取的第一帧画而的位置∵633、保存视频文件6.3,1(1)初始化视频编写器6.3,2(2)保持视频文件63)释放视频编写器[编辑]简介[编辑]1、 OpenCV的特点[编辑](1)总体描述· Opencv是一个基于CC++语言的开源图像处理函数库其代码都经过优化,可用于实时处理图像具有良好的可移植性可以进行图像/视频载入、保存和采集的常规操作具有低级和高级的应用程序接口(API·提供了面向 Intel IPP高效多媒体函数库的接口,可针对你使用的 Intel CPU优化代码,提高程序性能(译注: OpenC2.0版的代码已显著优化,无需IPP来提升性能,故2.0版不再提供IPP接口)[编辑(2)功能图像数据操作(内存分配与释放,图像复制、设定和转换)Image data manipulation (allocation, release, copying, setting, conversion·图像/视频的输入输出(支持文件或摄像头的输入,图像/视频文件的输出)Image and video I/o (file and camera based input, image/video file output).矩阵/向量数据操作炇线性代数运算(矩阵乘积、矩阵方程求解、特征值、奇异值分解)Matrix and vector manipulation and linear algebra routines(products, solvers, eigenvalues, SVD)支持多种动态数据结构(链表、队列、数据集、树、图)Various dynamic data structures(lists, queues, sets, trees, graphs)·基本图像处理(去噪、边缘检测、角点检测、采样与插值、色彩变換、形态学处理、直方图、图像金字塔结构)Basic image processing(filtering, edge detection, corner detection, sampling and interpolation, colorconversion, morphological operations, histograms, image pyramids)·结构分析(连通域/分支、轮廓处理、距离转换、图像矩、模板匹配、霍夫变换、多项式逼近、曲线拟合、椭圆拟合、狄劳尼三角化)Structural analysis(connected components, contour processing distance transform, various momentstemplate matching, Hough transform, polygonal approximation, line fitting, ellipse fitting, Delaunaytriangulation).·摄像头定标(寻找和跟踪定标模式、参数定标、基本矩阵估计、单应矩阵估计、立体视觉匹配)Camera calibration(finding and tracking calibration patterns, calibration, fundamental matrixestimation, homography estimation, stereo correspondence).·运动分析(光流、动作分割、目标跟踪)Motion analysis(optical flow, motion segmentation, tracking)目标识别(特征方法、HMM模型Object recognition(eigen-methods HMM)基本的GUI(显示图像/视频、键盘/鼠标操作、滑动条)Basic Gui (display image/ video keyboard and mouse handling, scroll-bars)图像标注(直线、曲线、多边形、文本标注)Image labeling(line, conic, polygon, text drawing[编辑](3) Opencvi模块cv-核心函数库Vaux-辅助函数库:e0机数线性代数作m|-机器学习函数库[编辑]2、有用的学习资源[编辑](1)参考手册:< opencv-root>/ docs/index. htm(译注:在你的 OpenCV安装目录< opencv-root>内)[编辑](2)网络资源:Etkmi:http:/www.intel.com/technology/computing/opencvl[编辑](3)书籍:Open Source Computer Vision Libraryby Gary R Bradski, Vadim Pisarevsky, and Jean-Yves Bouguet, Springer, 1st ed. (June, 2006)chenyusiyuan:补充以下书籍Learning OpenCV -Computer Vision with the OpenCV Libraryby Gary Bradski Adrian Kaehler, O Reilly Media, 1 st ed(September, 2008)OpenCv教程——一基础篇作者:刘瑞祯于仕琪,北京航空航天大学出版社,出版日期:200706(4)视频处理例程(在< opencv-root>/ samples/c/):·颜色跟踪: camshiftdemo点跟踪:| kemo动作分割: motel边缘检测: laplace[编辑](5)图像处理例程(在< opencv-root>/ samples/c/)边缘检测:edge图像分割: pyramid_ segmentation形态学: morphology直方图: demist距离变换: distrains椭圆拟合: fitellipse[编辑]3、 OpenCv命名规则[编辑](1)函数名CvActionTargetMod(.)Act⊥cn=核e functionality)(e.g. set, create)Targettarget image area) (e, g. contour, polygon)Modih (optional modifiers) (e.g. argument type)[编辑](2)矩阵数据类型:CV_(SIUIF)Cs=符号整型UE,q.:Cv_8UC1是指_个8位无符号整型单通道矩阵CV 32FC2是指一个32位浮点型双道道矩阵[编辑](3)图像数据类型:IPL_DEPTH_⊥nc1ude< VAux.h>include inc⊥ ude sinclude /一般不需要,cv,h内已包含该头文件[编辑]4、编译建议[编辑](1)Linux:g++ helloworld. cpp-o hello-worldI /usr/local/include/opencv -L /usr/local/liblm-Icv-highqui-Icvaux[编辑](2)Windows在Ⅵ visual studio的选项和项目牛设置好 OpenCv相关文件的路径。[编]5、C例程hello-worid. cpp/该程序从文件中读入一幅图像,将之反色,然后显示出来⊥nc1udeinclude ⊥nc1ude#include #include highgui.h>int main (int argc, char argv[IplImage* img=0int height, width, step, channelsuchar *datai. i,i,kif(argcheight iwidthimg->widthStepimg->widthstep ichannelsimg->channelsdata(uchar *)img->imageData iprint f("Processing a dx%d image with d channels", height, width, channels)create a windowcvNamedwindow("mainwin CV WINDOW AUTOSIZEcvMoveWindow ("mainwin", 100, 100)t the image相当于 caNot(img);for(i-o; isheighti 1++) for(j=; j
- 2020-12-10下载
- 积分:1
LeetCode cpp最新中文题解.pdf
LeetCode cpp最新中文题解.pdfLeetCode cpp最新中文题解.pdfLeetCode cpp最新中文题解.pdf目录3.4 Add binary615.1.5 Binary Tree Level Or-3.5 Longest Palindromic Substring. 62der traversal il3.6 Regular Expression Matching665.1.6 Binary Tree Zigzag3.7 Wildcard Matching67Level Order traversal. 963.8 Longest Common Prefix5.1.7 Recover Binary Search3. 9 Valid Number70Tree983.10 Integer to roman725. 1. 8 Same Tree3. 11 Roman to Integer735.1.9 Symmetric Tree1003.12 Count and Say745.1.10 Balanced Binary Tree.. 1023. 13 Anagrams755.1.11 Flatten Binary Tree to3. 14 Simplify Path76Linked List1033. 15 Length of Last Word775.1. 12 Populating Next RightPointers in each node ii 105第4章栈和队列7952二叉树的构建10641栈795.2.1 Construct Binary Tree4Valid Parentheses79from Preorder and In4.1.2 Longest valid Parenorder Traversa106theses805.2.2 Construct Binary Tree4.1.3 Largest Rectangle infrom Inorder and posHistogram82torder Traversal1074.1.4 Evaluate reverse pol-53二叉查找树108ish notation845.3. 1 Unique Binary Search4.2队列85Trees.1085.3.2 Unique Binary Search第5章树86Trees li.1105.1二叉树的遍历865.3.3 Validate Binary Search5.1.1 Binary Tree PreorderTreeTraversal865.3. 4 Convert Sorted array to5.1.2 Binary Tree InorderBinary Search Tree...112Traversal885.3.5 Convert Sorted List to5.1. 3 Binary Tree PostorderBinary Search Tree113Traversal9054二叉树的递归.1145. 1. 4 Binary Tree Level Or5.4.1 Minimum Depth of Bider traversal)2nary lree115目录5.4.2 Maximum Depth of Bi8.3.,2重新实现 next permunary Tree116tation1425.4.3 Path Sum11783.3递归.1435.4 4 Path Sum il118 8.4 Permutations II1445.4.5 Binary Tree Maximum8.4.1 next permutation... 144Path Suum11984.2重新实现 next permu5.4.6 Populating Next Righttation144Pointers in each node 120843递归1445.4.7 Sum Root to Leaf num8.5 Combinations146bers2185.1递归1468.5.2迭代147第6章排序1238.6 Letter Combinations of a phone6.1 Merge Sorted Array123umber1476.2 Merge Two Sorted Lists12486.1递归1486.3 Merge k Sorted Lists124862迭代96.4 Insertion Sort List125第9章广度优先搜索1506.5 Sort list1269.1 Word Ladder1506.6 First Missing Positive1279.2 Word Ladder il1546.7 Sort Colors1289.3 Surrounded regions162第7章查找94小结16413194.l适用场景1647.1 Search for a range131942思考的步骤7.2 Search Insert Position.13294.3代码模板1657. 3 Search a 2D Matrix133第10章深度优先搜索173第8章暴力枚举法13510.1 Palindrome Partitioning1738.1 Subsets13510.2 Unique Paths1768.1.1递归1350.2.1深搜1768.1.2迭代.1371022备忘录法.1768.2 Subsets il13810.23动规177821递归13810.24数学公式1788.2.2迭代.14110.3 Unique Paths Il1798. 3 Permutations14210.3.1备忘录法1798.3.1 next permutation14210.3.2动规.180目录10.4 N-Queens1813.4 Maximal rectangle21310.5 N-Queens II18413.5 Best Time to Buy and Sell Stock10.6 Restore ip addresses186.21410.7 Combination Sum18813.6 Interleaving String21510.8 Combination Sum Il18913.7 Scramble String21710.9 Generate Parentheses.19013. 8 Minimum Path Sum.22210.10 Sudoku solver19213.9 Edit Distance22410.11 Word Search.19313. 10 Decode Ways.22610.12小结19513. 11 Distinct sub22710.12.1适用场景19513. 12 Word Break22810.122思考的步骤19513 13 Word Break il2300.12.3代码模板197第14章图23210.12.4深搜与回溯法的区別.19714. 1 Clone Graph23210.12.5深搜与递归的区别..197第15章细节实现题235第11章分治法19915.1 Reverse Integer2351.1 Pow(x, n)19915.2 Palindrome Number.23611. 2 Sqrt(x)20015.3 Insert Interval237第12章贪心法20115.4 Merge Intervals23812.1 Jump game20115.5 Minimum Window Substring23912.2 Jump game II15.6 Multiply Strings24112. 3 Best Time to buy and Sell stock 20415.7 Substring with Concatenation12. 4 Best Time to buy and sell stock l205of all words24412. 5 Longest Substring Without re15.8 Pascal,s Triangle245peating Characters20615.9 Pascals Triangle Il24612.6 Container with Most Water.. 207 15.10 Spiral Matrix24715.11 Spiral matrix II248第13章动态规划20915.12 ZigZag Conversion25013. 1 Triangle20915.13 Divide Two Integers25113.2 Maximum Subarray15. 14 Text Justification25313.3 Palindrome Partitioning II1215.15 Max Points on a line255目录第1章编程技巧在判断两个浮点数a和b是否相等时,不要用a==b,应该判断二者之差的绝对值fabs(a-b)是否小于某个阈值,例如1e-9。判断一个整数是否是为奇数,用x%2!=0,不要用x%2=1,因为ⅹ可能是负用char的值作为数组下标(例如,统计字符串中每个字符岀现的次数),要考虑到char可能是负数。有的人考虑到了,先强制转型为 unsigned int再用作下标,这仍然是错的。正确的做法是,先强制转型为 unsigned char,再用作下标。这涉及C十整型提升的规则,就不详述了。以下是关于STL使用技巧的,很多条款来自《 Effective STL》这本书。vector和 string优先于动态分配的数组首先,在性能上,由于 vector能够保证连续内存,因此一旦分配了后,它的性能跟原始数组相当;其次,如果用new,意味着你要确保后面进行孓 delete,一旦忘记了,就会出现BUG,且这样需要都写一行 delete,代码不够短再次,声明多维数组的话,只能一个一个new,例如int** ary = new int*[row_num];for(int i=0: i< row num; ++1)ary [i] new int [col_num]用 vector的话一行代码搞定vectorary(row_num, vector(col_num, 0))使用 reserve来避免不必要的重新分配第2章线性表这类题目考察线性表的操作,例如,数组,单链表,双向链表等。2数组2.1.1 Remove Duplicates from Sorted array描述Given a sorted array, remove the duplicates in place such that each element appear only onceand return the new lengthDo not allocate extra space for another array, you must do this in place with constant memoryFor example, Given input array A =[1, 1, 2Your function should return length =2, and a is now [1, 2]分析无代码1/ LeetCode, Remove Duplicates from Sorted Array//时间复杂度0(n),空间复杂度0(1)class Solution tublicint removeDuplicates(vector& nums)tif (nums empty o) return 0;int index =ofor (int i =1: i nums size: 1++ iif (nums [index] ! nums [i])nums [++index]= nums [i]return index 12.1数组代码2//LeetCode, Remove Duplicates from Sorted Array/使用STL,时间复杂度0(n),空间复杂度0(1)class Solution ipublicint removeDuplicates(vector& nums)treturn distance(nums begin(), unique(nums begin(), nums end ())代码3/ LeetCode, Remove Duplicates from Sorted Array/使用STL,时间复杂度0(n),空间复杂度0(1)lass Solution fublicint removeDuplicates(vector& nums)treturn distance(nums begin(, removeDuplicates(nums begin(, nums end(), nums begintemplateOutIt removeDuplicates(InIt first, InIt last, OutIt output)thile (first last)i*output++ = *firstfirst upper_bound(first, last, *firstreturn output相关题目Remove Duplicates from Sorted Array I,见§2.1.22.1.2 Remove Duplicates from Sorted Array II描述Follow up for"Remove Duplicates " What if duplicates are allowed at most twice?For example, Given sorted array a =[1, 1, 1, 2, 2, 3]Your function should return length=5, and A is now [1, 1, 2, 2, 3分析加一个变量记录一下元素出现的次数即可。这题因为是已经排序的数组,所以一个变量即可解决。如果是没有排序的数组,则需要引入一个 hashmap来记录出现次数。4第2章线性表代码1// Leet Code, Remove Duplicates from Sorted Array II//时间复杂度0(n),空间复杂度0(1)//qauthorhex108(https://github.com/hex108)class Solution tublicint removeDuplicates(vector& nums)tif (nums size(
- 2020-12-04下载
- 积分:1