├── .gitattributes ├── .gitignore ├── Calibration.sln ├── Calibration ├── AutoThres.cpp ├── CCalibBall.cpp ├── CCalibBall.h ├── Calibration.vcxproj ├── Calibration.vcxproj.filters ├── Calibration.vcxproj.user ├── DetectCircle.cpp ├── cvsba.h ├── cvsba_lib │ ├── blas.lib │ ├── blasd.lib │ ├── cvsba.lib │ ├── cvsbad.lib │ ├── lapack.lib │ ├── lapackd.lib │ ├── libf2c.lib │ └── libf2cd.lib ├── main.cpp ├── opencv_h │ ├── calib3d.hpp │ ├── config.h │ ├── core.hpp │ ├── core_c.h │ ├── defines.h │ ├── features2d.hpp │ ├── highgui.hpp │ ├── highgui_c.h │ ├── imgproc.hpp │ ├── imgproc_c.h │ ├── mat.hpp │ ├── miniflann.hpp │ ├── operations.hpp │ ├── types_c_core.h │ ├── types_c_imgproc.h │ └── version.hpp └── opencv_lib │ ├── opencv_calib3d245.lib │ ├── opencv_calib3d245d.lib │ ├── opencv_core245.lib │ ├── opencv_core245d.lib │ ├── opencv_features2d245.lib │ ├── opencv_features2d245d.lib │ ├── opencv_flann245.lib │ ├── opencv_flann245d.lib │ ├── opencv_highgui245.lib │ ├── opencv_highgui245d.lib │ ├── opencv_imgproc245.lib │ └── opencv_imgproc245d.lib ├── Debug ├── opencv_calib3d245d.dll ├── opencv_core245d.dll ├── opencv_features2d245d.dll ├── opencv_flann245d.dll ├── opencv_highgui245d.dll └── opencv_imgproc245d.dll ├── Readme.md ├── Release ├── config.yml ├── opencv_calib3d245.dll ├── opencv_core245.dll ├── opencv_features2d245.dll ├── opencv_flann245.dll ├── opencv_highgui245.dll └── opencv_imgproc245.dll ├── data └── pair1 │ ├── 3_13293115_0.jpg │ ├── 3_13293116_0.jpg │ ├── 3_13502663_0.jpg │ ├── 3_13502667_0.jpg │ ├── 3_13502670_0.jpg │ ├── 3_13502673_0.jpg │ ├── 3_13502680_0.jpg │ ├── 3_13502683_0.jpg │ ├── 3_13502686_0.jpg │ ├── 3_13502693_0.jpg │ ├── 4_13293115_0.jpg │ ├── 4_13293116_0.jpg │ ├── 4_13502663_0.jpg │ ├── 4_13502667_0.jpg │ ├── 4_13502670_0.jpg │ ├── 4_13502673_0.jpg │ ├── 4_13502680_0.jpg │ ├── 4_13502683_0.jpg │ ├── 4_13502686_0.jpg │ ├── 4_13502693_0.jpg │ └── name └── 多视角相机标定工具V1.0-设计说明书.pdf /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #common files 2 | *.svn-base 3 | #Debug/ 4 | #Release/ 5 | .svn/ 6 | *.m 7 | *.txt 8 | 9 | # Compiled Object files 10 | *.slo 11 | *.lo 12 | *.o 13 | *.obj 14 | *.ipch 15 | *.pdb 16 | *.exp 17 | *.suo 18 | *.opensdf 19 | *.sdf 20 | 21 | # image files 22 | #*.jpg 23 | *.png 24 | *.tiff 25 | *.ply 26 | #*.yml 27 | *.bmp 28 | *.psd 29 | 30 | # Compiled Dynamic libraries 31 | *.so 32 | *.dylib 33 | #*.dll 34 | 35 | # Fortran module files 36 | *.mod 37 | 38 | # Compiled Static libraries 39 | *.lai 40 | *.la 41 | *.a 42 | #*.lib 43 | 44 | # Executables 45 | *.exe 46 | *.out 47 | *.app 48 | 49 | # ========================= 50 | # Operating System Files 51 | # ========================= 52 | 53 | # OSX 54 | # ========================= 55 | 56 | .DS_Store 57 | .AppleDouble 58 | .LSOverride 59 | 60 | # Icon must end with two \r 61 | Icon 62 | 63 | # Thumbnails 64 | ._* 65 | 66 | # Files that might appear on external disk 67 | .Spotlight-V100 68 | .Trashes 69 | 70 | # Directories potentially created on remote AFP share 71 | .AppleDB 72 | .AppleDesktop 73 | Network Trash Folder 74 | Temporary Items 75 | .apdisk 76 | 77 | # Windows 78 | # ========================= 79 | 80 | # Windows image file caches 81 | Thumbs.db 82 | ehthumbs.db 83 | 84 | # Folder config file 85 | Desktop.ini 86 | 87 | # Recycle Bin used on file shares 88 | $RECYCLE.BIN/ 89 | 90 | # Windows Installer files 91 | *.cab 92 | *.msi 93 | *.msm 94 | *.msp 95 | -------------------------------------------------------------------------------- /Calibration.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Calibration", "Calibration\Calibration.vcxproj", "{FBD7D0BE-7FC2-40E9-9A1E-50329C24CAB6}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Debug|x64 = Debug|x64 10 | Release|Win32 = Release|Win32 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {FBD7D0BE-7FC2-40E9-9A1E-50329C24CAB6}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {FBD7D0BE-7FC2-40E9-9A1E-50329C24CAB6}.Debug|Win32.Build.0 = Debug|Win32 16 | {FBD7D0BE-7FC2-40E9-9A1E-50329C24CAB6}.Debug|x64.ActiveCfg = Debug|x64 17 | {FBD7D0BE-7FC2-40E9-9A1E-50329C24CAB6}.Debug|x64.Build.0 = Debug|x64 18 | {FBD7D0BE-7FC2-40E9-9A1E-50329C24CAB6}.Release|Win32.ActiveCfg = Release|Win32 19 | {FBD7D0BE-7FC2-40E9-9A1E-50329C24CAB6}.Release|Win32.Build.0 = Release|Win32 20 | {FBD7D0BE-7FC2-40E9-9A1E-50329C24CAB6}.Release|x64.ActiveCfg = Release|x64 21 | {FBD7D0BE-7FC2-40E9-9A1E-50329C24CAB6}.Release|x64.Build.0 = Release|x64 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /Calibration/AutoThres.cpp: -------------------------------------------------------------------------------- 1 | #include "CCalibBall.h" 2 | 3 | void AutoThres(Mat src, Mat &dst) 4 | { 5 | Mat hist; 6 | int bins=256; 7 | int histSize[] = {bins}; 8 | float range[] = {0,256}; 9 | const float* ranges[] = {range}; 10 | int channels[] = {0}; 11 | Mat mask = dst.clone(); 12 | calcHist(&src,1,channels,mask,hist,1,histSize,ranges); 13 | const float* hist_p = hist.ptr(0); 14 | double T_old = 0, T_new = 100; 15 | double err = 0.01; 16 | float total_times[256], total_count[256]; 17 | total_count[0] = 0; 18 | total_times[0] = hist_p[0]; 19 | for (int i=1; i<256; i++) 20 | { 21 | total_count[i] = total_count[i-1] + hist_p[i]; 22 | total_times[i] = total_times[i-1] + hist_p[i]*i; 23 | } 24 | do 25 | { 26 | T_old = T_new; 27 | int thres_int = int(T_new); 28 | if (thres_int > 254) 29 | { 30 | printf("err"); 31 | break; 32 | } 33 | 34 | T_new = (total_times[thres_int] / total_count[thres_int] + total_times[thres_int+1] / total_count[thres_int+1])/2; 35 | } while (abs(T_old-T_new) > contours; 43 | findContours(src, contours, CV_RETR_CCOMP, CV_CHAIN_APPROX_NONE); 44 | for (int idx=0;idx < contours.size(); idx++) 45 | drawContours(dst,contours,idx,Scalar(255),CV_FILLED); 46 | } 47 | -------------------------------------------------------------------------------- /Calibration/CCalibBall.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Calibration/CCalibBall.cpp -------------------------------------------------------------------------------- /Calibration/CCalibBall.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Calibration/CCalibBall.h -------------------------------------------------------------------------------- /Calibration/Calibration.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | {FBD7D0BE-7FC2-40E9-9A1E-50329C24CAB6} 32 | Win32Proj 33 | Calibration 34 | 35 | 36 | 37 | Application 38 | true 39 | Unicode 40 | 41 | 42 | Application 43 | true 44 | Unicode 45 | 46 | 47 | Application 48 | false 49 | true 50 | Unicode 51 | 52 | 53 | Application 54 | false 55 | true 56 | Unicode 57 | false 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | true 77 | 78 | 79 | true 80 | $(SolutionDir)\$(Configuration)\ 81 | 82 | 83 | false 84 | 85 | 86 | false 87 | $(IncludePath) 88 | $(SolutionDir)\$(Configuration)\ 89 | 90 | 91 | 92 | 93 | 94 | Level3 95 | Disabled 96 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 97 | 98 | 99 | Console 100 | true 101 | 102 | 103 | 104 | 105 | 106 | 107 | Level3 108 | Disabled 109 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 110 | opencv_h;cvsba_src;%(AdditionalIncludeDirectories) 111 | false 112 | 113 | 114 | Console 115 | true 116 | 117 | 118 | 119 | 120 | 121 | 122 | Level3 123 | 124 | 125 | MaxSpeed 126 | true 127 | true 128 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 129 | 130 | 131 | Console 132 | true 133 | true 134 | true 135 | 136 | 137 | 138 | 139 | Level3 140 | 141 | 142 | MaxSpeed 143 | true 144 | true 145 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 146 | opencv_h; 147 | true 148 | true 149 | true 150 | MultiThreadedDLL 151 | 152 | 153 | Console 154 | false 155 | true 156 | true 157 | false 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /Calibration/Calibration.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 源文件 20 | 21 | 22 | 源文件 23 | 24 | 25 | 源文件 26 | 27 | 28 | 源文件 29 | 30 | 31 | 32 | 33 | 头文件 34 | 35 | 36 | -------------------------------------------------------------------------------- /Calibration/Calibration.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | WindowsLocalDebugger 7 | $(SolutionDir)\$(configuration)\ 8 | 9 | 10 | $(SolutionDir)\$(configuration)\ 11 | WindowsLocalDebugger 12 | 13 | -------------------------------------------------------------------------------- /Calibration/DetectCircle.cpp: -------------------------------------------------------------------------------- 1 | #include "CCalibBall.h" 2 | 3 | inline void getCircle(Point2d& p1,Point2d& p2,Point2d& p3, Point2d& center, double& radius) 4 | { 5 | double x1 = p1.x; 6 | double x2 = p2.x; 7 | double x3 = p3.x; 8 | 9 | double y1 = p1.y; 10 | double y2 = p2.y; 11 | double y3 = p3.y; 12 | 13 | // PLEASE CHECK FOR TYPOS IN THE FORMULA :) 14 | center.x = (x1*x1+y1*y1)*(y2-y3) + (x2*x2+y2*y2)*(y3-y1) + (x3*x3+y3*y3)*(y1-y2); 15 | center.x /= ( 2*(x1*(y2-y3) - y1*(x2-x3) + x2*y3 - x3*y2) ); 16 | 17 | center.y = (x1*x1 + y1*y1)*(x3-x2) + (x2*x2+y2*y2)*(x1-x3) + (x3*x3 + y3*y3)*(x2-x1); 18 | center.y /= ( 2*(x1*(y2-y3) - y1*(x2-x3) + x2*y3 - x3*y2) ); 19 | 20 | radius = sqrt((center.x-x1)*(center.x-x1) + (center.y-y1)*(center.y-y1)); 21 | } 22 | 23 | std::vector getPointPositions(Mat binaryImage) 24 | { 25 | std::vector pointPositions; 26 | 27 | for(int y=0; y(y); 30 | for(int x=0; x 0) pointPositions.push_back(Point2d(x,y)); 33 | } 34 | } 35 | 36 | return pointPositions; 37 | } 38 | 39 | double evaluateCircle(Mat dt, Point2d center, double radius) 40 | { 41 | 42 | double completeDistance = 0.0f; 43 | int counter = 0; 44 | 45 | double maxDist = 10.0f; //TODO: this might depend on the size of the circle! 46 | 47 | double minStep = 0.001f; 48 | // choose samples along the circle and count inlier percentage 49 | 50 | //HERE IS THE TRICK that no minimum/maximum circle is used, the number of generated points along the circle depends on the radius. 51 | // if this is too slow for you (e.g. too many points created for each circle), increase the step parameter, but only by factor so that it still depends on the radius 52 | 53 | // the parameter step depends on the circle size, otherwise small circles will create more inlier on the circle 54 | double step = 2*3.14159265359f / (6.0f * radius); 55 | if(step < minStep) step = minStep; // TODO: find a good value here. 56 | 57 | //for(double t =0; t<2*3.14159265359f; t+= 0.05f) // this one which doesnt depend on the radius, is much worse! 58 | for(double t =0; t<2*3.14159265359f; t+= step) 59 | { 60 | int cX = int(radius*cos(t) + center.x + 0.5); 61 | int cY = int(radius*sin(t) + center.y + 0.5); 62 | 63 | if(cX < dt.cols) 64 | if(cX >= 0) 65 | if(cY < dt.rows) 66 | if(cY >= 0) 67 | { 68 | float temp = dt.at(cY,cX); 69 | if( temp <= maxDist) 70 | { 71 | completeDistance += temp; 72 | counter++; 73 | } 74 | } 75 | } 76 | 77 | return counter; 78 | } 79 | 80 | 81 | void DetectCircle(Mat image, Vec3d &circle_, double minCircleRadius, double maxCircleRadius) 82 | { 83 | std::vector edgePositions; 84 | edgePositions = getPointPositions(image); 85 | 86 | // create distance transform to efficiently evaluate distance to nearest edge 87 | Mat dt; 88 | distanceTransform(255-image, dt, CV_DIST_L1, 3); 89 | 90 | Point2d bestCircleCenter; 91 | double bestCircleRadius; 92 | //double bestCVal = FLT_MAX; 93 | double bestCVal = -1; 94 | 95 | int iter = 100; 96 | //TODO: implement some more intelligent ransac without fixed number of iterations 97 | int edge_size = int(edgePositions.size()); 98 | int width = image.cols; 99 | int height = image.rows; 100 | while(1) 101 | { 102 | //RANSAC: randomly choose 3 point and create a circle: 103 | //TODO: choose randomly but more intelligent, 104 | //so that it is more likely to choose three points of a circle. 105 | //For example if there are many small circles, it is unlikely to randomly choose 3 points of the same circle. 106 | unsigned int idx1 = rand()%edge_size; 107 | unsigned int idx2 = rand()%edge_size; 108 | unsigned int idx3 = rand()%edge_size; 109 | 110 | // we need 3 different samples: 111 | if(idx1 == idx2) continue; 112 | if(idx1 == idx3) continue; 113 | if(idx3 == idx2) continue; 114 | 115 | // create circle from 3 points: 116 | Point2d center; double radius; 117 | getCircle(edgePositions[idx1],edgePositions[idx2],edgePositions[idx3],center,radius); 118 | 119 | if(radius < minCircleRadius)continue; 120 | if(radius > maxCircleRadius)continue; 121 | if (center.x > (width-radius) || center.x < radius || center.y > (height- radius) || center.y < radius) 122 | continue; 123 | //verify or falsify the circle by inlier counting: 124 | //double cPerc = verifyCircle(dt,center,radius, inlierSet); 125 | double cVal = evaluateCircle(dt,center,radius); 126 | 127 | if(cVal > bestCVal) 128 | { 129 | bestCVal = cVal; 130 | bestCircleRadius = radius; 131 | bestCircleCenter = center; 132 | } 133 | iter--; 134 | if (iter == 0) break; 135 | } 136 | circle_[0] = bestCircleCenter.x; 137 | circle_[1] = bestCircleCenter.y; 138 | circle_[2] = bestCircleRadius; 139 | } -------------------------------------------------------------------------------- /Calibration/cvsba.h: -------------------------------------------------------------------------------- 1 | /* 2 | ///////////////////////////////////////////////////////////////////////////////// 3 | //// 4 | //// OpenCV Wrapper for sba library 5 | //// Copyright (C) 2013 6 | //// Sergio Garrido Jurado (i52gajus at uco es) 7 | //// Rafael Munoz Salinas (rmsalinas at uco es) 8 | //// AVA Group. University of Cordoba, Spain 9 | //// 10 | //// This program is free software; you can redistribute it and/or modify 11 | //// it under the terms of the GNU General Public License as published by 12 | //// the Free Software Foundation; either version 2 of the License, or 13 | //// (at your option) any later version. 14 | //// 15 | //// This program is distributed in the hope that it will be useful, 16 | //// but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | //// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | //// GNU General Public License for more details. 19 | //// 20 | /////////////////////////////////////////////////////////////////////////////////// 21 | */ 22 | 23 | #ifndef CVSBA_H 24 | #define CVSBA_H 25 | 26 | #include 27 | #include 28 | #include 29 | namespace cvsba { 30 | 31 | class Sba { 32 | public: 33 | 34 | enum TYPE{MOTIONSTRUCTURE=0, MOTION, STRUCTURE }; 35 | /**Params leading the optimization 36 | */ 37 | struct Params { 38 | TYPE type; // type of sba: motionstructure(3dpoints+extrinsics), just motion(extrinsics) or just structure(3dpoints) 39 | int iterations; // max number of iterations, stop criteria 40 | double minError; // min error, stop criteria 41 | int fixedIntrinsics; //number of intrinsics parameters that keep fixed [0-5] (fx cx cy fy/fx s) 42 | int fixedDistortion; // number of distortion parameters that keep fixed [0-5] (k1 k2 p1 p2 k3) 43 | int verbose; 44 | 45 | Params ( TYPE t= MOTIONSTRUCTURE, int iters = 150,double minErr = 1e-10, 46 | int fixedIntri =5,int fixedDist = 5,int Verbose=0 ) { 47 | 48 | type = t; 49 | iterations = iters; 50 | minError = minErr; 51 | fixedIntrinsics =fixedIntri; 52 | fixedDistortion = fixedDist; 53 | verbose=Verbose; 54 | } 55 | }; 56 | /**Empty constructor 57 | */ 58 | 59 | Sba(); 60 | 61 | /**Sets params before optimization 62 | */ 63 | void setParams ( Params params ) { 64 | _params = params; 65 | }; 66 | 67 | /** 68 | * Run sba algorithm. We are using the same interface defined in cv::LevMarqSparse. 69 | * 70 | * Let N and M denote the number of object points and the number of cameras. 71 | * 72 | * @param points N x 3 object points 73 | * @param imagePoints M x N x 2 image points for each camera and each points. The outer vector has M elements and each element has N elements of Point2d . 74 | * @param visibility M x N x 1 visibility matrix, the element [i][j] = 1 when object point i is visible from camera j and 0 if not. 75 | * @param cameraMatrix M x 3 x 3 camera matrix (intrinsic parameters) 3 x 3 camera matrix for each image 76 | * @param distCoeffs M x 5 x1 distortion coefficient for each image 77 | * @param R M x 3 x 3 rotation matrix for each image 78 | * @param T M x 3 x 1 translation matrix for each image 79 | * 80 | * @return average reprojection error of the optimized solution 81 | * 82 | * @note matrices can be either float or double, they are internally changed. 83 | */ 84 | double run ( std::vector& points, //positions of points in global coordinate system (input and output) 85 | const std::vector >& imagePoints, //projections of 3d points for every camera 86 | const std::vector >& visibility, //visibility of 3d points for every camera 87 | std::vector& cameraMatrix, //intrinsic matrices of all cameras (input and output) 88 | std::vector& R, //rotation matrices of all cameras (input and output) (Rodrigues format) 89 | std::vector& T, //translation vector of all cameras (input and output) 90 | std::vector& distCoeffs //distortion coefficients of all cameras (input and output) 91 | ) throw ( cv::Exception ); 92 | 93 | /** 94 | * Same but using float points 95 | */ 96 | double run ( std::vector& points, //positions of points in global coordinate system (input and output) 97 | const std::vector >& imagePoints, //projections of 3d points for every camera 98 | const std::vector >& visibility, //visibility of 3d points for every camera 99 | std::vector& cameraMatrix, //intrinsic matrices of all cameras (input and output) 100 | std::vector& R, //rotation matrices of all cameras (input and output) (Rodrigues format) 101 | std::vector& T, //translation vector of all cameras (input and output) 102 | std::vector& distCoeffs //distortion coefficients of all cameras (input and output) 103 | ) throw ( cv::Exception ); 104 | 105 | 106 | 107 | // Observer 108 | const Params getParams() { 109 | return _params; 110 | }; 111 | 112 | /**Used after run, indicates the initial error before running the optimization 113 | */ 114 | double getInitialReprjError() const{return _initRprjErr;} 115 | /**Used after run, indicates the error after running the optimization. This is the same value returned by run 116 | */ 117 | double getFinalReprjError() const {return _finalRprjErr;} 118 | 119 | 120 | 121 | /// Auxiliar functions for quaternions 122 | 123 | /** 124 | * Convert 4-items quaternion to normalized 3-items quaternion 125 | */ 126 | static void quat2normquat ( const cv::Mat& quat, cv::Mat& normquat ); 127 | 128 | /** 129 | * Convert 3-items normalized quaternion to 4-items quaternion 130 | */ 131 | static void normquat2quat ( const cv::Mat& normquat, cv::Mat& quat ); 132 | 133 | /** 134 | * Convert 4-items quaternion to Rodrigues rotation vector 135 | */ 136 | static void quat2rod ( const cv::Mat &quat, cv::Mat &rod ); 137 | 138 | /** 139 | * Convert Rodrigues rotation vector to 4-items quaternion 140 | */ 141 | static void rod2quat ( const cv::Mat& rod, cv::Mat& quat ); 142 | 143 | 144 | 145 | private: 146 | 147 | double _initRprjErr,_finalRprjErr; 148 | 149 | Params _params; 150 | 151 | 152 | /// functions and data extracted from eucsbademo 153 | /// just for sba internal use 154 | struct globs_{ 155 | double *rot0params;//8 156 | double *intrcalib;//8 157 | int nccalib;//4 158 | int ncdist;//4 159 | int cnp, pnp, mnp;//12 160 | double *ptparams;//4 161 | double *camparams;//4 162 | }; 163 | static void img_projKDRTS ( int j, int i, double *aj, double *bi, double *xij, void *adata ); 164 | static void img_projKDRT ( int j, int i, double *aj, double *xij, void *adata ); 165 | static void img_projKDS ( int j, int i, double *bi, double *xij, void *adata ); 166 | static void img_projKDRTS_jac ( int j, int i, double *aj, double *bi, double *Aij, double *Bij, void *adata ); 167 | static void img_projKDRT_jac ( int j, int i, double *aj, double *Aij, void *adata ); 168 | static void img_projKDS_jac ( int j, int i, double *bi, double *Bij, void *adata ); 169 | static void calcDistImgProj ( double a[5],double kc[5],double qr0[4],double v[3],double t[3],double M[3],double n[2] ); 170 | static void calcDistImgProjJacKDRTS ( double a[5],double kc[5],double qr0[4], double v[3],double t[3],double M[3],double jacmKDRT[2][16],double jacmS[2][3] ); 171 | static void calcDistImgProjJacKDRT ( double a[5],double kc[5],double qr0[4],double v[3],double t[3],double M[3],double jacmKDRT[2][16] ); 172 | static void calcDistImgProjJacS ( double a[5],double kc[5],double qr0[4],double v[3],double t[3],double M[3],double jacmS[2][3] ); 173 | 174 | void quatMultFast ( double q1[4], double q2[4], double p[4] ); 175 | 176 | 177 | }; 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | } 187 | #endif // CVSBA_H 188 | -------------------------------------------------------------------------------- /Calibration/cvsba_lib/blas.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Calibration/cvsba_lib/blas.lib -------------------------------------------------------------------------------- /Calibration/cvsba_lib/blasd.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Calibration/cvsba_lib/blasd.lib -------------------------------------------------------------------------------- /Calibration/cvsba_lib/cvsba.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Calibration/cvsba_lib/cvsba.lib -------------------------------------------------------------------------------- /Calibration/cvsba_lib/cvsbad.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Calibration/cvsba_lib/cvsbad.lib -------------------------------------------------------------------------------- /Calibration/cvsba_lib/lapack.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Calibration/cvsba_lib/lapack.lib -------------------------------------------------------------------------------- /Calibration/cvsba_lib/lapackd.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Calibration/cvsba_lib/lapackd.lib -------------------------------------------------------------------------------- /Calibration/cvsba_lib/libf2c.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Calibration/cvsba_lib/libf2c.lib -------------------------------------------------------------------------------- /Calibration/cvsba_lib/libf2cd.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Calibration/cvsba_lib/libf2cd.lib -------------------------------------------------------------------------------- /Calibration/main.cpp: -------------------------------------------------------------------------------- 1 | #include "CCalibBall.h" 2 | 3 | int main(int argc, char **argv) { 4 | 5 | 6 | char config_file[100]; 7 | if (argc == 1) 8 | strcpy(config_file, "config.yml"); 9 | else strcpy(config_file, argv[1]); 10 | CCalibBall calib(config_file); 11 | calib.run(config_file); 12 | return 0; 13 | } -------------------------------------------------------------------------------- /Calibration/opencv_h/calib3d.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef __OPENCV_CALIB3D_HPP__ 44 | #define __OPENCV_CALIB3D_HPP__ 45 | 46 | #include "core.hpp" 47 | #include "features2d.hpp" 48 | 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | /****************************************************************************************\ 54 | * Camera Calibration, Pose Estimation and Stereo * 55 | \****************************************************************************************/ 56 | 57 | typedef struct CvPOSITObject CvPOSITObject; 58 | 59 | /* Allocates and initializes CvPOSITObject structure before doing cvPOSIT */ 60 | CVAPI(CvPOSITObject*) cvCreatePOSITObject( CvPoint3D32f* points, int point_count ); 61 | 62 | 63 | /* Runs POSIT (POSe from ITeration) algorithm for determining 3d position of 64 | an object given its model and projection in a weak-perspective case */ 65 | CVAPI(void) cvPOSIT( CvPOSITObject* posit_object, CvPoint2D32f* image_points, 66 | double focal_length, CvTermCriteria criteria, 67 | float* rotation_matrix, float* translation_vector); 68 | 69 | /* Releases CvPOSITObject structure */ 70 | CVAPI(void) cvReleasePOSITObject( CvPOSITObject** posit_object ); 71 | 72 | /* updates the number of RANSAC iterations */ 73 | CVAPI(int) cvRANSACUpdateNumIters( double p, double err_prob, 74 | int model_points, int max_iters ); 75 | 76 | CVAPI(void) cvConvertPointsHomogeneous( const CvMat* src, CvMat* dst ); 77 | 78 | /* Calculates fundamental matrix given a set of corresponding points */ 79 | #define CV_FM_7POINT 1 80 | #define CV_FM_8POINT 2 81 | 82 | #define CV_LMEDS 4 83 | #define CV_RANSAC 8 84 | 85 | #define CV_FM_LMEDS_ONLY CV_LMEDS 86 | #define CV_FM_RANSAC_ONLY CV_RANSAC 87 | #define CV_FM_LMEDS CV_LMEDS 88 | #define CV_FM_RANSAC CV_RANSAC 89 | 90 | enum 91 | { 92 | CV_ITERATIVE = 0, 93 | CV_EPNP = 1, // F.Moreno-Noguer, V.Lepetit and P.Fua "EPnP: Efficient Perspective-n-Point Camera Pose Estimation" 94 | CV_P3P = 2 // X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang; "Complete Solution Classification for the Perspective-Three-Point Problem" 95 | }; 96 | 97 | CVAPI(int) cvFindFundamentalMat( const CvMat* points1, const CvMat* points2, 98 | CvMat* fundamental_matrix, 99 | int method CV_DEFAULT(CV_FM_RANSAC), 100 | double param1 CV_DEFAULT(3.), double param2 CV_DEFAULT(0.99), 101 | CvMat* status CV_DEFAULT(NULL) ); 102 | 103 | /* For each input point on one of images 104 | computes parameters of the corresponding 105 | epipolar line on the other image */ 106 | CVAPI(void) cvComputeCorrespondEpilines( const CvMat* points, 107 | int which_image, 108 | const CvMat* fundamental_matrix, 109 | CvMat* correspondent_lines ); 110 | 111 | /* Triangulation functions */ 112 | 113 | CVAPI(void) cvTriangulatePoints(CvMat* projMatr1, CvMat* projMatr2, 114 | CvMat* projPoints1, CvMat* projPoints2, 115 | CvMat* points4D); 116 | 117 | CVAPI(void) cvCorrectMatches(CvMat* F, CvMat* points1, CvMat* points2, 118 | CvMat* new_points1, CvMat* new_points2); 119 | 120 | 121 | /* Computes the optimal new camera matrix according to the free scaling parameter alpha: 122 | alpha=0 - only valid pixels will be retained in the undistorted image 123 | alpha=1 - all the source image pixels will be retained in the undistorted image 124 | */ 125 | CVAPI(void) cvGetOptimalNewCameraMatrix( const CvMat* camera_matrix, 126 | const CvMat* dist_coeffs, 127 | CvSize image_size, double alpha, 128 | CvMat* new_camera_matrix, 129 | CvSize new_imag_size CV_DEFAULT(cvSize(0,0)), 130 | CvRect* valid_pixel_ROI CV_DEFAULT(0), 131 | int center_principal_point CV_DEFAULT(0)); 132 | 133 | /* Converts rotation vector to rotation matrix or vice versa */ 134 | CVAPI(int) cvRodrigues2( const CvMat* src, CvMat* dst, 135 | CvMat* jacobian CV_DEFAULT(0) ); 136 | 137 | /* Finds perspective transformation between the object plane and image (view) plane */ 138 | CVAPI(int) cvFindHomography( const CvMat* src_points, 139 | const CvMat* dst_points, 140 | CvMat* homography, 141 | int method CV_DEFAULT(0), 142 | double ransacReprojThreshold CV_DEFAULT(3), 143 | CvMat* mask CV_DEFAULT(0)); 144 | 145 | /* Computes RQ decomposition for 3x3 matrices */ 146 | CVAPI(void) cvRQDecomp3x3( const CvMat *matrixM, CvMat *matrixR, CvMat *matrixQ, 147 | CvMat *matrixQx CV_DEFAULT(NULL), 148 | CvMat *matrixQy CV_DEFAULT(NULL), 149 | CvMat *matrixQz CV_DEFAULT(NULL), 150 | CvPoint3D64f *eulerAngles CV_DEFAULT(NULL)); 151 | 152 | /* Computes projection matrix decomposition */ 153 | CVAPI(void) cvDecomposeProjectionMatrix( const CvMat *projMatr, CvMat *calibMatr, 154 | CvMat *rotMatr, CvMat *posVect, 155 | CvMat *rotMatrX CV_DEFAULT(NULL), 156 | CvMat *rotMatrY CV_DEFAULT(NULL), 157 | CvMat *rotMatrZ CV_DEFAULT(NULL), 158 | CvPoint3D64f *eulerAngles CV_DEFAULT(NULL)); 159 | 160 | /* Computes d(AB)/dA and d(AB)/dB */ 161 | CVAPI(void) cvCalcMatMulDeriv( const CvMat* A, const CvMat* B, CvMat* dABdA, CvMat* dABdB ); 162 | 163 | /* Computes r3 = rodrigues(rodrigues(r2)*rodrigues(r1)), 164 | t3 = rodrigues(r2)*t1 + t2 and the respective derivatives */ 165 | CVAPI(void) cvComposeRT( const CvMat* _rvec1, const CvMat* _tvec1, 166 | const CvMat* _rvec2, const CvMat* _tvec2, 167 | CvMat* _rvec3, CvMat* _tvec3, 168 | CvMat* dr3dr1 CV_DEFAULT(0), CvMat* dr3dt1 CV_DEFAULT(0), 169 | CvMat* dr3dr2 CV_DEFAULT(0), CvMat* dr3dt2 CV_DEFAULT(0), 170 | CvMat* dt3dr1 CV_DEFAULT(0), CvMat* dt3dt1 CV_DEFAULT(0), 171 | CvMat* dt3dr2 CV_DEFAULT(0), CvMat* dt3dt2 CV_DEFAULT(0) ); 172 | 173 | /* Projects object points to the view plane using 174 | the specified extrinsic and intrinsic camera parameters */ 175 | CVAPI(void) cvProjectPoints2( const CvMat* object_points, const CvMat* rotation_vector, 176 | const CvMat* translation_vector, const CvMat* camera_matrix, 177 | const CvMat* distortion_coeffs, CvMat* image_points, 178 | CvMat* dpdrot CV_DEFAULT(NULL), CvMat* dpdt CV_DEFAULT(NULL), 179 | CvMat* dpdf CV_DEFAULT(NULL), CvMat* dpdc CV_DEFAULT(NULL), 180 | CvMat* dpddist CV_DEFAULT(NULL), 181 | double aspect_ratio CV_DEFAULT(0)); 182 | 183 | /* Finds extrinsic camera parameters from 184 | a few known corresponding point pairs and intrinsic parameters */ 185 | CVAPI(void) cvFindExtrinsicCameraParams2( const CvMat* object_points, 186 | const CvMat* image_points, 187 | const CvMat* camera_matrix, 188 | const CvMat* distortion_coeffs, 189 | CvMat* rotation_vector, 190 | CvMat* translation_vector, 191 | int use_extrinsic_guess CV_DEFAULT(0) ); 192 | 193 | /* Computes initial estimate of the intrinsic camera parameters 194 | in case of planar calibration target (e.g. chessboard) */ 195 | CVAPI(void) cvInitIntrinsicParams2D( const CvMat* object_points, 196 | const CvMat* image_points, 197 | const CvMat* npoints, CvSize image_size, 198 | CvMat* camera_matrix, 199 | double aspect_ratio CV_DEFAULT(1.) ); 200 | 201 | #define CV_CALIB_CB_ADAPTIVE_THRESH 1 202 | #define CV_CALIB_CB_NORMALIZE_IMAGE 2 203 | #define CV_CALIB_CB_FILTER_QUADS 4 204 | #define CV_CALIB_CB_FAST_CHECK 8 205 | 206 | // Performs a fast check if a chessboard is in the input image. This is a workaround to 207 | // a problem of cvFindChessboardCorners being slow on images with no chessboard 208 | // - src: input image 209 | // - size: chessboard size 210 | // Returns 1 if a chessboard can be in this image and findChessboardCorners should be called, 211 | // 0 if there is no chessboard, -1 in case of error 212 | CVAPI(int) cvCheckChessboard(IplImage* src, CvSize size); 213 | 214 | /* Detects corners on a chessboard calibration pattern */ 215 | CVAPI(int) cvFindChessboardCorners( const void* image, CvSize pattern_size, 216 | CvPoint2D32f* corners, 217 | int* corner_count CV_DEFAULT(NULL), 218 | int flags CV_DEFAULT(CV_CALIB_CB_ADAPTIVE_THRESH+CV_CALIB_CB_NORMALIZE_IMAGE) ); 219 | 220 | /* Draws individual chessboard corners or the whole chessboard detected */ 221 | CVAPI(void) cvDrawChessboardCorners( CvArr* image, CvSize pattern_size, 222 | CvPoint2D32f* corners, 223 | int count, int pattern_was_found ); 224 | 225 | #define CV_CALIB_USE_INTRINSIC_GUESS 1 226 | #define CV_CALIB_FIX_ASPECT_RATIO 2 227 | #define CV_CALIB_FIX_PRINCIPAL_POINT 4 228 | #define CV_CALIB_ZERO_TANGENT_DIST 8 229 | #define CV_CALIB_FIX_FOCAL_LENGTH 16 230 | #define CV_CALIB_FIX_K1 32 231 | #define CV_CALIB_FIX_K2 64 232 | #define CV_CALIB_FIX_K3 128 233 | #define CV_CALIB_FIX_K4 2048 234 | #define CV_CALIB_FIX_K5 4096 235 | #define CV_CALIB_FIX_K6 8192 236 | #define CV_CALIB_RATIONAL_MODEL 16384 237 | 238 | /* Finds intrinsic and extrinsic camera parameters 239 | from a few views of known calibration pattern */ 240 | CVAPI(double) cvCalibrateCamera2( const CvMat* object_points, 241 | const CvMat* image_points, 242 | const CvMat* point_counts, 243 | CvSize image_size, 244 | CvMat* camera_matrix, 245 | CvMat* distortion_coeffs, 246 | CvMat* rotation_vectors CV_DEFAULT(NULL), 247 | CvMat* translation_vectors CV_DEFAULT(NULL), 248 | int flags CV_DEFAULT(0), 249 | CvTermCriteria term_crit CV_DEFAULT(cvTermCriteria( 250 | CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,30,DBL_EPSILON)) ); 251 | 252 | /* Computes various useful characteristics of the camera from the data computed by 253 | cvCalibrateCamera2 */ 254 | CVAPI(void) cvCalibrationMatrixValues( const CvMat *camera_matrix, 255 | CvSize image_size, 256 | double aperture_width CV_DEFAULT(0), 257 | double aperture_height CV_DEFAULT(0), 258 | double *fovx CV_DEFAULT(NULL), 259 | double *fovy CV_DEFAULT(NULL), 260 | double *focal_length CV_DEFAULT(NULL), 261 | CvPoint2D64f *principal_point CV_DEFAULT(NULL), 262 | double *pixel_aspect_ratio CV_DEFAULT(NULL)); 263 | 264 | #define CV_CALIB_FIX_INTRINSIC 256 265 | #define CV_CALIB_SAME_FOCAL_LENGTH 512 266 | 267 | /* Computes the transformation from one camera coordinate system to another one 268 | from a few correspondent views of the same calibration target. Optionally, calibrates 269 | both cameras */ 270 | CVAPI(double) cvStereoCalibrate( const CvMat* object_points, const CvMat* image_points1, 271 | const CvMat* image_points2, const CvMat* npoints, 272 | CvMat* camera_matrix1, CvMat* dist_coeffs1, 273 | CvMat* camera_matrix2, CvMat* dist_coeffs2, 274 | CvSize image_size, CvMat* R, CvMat* T, 275 | CvMat* E CV_DEFAULT(0), CvMat* F CV_DEFAULT(0), 276 | CvTermCriteria term_crit CV_DEFAULT(cvTermCriteria( 277 | CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,30,1e-6)), 278 | int flags CV_DEFAULT(CV_CALIB_FIX_INTRINSIC)); 279 | 280 | #define CV_CALIB_ZERO_DISPARITY 1024 281 | 282 | /* Computes 3D rotations (+ optional shift) for each camera coordinate system to make both 283 | views parallel (=> to make all the epipolar lines horizontal or vertical) */ 284 | CVAPI(void) cvStereoRectify( const CvMat* camera_matrix1, const CvMat* camera_matrix2, 285 | const CvMat* dist_coeffs1, const CvMat* dist_coeffs2, 286 | CvSize image_size, const CvMat* R, const CvMat* T, 287 | CvMat* R1, CvMat* R2, CvMat* P1, CvMat* P2, 288 | CvMat* Q CV_DEFAULT(0), 289 | int flags CV_DEFAULT(CV_CALIB_ZERO_DISPARITY), 290 | double alpha CV_DEFAULT(-1), 291 | CvSize new_image_size CV_DEFAULT(cvSize(0,0)), 292 | CvRect* valid_pix_ROI1 CV_DEFAULT(0), 293 | CvRect* valid_pix_ROI2 CV_DEFAULT(0)); 294 | 295 | /* Computes rectification transformations for uncalibrated pair of images using a set 296 | of point correspondences */ 297 | CVAPI(int) cvStereoRectifyUncalibrated( const CvMat* points1, const CvMat* points2, 298 | const CvMat* F, CvSize img_size, 299 | CvMat* H1, CvMat* H2, 300 | double threshold CV_DEFAULT(5)); 301 | 302 | 303 | 304 | /* stereo correspondence parameters and functions */ 305 | 306 | #define CV_STEREO_BM_NORMALIZED_RESPONSE 0 307 | #define CV_STEREO_BM_XSOBEL 1 308 | 309 | /* Block matching algorithm structure */ 310 | typedef struct CvStereoBMState 311 | { 312 | // pre-filtering (normalization of input images) 313 | int preFilterType; // =CV_STEREO_BM_NORMALIZED_RESPONSE now 314 | int preFilterSize; // averaging window size: ~5x5..21x21 315 | int preFilterCap; // the output of pre-filtering is clipped by [-preFilterCap,preFilterCap] 316 | 317 | // correspondence using Sum of Absolute Difference (SAD) 318 | int SADWindowSize; // ~5x5..21x21 319 | int minDisparity; // minimum disparity (can be negative) 320 | int numberOfDisparities; // maximum disparity - minimum disparity (> 0) 321 | 322 | // post-filtering 323 | int textureThreshold; // the disparity is only computed for pixels 324 | // with textured enough neighborhood 325 | int uniquenessRatio; // accept the computed disparity d* only if 326 | // SAD(d) >= SAD(d*)*(1 + uniquenessRatio/100.) 327 | // for any d != d*+/-1 within the search range. 328 | int speckleWindowSize; // disparity variation window 329 | int speckleRange; // acceptable range of variation in window 330 | 331 | int trySmallerWindows; // if 1, the results may be more accurate, 332 | // at the expense of slower processing 333 | CvRect roi1, roi2; 334 | int disp12MaxDiff; 335 | 336 | // temporary buffers 337 | CvMat* preFilteredImg0; 338 | CvMat* preFilteredImg1; 339 | CvMat* slidingSumBuf; 340 | CvMat* cost; 341 | CvMat* disp; 342 | } CvStereoBMState; 343 | 344 | #define CV_STEREO_BM_BASIC 0 345 | #define CV_STEREO_BM_FISH_EYE 1 346 | #define CV_STEREO_BM_NARROW 2 347 | 348 | CVAPI(CvStereoBMState*) cvCreateStereoBMState(int preset CV_DEFAULT(CV_STEREO_BM_BASIC), 349 | int numberOfDisparities CV_DEFAULT(0)); 350 | 351 | CVAPI(void) cvReleaseStereoBMState( CvStereoBMState** state ); 352 | 353 | CVAPI(void) cvFindStereoCorrespondenceBM( const CvArr* left, const CvArr* right, 354 | CvArr* disparity, CvStereoBMState* state ); 355 | 356 | CVAPI(CvRect) cvGetValidDisparityROI( CvRect roi1, CvRect roi2, int minDisparity, 357 | int numberOfDisparities, int SADWindowSize ); 358 | 359 | CVAPI(void) cvValidateDisparity( CvArr* disparity, const CvArr* cost, 360 | int minDisparity, int numberOfDisparities, 361 | int disp12MaxDiff CV_DEFAULT(1) ); 362 | 363 | /* Reprojects the computed disparity image to the 3D space using the specified 4x4 matrix */ 364 | CVAPI(void) cvReprojectImageTo3D( const CvArr* disparityImage, 365 | CvArr* _3dImage, const CvMat* Q, 366 | int handleMissingValues CV_DEFAULT(0) ); 367 | 368 | 369 | #ifdef __cplusplus 370 | } 371 | 372 | ////////////////////////////////////////////////////////////////////////////////////////// 373 | class CV_EXPORTS CvLevMarq 374 | { 375 | public: 376 | CvLevMarq(); 377 | CvLevMarq( int nparams, int nerrs, CvTermCriteria criteria= 378 | cvTermCriteria(CV_TERMCRIT_EPS+CV_TERMCRIT_ITER,30,DBL_EPSILON), 379 | bool completeSymmFlag=false ); 380 | ~CvLevMarq(); 381 | void init( int nparams, int nerrs, CvTermCriteria criteria= 382 | cvTermCriteria(CV_TERMCRIT_EPS+CV_TERMCRIT_ITER,30,DBL_EPSILON), 383 | bool completeSymmFlag=false ); 384 | bool update( const CvMat*& param, CvMat*& J, CvMat*& err ); 385 | bool updateAlt( const CvMat*& param, CvMat*& JtJ, CvMat*& JtErr, double*& errNorm ); 386 | 387 | void clear(); 388 | void step(); 389 | enum { DONE=0, STARTED=1, CALC_J=2, CHECK_ERR=3 }; 390 | 391 | cv::Ptr mask; 392 | cv::Ptr prevParam; 393 | cv::Ptr param; 394 | cv::Ptr J; 395 | cv::Ptr err; 396 | cv::Ptr JtJ; 397 | cv::Ptr JtJN; 398 | cv::Ptr JtErr; 399 | cv::Ptr JtJV; 400 | cv::Ptr JtJW; 401 | double prevErrNorm, errNorm; 402 | int lambdaLg10; 403 | CvTermCriteria criteria; 404 | int state; 405 | int iters; 406 | bool completeSymmFlag; 407 | }; 408 | 409 | namespace cv 410 | { 411 | //! converts rotation vector to rotation matrix or vice versa using Rodrigues transformation 412 | CV_EXPORTS_W void Rodrigues(InputArray src, OutputArray dst, OutputArray jacobian=noArray()); 413 | 414 | //! type of the robust estimation algorithm 415 | enum 416 | { 417 | LMEDS=CV_LMEDS, //!< least-median algorithm 418 | RANSAC=CV_RANSAC //!< RANSAC algorithm 419 | }; 420 | 421 | //! computes the best-fit perspective transformation mapping srcPoints to dstPoints. 422 | CV_EXPORTS_W Mat findHomography( InputArray srcPoints, InputArray dstPoints, 423 | int method=0, double ransacReprojThreshold=3, 424 | OutputArray mask=noArray()); 425 | 426 | //! variant of findHomography for backward compatibility 427 | CV_EXPORTS Mat findHomography( InputArray srcPoints, InputArray dstPoints, 428 | OutputArray mask, int method=0, double ransacReprojThreshold=3); 429 | 430 | //! Computes RQ decomposition of 3x3 matrix 431 | CV_EXPORTS_W Vec3d RQDecomp3x3( InputArray src, OutputArray mtxR, OutputArray mtxQ, 432 | OutputArray Qx=noArray(), 433 | OutputArray Qy=noArray(), 434 | OutputArray Qz=noArray()); 435 | 436 | //! Decomposes the projection matrix into camera matrix and the rotation martix and the translation vector 437 | CV_EXPORTS_W void decomposeProjectionMatrix( InputArray projMatrix, OutputArray cameraMatrix, 438 | OutputArray rotMatrix, OutputArray transVect, 439 | OutputArray rotMatrixX=noArray(), 440 | OutputArray rotMatrixY=noArray(), 441 | OutputArray rotMatrixZ=noArray(), 442 | OutputArray eulerAngles=noArray() ); 443 | 444 | //! computes derivatives of the matrix product w.r.t each of the multiplied matrix coefficients 445 | CV_EXPORTS_W void matMulDeriv( InputArray A, InputArray B, 446 | OutputArray dABdA, 447 | OutputArray dABdB ); 448 | 449 | //! composes 2 [R|t] transformations together. Also computes the derivatives of the result w.r.t the arguments 450 | CV_EXPORTS_W void composeRT( InputArray rvec1, InputArray tvec1, 451 | InputArray rvec2, InputArray tvec2, 452 | OutputArray rvec3, OutputArray tvec3, 453 | OutputArray dr3dr1=noArray(), OutputArray dr3dt1=noArray(), 454 | OutputArray dr3dr2=noArray(), OutputArray dr3dt2=noArray(), 455 | OutputArray dt3dr1=noArray(), OutputArray dt3dt1=noArray(), 456 | OutputArray dt3dr2=noArray(), OutputArray dt3dt2=noArray() ); 457 | 458 | //! projects points from the model coordinate space to the image coordinates. Also computes derivatives of the image coordinates w.r.t the intrinsic and extrinsic camera parameters 459 | CV_EXPORTS_W void projectPoints( InputArray objectPoints, 460 | InputArray rvec, InputArray tvec, 461 | InputArray cameraMatrix, InputArray distCoeffs, 462 | OutputArray imagePoints, 463 | OutputArray jacobian=noArray(), 464 | double aspectRatio=0 ); 465 | 466 | //! computes the camera pose from a few 3D points and the corresponding projections. The outliers are not handled. 467 | enum 468 | { 469 | ITERATIVE=CV_ITERATIVE, 470 | EPNP=CV_EPNP, 471 | P3P=CV_P3P 472 | }; 473 | CV_EXPORTS_W bool solvePnP( InputArray objectPoints, InputArray imagePoints, 474 | InputArray cameraMatrix, InputArray distCoeffs, 475 | OutputArray rvec, OutputArray tvec, 476 | bool useExtrinsicGuess=false, int flags=ITERATIVE); 477 | 478 | //! computes the camera pose from a few 3D points and the corresponding projections. The outliers are possible. 479 | CV_EXPORTS_W void solvePnPRansac( InputArray objectPoints, 480 | InputArray imagePoints, 481 | InputArray cameraMatrix, 482 | InputArray distCoeffs, 483 | OutputArray rvec, 484 | OutputArray tvec, 485 | bool useExtrinsicGuess = false, 486 | int iterationsCount = 100, 487 | float reprojectionError = 8.0, 488 | int minInliersCount = 100, 489 | OutputArray inliers = noArray(), 490 | int flags = ITERATIVE); 491 | 492 | //! initializes camera matrix from a few 3D points and the corresponding projections. 493 | CV_EXPORTS_W Mat initCameraMatrix2D( InputArrayOfArrays objectPoints, 494 | InputArrayOfArrays imagePoints, 495 | Size imageSize, double aspectRatio=1. ); 496 | 497 | enum { CALIB_CB_ADAPTIVE_THRESH = 1, CALIB_CB_NORMALIZE_IMAGE = 2, 498 | CALIB_CB_FILTER_QUADS = 4, CALIB_CB_FAST_CHECK = 8 }; 499 | 500 | //! finds checkerboard pattern of the specified size in the image 501 | CV_EXPORTS_W bool findChessboardCorners( InputArray image, Size patternSize, 502 | OutputArray corners, 503 | int flags=CALIB_CB_ADAPTIVE_THRESH+CALIB_CB_NORMALIZE_IMAGE ); 504 | 505 | //! finds subpixel-accurate positions of the chessboard corners 506 | CV_EXPORTS bool find4QuadCornerSubpix(InputArray img, InputOutputArray corners, Size region_size); 507 | 508 | //! draws the checkerboard pattern (found or partly found) in the image 509 | CV_EXPORTS_W void drawChessboardCorners( InputOutputArray image, Size patternSize, 510 | InputArray corners, bool patternWasFound ); 511 | 512 | enum { CALIB_CB_SYMMETRIC_GRID = 1, CALIB_CB_ASYMMETRIC_GRID = 2, 513 | CALIB_CB_CLUSTERING = 4 }; 514 | 515 | //! finds circles' grid pattern of the specified size in the image 516 | CV_EXPORTS_W bool findCirclesGrid( InputArray image, Size patternSize, 517 | OutputArray centers, int flags=CALIB_CB_SYMMETRIC_GRID, 518 | const Ptr &blobDetector = new SimpleBlobDetector()); 519 | 520 | //! the deprecated function. Use findCirclesGrid() instead of it. 521 | CV_EXPORTS_W bool findCirclesGridDefault( InputArray image, Size patternSize, 522 | OutputArray centers, int flags=CALIB_CB_SYMMETRIC_GRID ); 523 | enum 524 | { 525 | CALIB_USE_INTRINSIC_GUESS = CV_CALIB_USE_INTRINSIC_GUESS, 526 | CALIB_FIX_ASPECT_RATIO = CV_CALIB_FIX_ASPECT_RATIO, 527 | CALIB_FIX_PRINCIPAL_POINT = CV_CALIB_FIX_PRINCIPAL_POINT, 528 | CALIB_ZERO_TANGENT_DIST = CV_CALIB_ZERO_TANGENT_DIST, 529 | CALIB_FIX_FOCAL_LENGTH = CV_CALIB_FIX_FOCAL_LENGTH, 530 | CALIB_FIX_K1 = CV_CALIB_FIX_K1, 531 | CALIB_FIX_K2 = CV_CALIB_FIX_K2, 532 | CALIB_FIX_K3 = CV_CALIB_FIX_K3, 533 | CALIB_FIX_K4 = CV_CALIB_FIX_K4, 534 | CALIB_FIX_K5 = CV_CALIB_FIX_K5, 535 | CALIB_FIX_K6 = CV_CALIB_FIX_K6, 536 | CALIB_RATIONAL_MODEL = CV_CALIB_RATIONAL_MODEL, 537 | // only for stereo 538 | CALIB_FIX_INTRINSIC = CV_CALIB_FIX_INTRINSIC, 539 | CALIB_SAME_FOCAL_LENGTH = CV_CALIB_SAME_FOCAL_LENGTH, 540 | // for stereo rectification 541 | CALIB_ZERO_DISPARITY = CV_CALIB_ZERO_DISPARITY 542 | }; 543 | 544 | //! finds intrinsic and extrinsic camera parameters from several fews of a known calibration pattern. 545 | CV_EXPORTS_W double calibrateCamera( InputArrayOfArrays objectPoints, 546 | InputArrayOfArrays imagePoints, 547 | Size imageSize, 548 | CV_OUT InputOutputArray cameraMatrix, 549 | CV_OUT InputOutputArray distCoeffs, 550 | OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, 551 | int flags=0, TermCriteria criteria = TermCriteria( 552 | TermCriteria::COUNT+TermCriteria::EPS, 30, DBL_EPSILON) ); 553 | 554 | //! computes several useful camera characteristics from the camera matrix, camera frame resolution and the physical sensor size. 555 | CV_EXPORTS_W void calibrationMatrixValues( InputArray cameraMatrix, 556 | Size imageSize, 557 | double apertureWidth, 558 | double apertureHeight, 559 | CV_OUT double& fovx, 560 | CV_OUT double& fovy, 561 | CV_OUT double& focalLength, 562 | CV_OUT Point2d& principalPoint, 563 | CV_OUT double& aspectRatio ); 564 | 565 | //! finds intrinsic and extrinsic parameters of a stereo camera 566 | CV_EXPORTS_W double stereoCalibrate( InputArrayOfArrays objectPoints, 567 | InputArrayOfArrays imagePoints1, 568 | InputArrayOfArrays imagePoints2, 569 | CV_OUT InputOutputArray cameraMatrix1, 570 | CV_OUT InputOutputArray distCoeffs1, 571 | CV_OUT InputOutputArray cameraMatrix2, 572 | CV_OUT InputOutputArray distCoeffs2, 573 | Size imageSize, OutputArray R, 574 | OutputArray T, OutputArray E, OutputArray F, 575 | TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 1e-6), 576 | int flags=CALIB_FIX_INTRINSIC ); 577 | 578 | 579 | //! computes the rectification transformation for a stereo camera from its intrinsic and extrinsic parameters 580 | CV_EXPORTS_W void stereoRectify( InputArray cameraMatrix1, InputArray distCoeffs1, 581 | InputArray cameraMatrix2, InputArray distCoeffs2, 582 | Size imageSize, InputArray R, InputArray T, 583 | OutputArray R1, OutputArray R2, 584 | OutputArray P1, OutputArray P2, 585 | OutputArray Q, int flags=CALIB_ZERO_DISPARITY, 586 | double alpha=-1, Size newImageSize=Size(), 587 | CV_OUT Rect* validPixROI1=0, CV_OUT Rect* validPixROI2=0 ); 588 | 589 | //! computes the rectification transformation for an uncalibrated stereo camera (zero distortion is assumed) 590 | CV_EXPORTS_W bool stereoRectifyUncalibrated( InputArray points1, InputArray points2, 591 | InputArray F, Size imgSize, 592 | OutputArray H1, OutputArray H2, 593 | double threshold=5 ); 594 | 595 | //! computes the rectification transformations for 3-head camera, where all the heads are on the same line. 596 | CV_EXPORTS_W float rectify3Collinear( InputArray cameraMatrix1, InputArray distCoeffs1, 597 | InputArray cameraMatrix2, InputArray distCoeffs2, 598 | InputArray cameraMatrix3, InputArray distCoeffs3, 599 | InputArrayOfArrays imgpt1, InputArrayOfArrays imgpt3, 600 | Size imageSize, InputArray R12, InputArray T12, 601 | InputArray R13, InputArray T13, 602 | OutputArray R1, OutputArray R2, OutputArray R3, 603 | OutputArray P1, OutputArray P2, OutputArray P3, 604 | OutputArray Q, double alpha, Size newImgSize, 605 | CV_OUT Rect* roi1, CV_OUT Rect* roi2, int flags ); 606 | 607 | //! returns the optimal new camera matrix 608 | CV_EXPORTS_W Mat getOptimalNewCameraMatrix( InputArray cameraMatrix, InputArray distCoeffs, 609 | Size imageSize, double alpha, Size newImgSize=Size(), 610 | CV_OUT Rect* validPixROI=0, bool centerPrincipalPoint=false); 611 | 612 | //! converts point coordinates from normal pixel coordinates to homogeneous coordinates ((x,y)->(x,y,1)) 613 | CV_EXPORTS_W void convertPointsToHomogeneous( InputArray src, OutputArray dst ); 614 | 615 | //! converts point coordinates from homogeneous to normal pixel coordinates ((x,y,z)->(x/z, y/z)) 616 | CV_EXPORTS_W void convertPointsFromHomogeneous( InputArray src, OutputArray dst ); 617 | 618 | //! for backward compatibility 619 | CV_EXPORTS void convertPointsHomogeneous( InputArray src, OutputArray dst ); 620 | 621 | //! the algorithm for finding fundamental matrix 622 | enum 623 | { 624 | FM_7POINT = CV_FM_7POINT, //!< 7-point algorithm 625 | FM_8POINT = CV_FM_8POINT, //!< 8-point algorithm 626 | FM_LMEDS = CV_FM_LMEDS, //!< least-median algorithm 627 | FM_RANSAC = CV_FM_RANSAC //!< RANSAC algorithm 628 | }; 629 | 630 | //! finds fundamental matrix from a set of corresponding 2D points 631 | CV_EXPORTS_W Mat findFundamentalMat( InputArray points1, InputArray points2, 632 | int method=FM_RANSAC, 633 | double param1=3., double param2=0.99, 634 | OutputArray mask=noArray()); 635 | 636 | //! variant of findFundamentalMat for backward compatibility 637 | CV_EXPORTS Mat findFundamentalMat( InputArray points1, InputArray points2, 638 | OutputArray mask, int method=FM_RANSAC, 639 | double param1=3., double param2=0.99); 640 | 641 | //! finds coordinates of epipolar lines corresponding the specified points 642 | CV_EXPORTS void computeCorrespondEpilines( InputArray points, 643 | int whichImage, InputArray F, 644 | OutputArray lines ); 645 | 646 | CV_EXPORTS_W void triangulatePoints( InputArray projMatr1, InputArray projMatr2, 647 | InputArray projPoints1, InputArray projPoints2, 648 | OutputArray points4D ); 649 | 650 | CV_EXPORTS_W void correctMatches( InputArray F, InputArray points1, InputArray points2, 651 | OutputArray newPoints1, OutputArray newPoints2 ); 652 | 653 | template<> CV_EXPORTS void Ptr::delete_obj(); 654 | 655 | /*! 656 | Block Matching Stereo Correspondence Algorithm 657 | 658 | The class implements BM stereo correspondence algorithm by K. Konolige. 659 | */ 660 | class CV_EXPORTS_W StereoBM 661 | { 662 | public: 663 | enum { PREFILTER_NORMALIZED_RESPONSE = 0, PREFILTER_XSOBEL = 1, 664 | BASIC_PRESET=0, FISH_EYE_PRESET=1, NARROW_PRESET=2 }; 665 | 666 | //! the default constructor 667 | CV_WRAP StereoBM(); 668 | //! the full constructor taking the camera-specific preset, number of disparities and the SAD window size 669 | CV_WRAP StereoBM(int preset, int ndisparities=0, int SADWindowSize=21); 670 | //! the method that reinitializes the state. The previous content is destroyed 671 | void init(int preset, int ndisparities=0, int SADWindowSize=21); 672 | //! the stereo correspondence operator. Finds the disparity for the specified rectified stereo pair 673 | CV_WRAP_AS(compute) void operator()( InputArray left, InputArray right, 674 | OutputArray disparity, int disptype=CV_16S ); 675 | 676 | //! pointer to the underlying CvStereoBMState 677 | Ptr state; 678 | }; 679 | 680 | 681 | /*! 682 | Semi-Global Block Matching Stereo Correspondence Algorithm 683 | 684 | The class implements the original SGBM stereo correspondence algorithm by H. Hirschmuller and some its modification. 685 | */ 686 | class CV_EXPORTS_W StereoSGBM 687 | { 688 | public: 689 | enum { DISP_SHIFT=4, DISP_SCALE = (1<(X,Y,Z) using the matrix Q returned by cv::stereoRectify 738 | CV_EXPORTS_W void reprojectImageTo3D( InputArray disparity, 739 | OutputArray _3dImage, InputArray Q, 740 | bool handleMissingValues=false, 741 | int ddepth=-1 ); 742 | 743 | CV_EXPORTS_W int estimateAffine3D(InputArray src, InputArray dst, 744 | OutputArray out, OutputArray inliers, 745 | double ransacThreshold=3, double confidence=0.99); 746 | 747 | } 748 | 749 | #endif 750 | 751 | #endif 752 | -------------------------------------------------------------------------------- /Calibration/opencv_h/config.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | * Software License Agreement (BSD License) 3 | * 4 | * Copyright 2008-2011 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. 5 | * Copyright 2008-2011 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | *************************************************************************/ 28 | 29 | 30 | #ifndef OPENCV_FLANN_CONFIG_H_ 31 | #define OPENCV_FLANN_CONFIG_H_ 32 | 33 | #ifdef FLANN_VERSION_ 34 | #undef FLANN_VERSION_ 35 | #endif 36 | #define FLANN_VERSION_ "1.6.10" 37 | 38 | #endif /* OPENCV_FLANN_CONFIG_H_ */ 39 | -------------------------------------------------------------------------------- /Calibration/opencv_h/defines.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | * Software License Agreement (BSD License) 3 | * 4 | * Copyright 2008-2011 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. 5 | * Copyright 2008-2011 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | *************************************************************************/ 28 | 29 | 30 | #ifndef OPENCV_FLANN_DEFINES_H_ 31 | #define OPENCV_FLANN_DEFINES_H_ 32 | 33 | #include "config.h" 34 | 35 | #ifdef FLANN_EXPORT 36 | #undef FLANN_EXPORT 37 | #endif 38 | #ifdef WIN32 39 | /* win32 dll export/import directives */ 40 | #ifdef FLANN_EXPORTS 41 | #define FLANN_EXPORT __declspec(dllexport) 42 | #elif defined(FLANN_STATIC) 43 | #define FLANN_EXPORT 44 | #else 45 | #define FLANN_EXPORT __declspec(dllimport) 46 | #endif 47 | #else 48 | /* unix needs nothing */ 49 | #define FLANN_EXPORT 50 | #endif 51 | 52 | 53 | #ifdef FLANN_DEPRECATED 54 | #undef FLANN_DEPRECATED 55 | #endif 56 | #ifdef __GNUC__ 57 | #define FLANN_DEPRECATED __attribute__ ((deprecated)) 58 | #elif defined(_MSC_VER) 59 | #define FLANN_DEPRECATED __declspec(deprecated) 60 | #else 61 | #pragma message("WARNING: You need to implement FLANN_DEPRECATED for this compiler") 62 | #define FLANN_DEPRECATED 63 | #endif 64 | 65 | 66 | #undef FLANN_PLATFORM_32_BIT 67 | #undef FLANN_PLATFORM_64_BIT 68 | #if defined __amd64__ || defined __x86_64__ || defined _WIN64 || defined _M_X64 69 | #define FLANN_PLATFORM_64_BIT 70 | #else 71 | #define FLANN_PLATFORM_32_BIT 72 | #endif 73 | 74 | 75 | #undef FLANN_ARRAY_LEN 76 | #define FLANN_ARRAY_LEN(a) (sizeof(a)/sizeof(a[0])) 77 | 78 | namespace cvflann { 79 | 80 | /* Nearest neighbour index algorithms */ 81 | enum flann_algorithm_t 82 | { 83 | FLANN_INDEX_LINEAR = 0, 84 | FLANN_INDEX_KDTREE = 1, 85 | FLANN_INDEX_KMEANS = 2, 86 | FLANN_INDEX_COMPOSITE = 3, 87 | FLANN_INDEX_KDTREE_SINGLE = 4, 88 | FLANN_INDEX_HIERARCHICAL = 5, 89 | FLANN_INDEX_LSH = 6, 90 | FLANN_INDEX_SAVED = 254, 91 | FLANN_INDEX_AUTOTUNED = 255, 92 | 93 | // deprecated constants, should use the FLANN_INDEX_* ones instead 94 | LINEAR = 0, 95 | KDTREE = 1, 96 | KMEANS = 2, 97 | COMPOSITE = 3, 98 | KDTREE_SINGLE = 4, 99 | SAVED = 254, 100 | AUTOTUNED = 255 101 | }; 102 | 103 | 104 | 105 | enum flann_centers_init_t 106 | { 107 | FLANN_CENTERS_RANDOM = 0, 108 | FLANN_CENTERS_GONZALES = 1, 109 | FLANN_CENTERS_KMEANSPP = 2, 110 | 111 | // deprecated constants, should use the FLANN_CENTERS_* ones instead 112 | CENTERS_RANDOM = 0, 113 | CENTERS_GONZALES = 1, 114 | CENTERS_KMEANSPP = 2 115 | }; 116 | 117 | enum flann_log_level_t 118 | { 119 | FLANN_LOG_NONE = 0, 120 | FLANN_LOG_FATAL = 1, 121 | FLANN_LOG_ERROR = 2, 122 | FLANN_LOG_WARN = 3, 123 | FLANN_LOG_INFO = 4 124 | }; 125 | 126 | enum flann_distance_t 127 | { 128 | FLANN_DIST_EUCLIDEAN = 1, 129 | FLANN_DIST_L2 = 1, 130 | FLANN_DIST_MANHATTAN = 2, 131 | FLANN_DIST_L1 = 2, 132 | FLANN_DIST_MINKOWSKI = 3, 133 | FLANN_DIST_MAX = 4, 134 | FLANN_DIST_HIST_INTERSECT = 5, 135 | FLANN_DIST_HELLINGER = 6, 136 | FLANN_DIST_CHI_SQUARE = 7, 137 | FLANN_DIST_CS = 7, 138 | FLANN_DIST_KULLBACK_LEIBLER = 8, 139 | FLANN_DIST_KL = 8, 140 | FLANN_DIST_HAMMING = 9, 141 | 142 | // deprecated constants, should use the FLANN_DIST_* ones instead 143 | EUCLIDEAN = 1, 144 | MANHATTAN = 2, 145 | MINKOWSKI = 3, 146 | MAX_DIST = 4, 147 | HIST_INTERSECT = 5, 148 | HELLINGER = 6, 149 | CS = 7, 150 | KL = 8, 151 | KULLBACK_LEIBLER = 8 152 | }; 153 | 154 | enum flann_datatype_t 155 | { 156 | FLANN_INT8 = 0, 157 | FLANN_INT16 = 1, 158 | FLANN_INT32 = 2, 159 | FLANN_INT64 = 3, 160 | FLANN_UINT8 = 4, 161 | FLANN_UINT16 = 5, 162 | FLANN_UINT32 = 6, 163 | FLANN_UINT64 = 7, 164 | FLANN_FLOAT32 = 8, 165 | FLANN_FLOAT64 = 9 166 | }; 167 | 168 | enum 169 | { 170 | FLANN_CHECKS_UNLIMITED = -1, 171 | FLANN_CHECKS_AUTOTUNED = -2 172 | }; 173 | 174 | } 175 | 176 | #endif /* OPENCV_FLANN_DEFINES_H_ */ 177 | -------------------------------------------------------------------------------- /Calibration/opencv_h/highgui.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef __OPENCV_HIGHGUI_HPP__ 44 | #define __OPENCV_HIGHGUI_HPP__ 45 | 46 | #include "core.hpp" 47 | #include "highgui_c.h" 48 | 49 | #ifdef __cplusplus 50 | 51 | struct CvCapture; 52 | struct CvVideoWriter; 53 | 54 | namespace cv 55 | { 56 | 57 | enum { 58 | // Flags for namedWindow 59 | WINDOW_NORMAL = CV_WINDOW_NORMAL, // the user can resize the window (no constraint) / also use to switch a fullscreen window to a normal size 60 | WINDOW_AUTOSIZE = CV_WINDOW_AUTOSIZE, // the user cannot resize the window, the size is constrainted by the image displayed 61 | WINDOW_OPENGL = CV_WINDOW_OPENGL, // window with opengl support 62 | 63 | // Flags for set / getWindowProperty 64 | WND_PROP_FULLSCREEN = CV_WND_PROP_FULLSCREEN, // fullscreen property 65 | WND_PROP_AUTOSIZE = CV_WND_PROP_AUTOSIZE, // autosize property 66 | WND_PROP_ASPECT_RATIO = CV_WND_PROP_ASPECTRATIO, // window's aspect ration 67 | WND_PROP_OPENGL = CV_WND_PROP_OPENGL // opengl support 68 | }; 69 | 70 | CV_EXPORTS_W void namedWindow(const string& winname, int flags = WINDOW_AUTOSIZE); 71 | CV_EXPORTS_W void destroyWindow(const string& winname); 72 | CV_EXPORTS_W void destroyAllWindows(); 73 | 74 | CV_EXPORTS_W int startWindowThread(); 75 | 76 | CV_EXPORTS_W int waitKey(int delay = 0); 77 | 78 | CV_EXPORTS_W void imshow(const string& winname, InputArray mat); 79 | 80 | CV_EXPORTS_W void resizeWindow(const string& winname, int width, int height); 81 | CV_EXPORTS_W void moveWindow(const string& winname, int x, int y); 82 | 83 | CV_EXPORTS_W void setWindowProperty(const string& winname, int prop_id, double prop_value);//YV 84 | CV_EXPORTS_W double getWindowProperty(const string& winname, int prop_id);//YV 85 | 86 | enum 87 | { 88 | EVENT_MOUSEMOVE =0, 89 | EVENT_LBUTTONDOWN =1, 90 | EVENT_RBUTTONDOWN =2, 91 | EVENT_MBUTTONDOWN =3, 92 | EVENT_LBUTTONUP =4, 93 | EVENT_RBUTTONUP =5, 94 | EVENT_MBUTTONUP =6, 95 | EVENT_LBUTTONDBLCLK =7, 96 | EVENT_RBUTTONDBLCLK =8, 97 | EVENT_MBUTTONDBLCLK =9 98 | }; 99 | 100 | enum 101 | { 102 | EVENT_FLAG_LBUTTON =1, 103 | EVENT_FLAG_RBUTTON =2, 104 | EVENT_FLAG_MBUTTON =4, 105 | EVENT_FLAG_CTRLKEY =8, 106 | EVENT_FLAG_SHIFTKEY =16, 107 | EVENT_FLAG_ALTKEY =32 108 | }; 109 | 110 | typedef void (*MouseCallback)(int event, int x, int y, int flags, void* userdata); 111 | 112 | //! assigns callback for mouse events 113 | CV_EXPORTS void setMouseCallback(const string& winname, MouseCallback onMouse, void* userdata = 0); 114 | 115 | 116 | typedef void (CV_CDECL *TrackbarCallback)(int pos, void* userdata); 117 | 118 | CV_EXPORTS int createTrackbar(const string& trackbarname, const string& winname, 119 | int* value, int count, 120 | TrackbarCallback onChange = 0, 121 | void* userdata = 0); 122 | 123 | CV_EXPORTS_W int getTrackbarPos(const string& trackbarname, const string& winname); 124 | CV_EXPORTS_W void setTrackbarPos(const string& trackbarname, const string& winname, int pos); 125 | 126 | // OpenGL support 127 | 128 | typedef void (*OpenGlDrawCallback)(void* userdata); 129 | CV_EXPORTS void setOpenGlDrawCallback(const string& winname, OpenGlDrawCallback onOpenGlDraw, void* userdata = 0); 130 | 131 | CV_EXPORTS void setOpenGlContext(const string& winname); 132 | 133 | CV_EXPORTS void updateWindow(const string& winname); 134 | 135 | // < Deperecated 136 | CV_EXPORTS void pointCloudShow(const string& winname, const GlCamera& camera, const GlArrays& arr); 137 | CV_EXPORTS void pointCloudShow(const string& winname, const GlCamera& camera, InputArray points, InputArray colors = noArray()); 138 | // > 139 | 140 | //Only for Qt 141 | 142 | CV_EXPORTS CvFont fontQt(const string& nameFont, int pointSize=-1, 143 | Scalar color=Scalar::all(0), int weight=CV_FONT_NORMAL, 144 | int style=CV_STYLE_NORMAL, int spacing=0); 145 | CV_EXPORTS void addText( const Mat& img, const string& text, Point org, CvFont font); 146 | 147 | CV_EXPORTS void displayOverlay(const string& winname, const string& text, int delayms CV_DEFAULT(0)); 148 | CV_EXPORTS void displayStatusBar(const string& winname, const string& text, int delayms CV_DEFAULT(0)); 149 | 150 | CV_EXPORTS void saveWindowParameters(const string& windowName); 151 | CV_EXPORTS void loadWindowParameters(const string& windowName); 152 | CV_EXPORTS int startLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]); 153 | CV_EXPORTS void stopLoop(); 154 | 155 | typedef void (CV_CDECL *ButtonCallback)(int state, void* userdata); 156 | CV_EXPORTS int createButton( const string& bar_name, ButtonCallback on_change, 157 | void* userdata=NULL, int type=CV_PUSH_BUTTON, 158 | bool initial_button_state=0); 159 | 160 | //------------------------- 161 | 162 | enum 163 | { 164 | // 8bit, color or not 165 | IMREAD_UNCHANGED =-1, 166 | // 8bit, gray 167 | IMREAD_GRAYSCALE =0, 168 | // ?, color 169 | IMREAD_COLOR =1, 170 | // any depth, ? 171 | IMREAD_ANYDEPTH =2, 172 | // ?, any color 173 | IMREAD_ANYCOLOR =4 174 | }; 175 | 176 | enum 177 | { 178 | IMWRITE_JPEG_QUALITY =1, 179 | IMWRITE_PNG_COMPRESSION =16, 180 | IMWRITE_PNG_STRATEGY =17, 181 | IMWRITE_PNG_BILEVEL =18, 182 | IMWRITE_PNG_STRATEGY_DEFAULT =0, 183 | IMWRITE_PNG_STRATEGY_FILTERED =1, 184 | IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY =2, 185 | IMWRITE_PNG_STRATEGY_RLE =3, 186 | IMWRITE_PNG_STRATEGY_FIXED =4, 187 | IMWRITE_PXM_BINARY =32 188 | }; 189 | 190 | CV_EXPORTS_W Mat imread( const string& filename, int flags=1 ); 191 | CV_EXPORTS_W bool imwrite( const string& filename, InputArray img, 192 | const vector& params=vector()); 193 | CV_EXPORTS_W Mat imdecode( InputArray buf, int flags ); 194 | CV_EXPORTS Mat imdecode( InputArray buf, int flags, Mat* dst ); 195 | CV_EXPORTS_W bool imencode( const string& ext, InputArray img, 196 | CV_OUT vector& buf, 197 | const vector& params=vector()); 198 | 199 | #ifndef CV_NO_VIDEO_CAPTURE_CPP_API 200 | 201 | template<> void CV_EXPORTS Ptr::delete_obj(); 202 | template<> void CV_EXPORTS Ptr::delete_obj(); 203 | 204 | class CV_EXPORTS_W VideoCapture 205 | { 206 | public: 207 | CV_WRAP VideoCapture(); 208 | CV_WRAP VideoCapture(const string& filename); 209 | CV_WRAP VideoCapture(int device); 210 | 211 | virtual ~VideoCapture(); 212 | CV_WRAP virtual bool open(const string& filename); 213 | CV_WRAP virtual bool open(int device); 214 | CV_WRAP virtual bool isOpened() const; 215 | CV_WRAP virtual void release(); 216 | 217 | CV_WRAP virtual bool grab(); 218 | CV_WRAP virtual bool retrieve(CV_OUT Mat& image, int channel=0); 219 | virtual VideoCapture& operator >> (CV_OUT Mat& image); 220 | CV_WRAP virtual bool read(CV_OUT Mat& image); 221 | 222 | CV_WRAP virtual bool set(int propId, double value); 223 | CV_WRAP virtual double get(int propId); 224 | 225 | protected: 226 | Ptr cap; 227 | }; 228 | 229 | 230 | class CV_EXPORTS_W VideoWriter 231 | { 232 | public: 233 | CV_WRAP VideoWriter(); 234 | CV_WRAP VideoWriter(const string& filename, int fourcc, double fps, 235 | Size frameSize, bool isColor=true); 236 | 237 | virtual ~VideoWriter(); 238 | CV_WRAP virtual bool open(const string& filename, int fourcc, double fps, 239 | Size frameSize, bool isColor=true); 240 | CV_WRAP virtual bool isOpened() const; 241 | CV_WRAP virtual void release(); 242 | virtual VideoWriter& operator << (const Mat& image); 243 | CV_WRAP virtual void write(const Mat& image); 244 | 245 | protected: 246 | Ptr writer; 247 | }; 248 | 249 | #endif 250 | 251 | } 252 | 253 | #endif 254 | 255 | #endif 256 | -------------------------------------------------------------------------------- /Calibration/opencv_h/highgui_c.h: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // Intel License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000, Intel Corporation, all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of Intel Corporation may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the Intel Corporation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef __OPENCV_HIGHGUI_H__ 43 | #define __OPENCV_HIGHGUI_H__ 44 | 45 | #include "core_c.h" 46 | 47 | #ifdef __cplusplus 48 | extern "C" { 49 | #endif /* __cplusplus */ 50 | 51 | /****************************************************************************************\ 52 | * Basic GUI functions * 53 | \****************************************************************************************/ 54 | //YV 55 | //-----------New for Qt 56 | /* For font */ 57 | enum { CV_FONT_LIGHT = 25,//QFont::Light, 58 | CV_FONT_NORMAL = 50,//QFont::Normal, 59 | CV_FONT_DEMIBOLD = 63,//QFont::DemiBold, 60 | CV_FONT_BOLD = 75,//QFont::Bold, 61 | CV_FONT_BLACK = 87 //QFont::Black 62 | }; 63 | 64 | enum { CV_STYLE_NORMAL = 0,//QFont::StyleNormal, 65 | CV_STYLE_ITALIC = 1,//QFont::StyleItalic, 66 | CV_STYLE_OBLIQUE = 2 //QFont::StyleOblique 67 | }; 68 | /* ---------*/ 69 | 70 | //for color cvScalar(blue_component, green_component, red\_component[, alpha_component]) 71 | //and alpha= 0 <-> 0xFF (not transparent <-> transparent) 72 | CVAPI(CvFont) cvFontQt(const char* nameFont, int pointSize CV_DEFAULT(-1), CvScalar color CV_DEFAULT(cvScalarAll(0)), int weight CV_DEFAULT(CV_FONT_NORMAL), int style CV_DEFAULT(CV_STYLE_NORMAL), int spacing CV_DEFAULT(0)); 73 | 74 | CVAPI(void) cvAddText(const CvArr* img, const char* text, CvPoint org, CvFont *arg2); 75 | 76 | CVAPI(void) cvDisplayOverlay(const char* name, const char* text, int delayms CV_DEFAULT(0)); 77 | CVAPI(void) cvDisplayStatusBar(const char* name, const char* text, int delayms CV_DEFAULT(0)); 78 | 79 | CVAPI(void) cvSaveWindowParameters(const char* name); 80 | CVAPI(void) cvLoadWindowParameters(const char* name); 81 | CVAPI(int) cvStartLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]); 82 | CVAPI(void) cvStopLoop( void ); 83 | 84 | typedef void (CV_CDECL *CvButtonCallback)(int state, void* userdata); 85 | enum {CV_PUSH_BUTTON = 0, CV_CHECKBOX = 1, CV_RADIOBOX = 2}; 86 | CVAPI(int) cvCreateButton( const char* button_name CV_DEFAULT(NULL),CvButtonCallback on_change CV_DEFAULT(NULL), void* userdata CV_DEFAULT(NULL) , int button_type CV_DEFAULT(CV_PUSH_BUTTON), int initial_button_state CV_DEFAULT(0)); 87 | //---------------------- 88 | 89 | 90 | /* this function is used to set some external parameters in case of X Window */ 91 | CVAPI(int) cvInitSystem( int argc, char** argv ); 92 | 93 | CVAPI(int) cvStartWindowThread( void ); 94 | 95 | // --------- YV --------- 96 | enum 97 | { 98 | //These 3 flags are used by cvSet/GetWindowProperty 99 | CV_WND_PROP_FULLSCREEN = 0, //to change/get window's fullscreen property 100 | CV_WND_PROP_AUTOSIZE = 1, //to change/get window's autosize property 101 | CV_WND_PROP_ASPECTRATIO= 2, //to change/get window's aspectratio property 102 | CV_WND_PROP_OPENGL = 3, //to change/get window's opengl support 103 | 104 | //These 2 flags are used by cvNamedWindow and cvSet/GetWindowProperty 105 | CV_WINDOW_NORMAL = 0x00000000, //the user can resize the window (no constraint) / also use to switch a fullscreen window to a normal size 106 | CV_WINDOW_AUTOSIZE = 0x00000001, //the user cannot resize the window, the size is constrainted by the image displayed 107 | CV_WINDOW_OPENGL = 0x00001000, //window with opengl support 108 | 109 | //Those flags are only for Qt 110 | CV_GUI_EXPANDED = 0x00000000, //status bar and tool bar 111 | CV_GUI_NORMAL = 0x00000010, //old fashious way 112 | 113 | //These 3 flags are used by cvNamedWindow and cvSet/GetWindowProperty 114 | CV_WINDOW_FULLSCREEN = 1,//change the window to fullscreen 115 | CV_WINDOW_FREERATIO = 0x00000100,//the image expends as much as it can (no ratio constraint) 116 | CV_WINDOW_KEEPRATIO = 0x00000000//the ration image is respected. 117 | }; 118 | 119 | /* create window */ 120 | CVAPI(int) cvNamedWindow( const char* name, int flags CV_DEFAULT(CV_WINDOW_AUTOSIZE) ); 121 | 122 | /* Set and Get Property of the window */ 123 | CVAPI(void) cvSetWindowProperty(const char* name, int prop_id, double prop_value); 124 | CVAPI(double) cvGetWindowProperty(const char* name, int prop_id); 125 | 126 | /* display image within window (highgui windows remember their content) */ 127 | CVAPI(void) cvShowImage( const char* name, const CvArr* image ); 128 | 129 | /* resize/move window */ 130 | CVAPI(void) cvResizeWindow( const char* name, int width, int height ); 131 | CVAPI(void) cvMoveWindow( const char* name, int x, int y ); 132 | 133 | 134 | /* destroy window and all the trackers associated with it */ 135 | CVAPI(void) cvDestroyWindow( const char* name ); 136 | 137 | CVAPI(void) cvDestroyAllWindows(void); 138 | 139 | /* get native window handle (HWND in case of Win32 and Widget in case of X Window) */ 140 | CVAPI(void*) cvGetWindowHandle( const char* name ); 141 | 142 | /* get name of highgui window given its native handle */ 143 | CVAPI(const char*) cvGetWindowName( void* window_handle ); 144 | 145 | 146 | typedef void (CV_CDECL *CvTrackbarCallback)(int pos); 147 | 148 | /* create trackbar and display it on top of given window, set callback */ 149 | CVAPI(int) cvCreateTrackbar( const char* trackbar_name, const char* window_name, 150 | int* value, int count, CvTrackbarCallback on_change CV_DEFAULT(NULL)); 151 | 152 | typedef void (CV_CDECL *CvTrackbarCallback2)(int pos, void* userdata); 153 | 154 | CVAPI(int) cvCreateTrackbar2( const char* trackbar_name, const char* window_name, 155 | int* value, int count, CvTrackbarCallback2 on_change, 156 | void* userdata CV_DEFAULT(0)); 157 | 158 | /* retrieve or set trackbar position */ 159 | CVAPI(int) cvGetTrackbarPos( const char* trackbar_name, const char* window_name ); 160 | CVAPI(void) cvSetTrackbarPos( const char* trackbar_name, const char* window_name, int pos ); 161 | 162 | enum 163 | { 164 | CV_EVENT_MOUSEMOVE =0, 165 | CV_EVENT_LBUTTONDOWN =1, 166 | CV_EVENT_RBUTTONDOWN =2, 167 | CV_EVENT_MBUTTONDOWN =3, 168 | CV_EVENT_LBUTTONUP =4, 169 | CV_EVENT_RBUTTONUP =5, 170 | CV_EVENT_MBUTTONUP =6, 171 | CV_EVENT_LBUTTONDBLCLK =7, 172 | CV_EVENT_RBUTTONDBLCLK =8, 173 | CV_EVENT_MBUTTONDBLCLK =9 174 | }; 175 | 176 | enum 177 | { 178 | CV_EVENT_FLAG_LBUTTON =1, 179 | CV_EVENT_FLAG_RBUTTON =2, 180 | CV_EVENT_FLAG_MBUTTON =4, 181 | CV_EVENT_FLAG_CTRLKEY =8, 182 | CV_EVENT_FLAG_SHIFTKEY =16, 183 | CV_EVENT_FLAG_ALTKEY =32 184 | }; 185 | 186 | typedef void (CV_CDECL *CvMouseCallback )(int event, int x, int y, int flags, void* param); 187 | 188 | /* assign callback for mouse events */ 189 | CVAPI(void) cvSetMouseCallback( const char* window_name, CvMouseCallback on_mouse, 190 | void* param CV_DEFAULT(NULL)); 191 | 192 | enum 193 | { 194 | /* 8bit, color or not */ 195 | CV_LOAD_IMAGE_UNCHANGED =-1, 196 | /* 8bit, gray */ 197 | CV_LOAD_IMAGE_GRAYSCALE =0, 198 | /* ?, color */ 199 | CV_LOAD_IMAGE_COLOR =1, 200 | /* any depth, ? */ 201 | CV_LOAD_IMAGE_ANYDEPTH =2, 202 | /* ?, any color */ 203 | CV_LOAD_IMAGE_ANYCOLOR =4 204 | }; 205 | 206 | /* load image from file 207 | iscolor can be a combination of above flags where CV_LOAD_IMAGE_UNCHANGED 208 | overrides the other flags 209 | using CV_LOAD_IMAGE_ANYCOLOR alone is equivalent to CV_LOAD_IMAGE_UNCHANGED 210 | unless CV_LOAD_IMAGE_ANYDEPTH is specified images are converted to 8bit 211 | */ 212 | CVAPI(IplImage*) cvLoadImage( const char* filename, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR)); 213 | CVAPI(CvMat*) cvLoadImageM( const char* filename, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR)); 214 | 215 | enum 216 | { 217 | CV_IMWRITE_JPEG_QUALITY =1, 218 | CV_IMWRITE_PNG_COMPRESSION =16, 219 | CV_IMWRITE_PNG_STRATEGY =17, 220 | CV_IMWRITE_PNG_BILEVEL =18, 221 | CV_IMWRITE_PNG_STRATEGY_DEFAULT =0, 222 | CV_IMWRITE_PNG_STRATEGY_FILTERED =1, 223 | CV_IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY =2, 224 | CV_IMWRITE_PNG_STRATEGY_RLE =3, 225 | CV_IMWRITE_PNG_STRATEGY_FIXED =4, 226 | CV_IMWRITE_PXM_BINARY =32 227 | }; 228 | 229 | /* save image to file */ 230 | CVAPI(int) cvSaveImage( const char* filename, const CvArr* image, 231 | const int* params CV_DEFAULT(0) ); 232 | 233 | /* decode image stored in the buffer */ 234 | CVAPI(IplImage*) cvDecodeImage( const CvMat* buf, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR)); 235 | CVAPI(CvMat*) cvDecodeImageM( const CvMat* buf, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR)); 236 | 237 | /* encode image and store the result as a byte vector (single-row 8uC1 matrix) */ 238 | CVAPI(CvMat*) cvEncodeImage( const char* ext, const CvArr* image, 239 | const int* params CV_DEFAULT(0) ); 240 | 241 | enum 242 | { 243 | CV_CVTIMG_FLIP =1, 244 | CV_CVTIMG_SWAP_RB =2 245 | }; 246 | 247 | /* utility function: convert one image to another with optional vertical flip */ 248 | CVAPI(void) cvConvertImage( const CvArr* src, CvArr* dst, int flags CV_DEFAULT(0)); 249 | 250 | /* wait for key event infinitely (delay<=0) or for "delay" milliseconds */ 251 | CVAPI(int) cvWaitKey(int delay CV_DEFAULT(0)); 252 | 253 | // OpenGL support 254 | 255 | typedef void (CV_CDECL *CvOpenGlDrawCallback)(void* userdata); 256 | CVAPI(void) cvSetOpenGlDrawCallback(const char* window_name, CvOpenGlDrawCallback callback, void* userdata CV_DEFAULT(NULL)); 257 | 258 | CVAPI(void) cvSetOpenGlContext(const char* window_name); 259 | CVAPI(void) cvUpdateWindow(const char* window_name); 260 | 261 | 262 | /****************************************************************************************\ 263 | * Working with Video Files and Cameras * 264 | \****************************************************************************************/ 265 | 266 | /* "black box" capture structure */ 267 | typedef struct CvCapture CvCapture; 268 | 269 | /* start capturing frames from video file */ 270 | CVAPI(CvCapture*) cvCreateFileCapture( const char* filename ); 271 | 272 | enum 273 | { 274 | CV_CAP_ANY =0, // autodetect 275 | 276 | CV_CAP_MIL =100, // MIL proprietary drivers 277 | 278 | CV_CAP_VFW =200, // platform native 279 | CV_CAP_V4L =200, 280 | CV_CAP_V4L2 =200, 281 | 282 | CV_CAP_FIREWARE =300, // IEEE 1394 drivers 283 | CV_CAP_FIREWIRE =300, 284 | CV_CAP_IEEE1394 =300, 285 | CV_CAP_DC1394 =300, 286 | CV_CAP_CMU1394 =300, 287 | 288 | CV_CAP_STEREO =400, // TYZX proprietary drivers 289 | CV_CAP_TYZX =400, 290 | CV_TYZX_LEFT =400, 291 | CV_TYZX_RIGHT =401, 292 | CV_TYZX_COLOR =402, 293 | CV_TYZX_Z =403, 294 | 295 | CV_CAP_QT =500, // QuickTime 296 | 297 | CV_CAP_UNICAP =600, // Unicap drivers 298 | 299 | CV_CAP_DSHOW =700, // DirectShow (via videoInput) 300 | CV_CAP_MSMF =1400, // Microsoft Media Foundation (via videoInput) 301 | 302 | CV_CAP_PVAPI =800, // PvAPI, Prosilica GigE SDK 303 | 304 | CV_CAP_OPENNI =900, // OpenNI (for Kinect) 305 | CV_CAP_OPENNI_ASUS =910, // OpenNI (for Asus Xtion) 306 | 307 | CV_CAP_ANDROID =1000, // Android 308 | 309 | CV_CAP_XIAPI =1100, // XIMEA Camera API 310 | 311 | CV_CAP_AVFOUNDATION = 1200, // AVFoundation framework for iOS (OS X Lion will have the same API) 312 | 313 | CV_CAP_GIGANETIX = 1300 // Smartek Giganetix GigEVisionSDK 314 | }; 315 | 316 | /* start capturing frames from camera: index = camera_index + domain_offset (CV_CAP_*) */ 317 | CVAPI(CvCapture*) cvCreateCameraCapture( int index ); 318 | 319 | /* grab a frame, return 1 on success, 0 on fail. 320 | this function is thought to be fast */ 321 | CVAPI(int) cvGrabFrame( CvCapture* capture ); 322 | 323 | /* get the frame grabbed with cvGrabFrame(..) 324 | This function may apply some frame processing like 325 | frame decompression, flipping etc. 326 | !!!DO NOT RELEASE or MODIFY the retrieved frame!!! */ 327 | CVAPI(IplImage*) cvRetrieveFrame( CvCapture* capture, int streamIdx CV_DEFAULT(0) ); 328 | 329 | /* Just a combination of cvGrabFrame and cvRetrieveFrame 330 | !!!DO NOT RELEASE or MODIFY the retrieved frame!!! */ 331 | CVAPI(IplImage*) cvQueryFrame( CvCapture* capture ); 332 | 333 | /* stop capturing/reading and free resources */ 334 | CVAPI(void) cvReleaseCapture( CvCapture** capture ); 335 | 336 | enum 337 | { 338 | // modes of the controlling registers (can be: auto, manual, auto single push, absolute Latter allowed with any other mode) 339 | // every feature can have only one mode turned on at a time 340 | CV_CAP_PROP_DC1394_OFF = -4, //turn the feature off (not controlled manually nor automatically) 341 | CV_CAP_PROP_DC1394_MODE_MANUAL = -3, //set automatically when a value of the feature is set by the user 342 | CV_CAP_PROP_DC1394_MODE_AUTO = -2, 343 | CV_CAP_PROP_DC1394_MODE_ONE_PUSH_AUTO = -1, 344 | CV_CAP_PROP_POS_MSEC =0, 345 | CV_CAP_PROP_POS_FRAMES =1, 346 | CV_CAP_PROP_POS_AVI_RATIO =2, 347 | CV_CAP_PROP_FRAME_WIDTH =3, 348 | CV_CAP_PROP_FRAME_HEIGHT =4, 349 | CV_CAP_PROP_FPS =5, 350 | CV_CAP_PROP_FOURCC =6, 351 | CV_CAP_PROP_FRAME_COUNT =7, 352 | CV_CAP_PROP_FORMAT =8, 353 | CV_CAP_PROP_MODE =9, 354 | CV_CAP_PROP_BRIGHTNESS =10, 355 | CV_CAP_PROP_CONTRAST =11, 356 | CV_CAP_PROP_SATURATION =12, 357 | CV_CAP_PROP_HUE =13, 358 | CV_CAP_PROP_GAIN =14, 359 | CV_CAP_PROP_EXPOSURE =15, 360 | CV_CAP_PROP_CONVERT_RGB =16, 361 | CV_CAP_PROP_WHITE_BALANCE_BLUE_U =17, 362 | CV_CAP_PROP_RECTIFICATION =18, 363 | CV_CAP_PROP_MONOCROME =19, 364 | CV_CAP_PROP_SHARPNESS =20, 365 | CV_CAP_PROP_AUTO_EXPOSURE =21, // exposure control done by camera, 366 | // user can adjust refernce level 367 | // using this feature 368 | CV_CAP_PROP_GAMMA =22, 369 | CV_CAP_PROP_TEMPERATURE =23, 370 | CV_CAP_PROP_TRIGGER =24, 371 | CV_CAP_PROP_TRIGGER_DELAY =25, 372 | CV_CAP_PROP_WHITE_BALANCE_RED_V =26, 373 | CV_CAP_PROP_ZOOM =27, 374 | CV_CAP_PROP_FOCUS =28, 375 | CV_CAP_PROP_GUID =29, 376 | CV_CAP_PROP_ISO_SPEED =30, 377 | CV_CAP_PROP_MAX_DC1394 =31, 378 | CV_CAP_PROP_BACKLIGHT =32, 379 | CV_CAP_PROP_PAN =33, 380 | CV_CAP_PROP_TILT =34, 381 | CV_CAP_PROP_ROLL =35, 382 | CV_CAP_PROP_IRIS =36, 383 | CV_CAP_PROP_SETTINGS =37, 384 | 385 | CV_CAP_PROP_AUTOGRAB =1024, // property for highgui class CvCapture_Android only 386 | CV_CAP_PROP_SUPPORTED_PREVIEW_SIZES_STRING=1025, // readonly, tricky property, returns cpnst char* indeed 387 | CV_CAP_PROP_PREVIEW_FORMAT=1026, // readonly, tricky property, returns cpnst char* indeed 388 | 389 | // OpenNI map generators 390 | CV_CAP_OPENNI_DEPTH_GENERATOR = 1 << 31, 391 | CV_CAP_OPENNI_IMAGE_GENERATOR = 1 << 30, 392 | CV_CAP_OPENNI_GENERATORS_MASK = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_OPENNI_IMAGE_GENERATOR, 393 | 394 | // Properties of cameras available through OpenNI interfaces 395 | CV_CAP_PROP_OPENNI_OUTPUT_MODE = 100, 396 | CV_CAP_PROP_OPENNI_FRAME_MAX_DEPTH = 101, // in mm 397 | CV_CAP_PROP_OPENNI_BASELINE = 102, // in mm 398 | CV_CAP_PROP_OPENNI_FOCAL_LENGTH = 103, // in pixels 399 | CV_CAP_PROP_OPENNI_REGISTRATION = 104, // flag 400 | CV_CAP_PROP_OPENNI_REGISTRATION_ON = CV_CAP_PROP_OPENNI_REGISTRATION, // flag that synchronizes the remapping depth map to image map 401 | // by changing depth generator's view point (if the flag is "on") or 402 | // sets this view point to its normal one (if the flag is "off"). 403 | CV_CAP_PROP_OPENNI_APPROX_FRAME_SYNC = 105, 404 | CV_CAP_PROP_OPENNI_MAX_BUFFER_SIZE = 106, 405 | CV_CAP_PROP_OPENNI_CIRCLE_BUFFER = 107, 406 | CV_CAP_PROP_OPENNI_MAX_TIME_DURATION = 108, 407 | 408 | CV_CAP_PROP_OPENNI_GENERATOR_PRESENT = 109, 409 | 410 | CV_CAP_OPENNI_IMAGE_GENERATOR_PRESENT = CV_CAP_OPENNI_IMAGE_GENERATOR + CV_CAP_PROP_OPENNI_GENERATOR_PRESENT, 411 | CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE = CV_CAP_OPENNI_IMAGE_GENERATOR + CV_CAP_PROP_OPENNI_OUTPUT_MODE, 412 | CV_CAP_OPENNI_DEPTH_GENERATOR_BASELINE = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_BASELINE, 413 | CV_CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_FOCAL_LENGTH, 414 | CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_REGISTRATION, 415 | CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON = CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION, 416 | 417 | // Properties of cameras available through GStreamer interface 418 | CV_CAP_GSTREAMER_QUEUE_LENGTH = 200, // default is 1 419 | CV_CAP_PROP_PVAPI_MULTICASTIP = 300, // ip for anable multicast master mode. 0 for disable multicast 420 | 421 | // Properties of cameras available through XIMEA SDK interface 422 | CV_CAP_PROP_XI_DOWNSAMPLING = 400, // Change image resolution by binning or skipping. 423 | CV_CAP_PROP_XI_DATA_FORMAT = 401, // Output data format. 424 | CV_CAP_PROP_XI_OFFSET_X = 402, // Horizontal offset from the origin to the area of interest (in pixels). 425 | CV_CAP_PROP_XI_OFFSET_Y = 403, // Vertical offset from the origin to the area of interest (in pixels). 426 | CV_CAP_PROP_XI_TRG_SOURCE = 404, // Defines source of trigger. 427 | CV_CAP_PROP_XI_TRG_SOFTWARE = 405, // Generates an internal trigger. PRM_TRG_SOURCE must be set to TRG_SOFTWARE. 428 | CV_CAP_PROP_XI_GPI_SELECTOR = 406, // Selects general purpose input 429 | CV_CAP_PROP_XI_GPI_MODE = 407, // Set general purpose input mode 430 | CV_CAP_PROP_XI_GPI_LEVEL = 408, // Get general purpose level 431 | CV_CAP_PROP_XI_GPO_SELECTOR = 409, // Selects general purpose output 432 | CV_CAP_PROP_XI_GPO_MODE = 410, // Set general purpose output mode 433 | CV_CAP_PROP_XI_LED_SELECTOR = 411, // Selects camera signalling LED 434 | CV_CAP_PROP_XI_LED_MODE = 412, // Define camera signalling LED functionality 435 | CV_CAP_PROP_XI_MANUAL_WB = 413, // Calculates White Balance(must be called during acquisition) 436 | CV_CAP_PROP_XI_AUTO_WB = 414, // Automatic white balance 437 | CV_CAP_PROP_XI_AEAG = 415, // Automatic exposure/gain 438 | CV_CAP_PROP_XI_EXP_PRIORITY = 416, // Exposure priority (0.5 - exposure 50%, gain 50%). 439 | CV_CAP_PROP_XI_AE_MAX_LIMIT = 417, // Maximum limit of exposure in AEAG procedure 440 | CV_CAP_PROP_XI_AG_MAX_LIMIT = 418, // Maximum limit of gain in AEAG procedure 441 | CV_CAP_PROP_XI_AEAG_LEVEL = 419, // Average intensity of output signal AEAG should achieve(in %) 442 | CV_CAP_PROP_XI_TIMEOUT = 420, // Image capture timeout in milliseconds 443 | 444 | // Properties for Android cameras 445 | CV_CAP_PROP_ANDROID_FLASH_MODE = 8001, 446 | CV_CAP_PROP_ANDROID_FOCUS_MODE = 8002, 447 | CV_CAP_PROP_ANDROID_WHITE_BALANCE = 8003, 448 | CV_CAP_PROP_ANDROID_ANTIBANDING = 8004, 449 | CV_CAP_PROP_ANDROID_FOCAL_LENGTH = 8005, 450 | CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_NEAR = 8006, 451 | CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_OPTIMAL = 8007, 452 | CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_FAR = 8008, 453 | 454 | // Properties of cameras available through AVFOUNDATION interface 455 | CV_CAP_PROP_IOS_DEVICE_FOCUS = 9001, 456 | CV_CAP_PROP_IOS_DEVICE_EXPOSURE = 9002, 457 | CV_CAP_PROP_IOS_DEVICE_FLASH = 9003, 458 | CV_CAP_PROP_IOS_DEVICE_WHITEBALANCE = 9004, 459 | CV_CAP_PROP_IOS_DEVICE_TORCH = 9005 460 | 461 | // Properties of cameras available through Smartek Giganetix Ethernet Vision interface 462 | /* --- Vladimir Litvinenko (litvinenko.vladimir@gmail.com) --- */ 463 | ,CV_CAP_PROP_GIGA_FRAME_OFFSET_X = 10001, 464 | CV_CAP_PROP_GIGA_FRAME_OFFSET_Y = 10002, 465 | CV_CAP_PROP_GIGA_FRAME_WIDTH_MAX = 10003, 466 | CV_CAP_PROP_GIGA_FRAME_HEIGH_MAX = 10004, 467 | CV_CAP_PROP_GIGA_FRAME_SENS_WIDTH = 10005, 468 | CV_CAP_PROP_GIGA_FRAME_SENS_HEIGH = 10006 469 | }; 470 | 471 | enum 472 | { 473 | // Data given from depth generator. 474 | CV_CAP_OPENNI_DEPTH_MAP = 0, // Depth values in mm (CV_16UC1) 475 | CV_CAP_OPENNI_POINT_CLOUD_MAP = 1, // XYZ in meters (CV_32FC3) 476 | CV_CAP_OPENNI_DISPARITY_MAP = 2, // Disparity in pixels (CV_8UC1) 477 | CV_CAP_OPENNI_DISPARITY_MAP_32F = 3, // Disparity in pixels (CV_32FC1) 478 | CV_CAP_OPENNI_VALID_DEPTH_MASK = 4, // CV_8UC1 479 | 480 | // Data given from RGB image generator. 481 | CV_CAP_OPENNI_BGR_IMAGE = 5, 482 | CV_CAP_OPENNI_GRAY_IMAGE = 6 483 | }; 484 | 485 | // Supported output modes of OpenNI image generator 486 | enum 487 | { 488 | CV_CAP_OPENNI_VGA_30HZ = 0, 489 | CV_CAP_OPENNI_SXGA_15HZ = 1, 490 | CV_CAP_OPENNI_SXGA_30HZ = 2, 491 | CV_CAP_OPENNI_QVGA_30HZ = 3, 492 | CV_CAP_OPENNI_QVGA_60HZ = 4 493 | }; 494 | 495 | //supported by Android camera output formats 496 | enum 497 | { 498 | CV_CAP_ANDROID_COLOR_FRAME_BGR = 0, //BGR 499 | CV_CAP_ANDROID_COLOR_FRAME = CV_CAP_ANDROID_COLOR_FRAME_BGR, 500 | CV_CAP_ANDROID_GREY_FRAME = 1, //Y 501 | CV_CAP_ANDROID_COLOR_FRAME_RGB = 2, 502 | CV_CAP_ANDROID_COLOR_FRAME_BGRA = 3, 503 | CV_CAP_ANDROID_COLOR_FRAME_RGBA = 4 504 | }; 505 | 506 | // supported Android camera flash modes 507 | enum 508 | { 509 | CV_CAP_ANDROID_FLASH_MODE_AUTO = 0, 510 | CV_CAP_ANDROID_FLASH_MODE_OFF, 511 | CV_CAP_ANDROID_FLASH_MODE_ON, 512 | CV_CAP_ANDROID_FLASH_MODE_RED_EYE, 513 | CV_CAP_ANDROID_FLASH_MODE_TORCH 514 | }; 515 | 516 | // supported Android camera focus modes 517 | enum 518 | { 519 | CV_CAP_ANDROID_FOCUS_MODE_AUTO = 0, 520 | CV_CAP_ANDROID_FOCUS_MODE_CONTINUOUS_VIDEO, 521 | CV_CAP_ANDROID_FOCUS_MODE_EDOF, 522 | CV_CAP_ANDROID_FOCUS_MODE_FIXED, 523 | CV_CAP_ANDROID_FOCUS_MODE_INFINITY, 524 | CV_CAP_ANDROID_FOCUS_MODE_MACRO 525 | }; 526 | 527 | // supported Android camera white balance modes 528 | enum 529 | { 530 | CV_CAP_ANDROID_WHITE_BALANCE_AUTO = 0, 531 | CV_CAP_ANDROID_WHITE_BALANCE_CLOUDY_DAYLIGHT, 532 | CV_CAP_ANDROID_WHITE_BALANCE_DAYLIGHT, 533 | CV_CAP_ANDROID_WHITE_BALANCE_FLUORESCENT, 534 | CV_CAP_ANDROID_WHITE_BALANCE_INCANDESCENT, 535 | CV_CAP_ANDROID_WHITE_BALANCE_SHADE, 536 | CV_CAP_ANDROID_WHITE_BALANCE_TWILIGHT, 537 | CV_CAP_ANDROID_WHITE_BALANCE_WARM_FLUORESCENT 538 | }; 539 | 540 | // supported Android camera antibanding modes 541 | enum 542 | { 543 | CV_CAP_ANDROID_ANTIBANDING_50HZ = 0, 544 | CV_CAP_ANDROID_ANTIBANDING_60HZ, 545 | CV_CAP_ANDROID_ANTIBANDING_AUTO, 546 | CV_CAP_ANDROID_ANTIBANDING_OFF 547 | }; 548 | 549 | /* retrieve or set capture properties */ 550 | CVAPI(double) cvGetCaptureProperty( CvCapture* capture, int property_id ); 551 | CVAPI(int) cvSetCaptureProperty( CvCapture* capture, int property_id, double value ); 552 | 553 | // Return the type of the capturer (eg, CV_CAP_V4W, CV_CAP_UNICAP), which is unknown if created with CV_CAP_ANY 554 | CVAPI(int) cvGetCaptureDomain( CvCapture* capture); 555 | 556 | /* "black box" video file writer structure */ 557 | typedef struct CvVideoWriter CvVideoWriter; 558 | 559 | CV_INLINE int CV_FOURCC(char c1, char c2, char c3, char c4) 560 | { 561 | return (c1 & 255) + ((c2 & 255) << 8) + ((c3 & 255) << 16) + ((c4 & 255) << 24); 562 | } 563 | 564 | #define CV_FOURCC_PROMPT -1 /* Open Codec Selection Dialog (Windows only) */ 565 | #define CV_FOURCC_DEFAULT CV_FOURCC('I', 'Y', 'U', 'V') /* Use default codec for specified filename (Linux only) */ 566 | 567 | /* initialize video file writer */ 568 | CVAPI(CvVideoWriter*) cvCreateVideoWriter( const char* filename, int fourcc, 569 | double fps, CvSize frame_size, 570 | int is_color CV_DEFAULT(1)); 571 | 572 | //CVAPI(CvVideoWriter*) cvCreateImageSequenceWriter( const char* filename, 573 | // int is_color CV_DEFAULT(1)); 574 | 575 | /* write frame to video file */ 576 | CVAPI(int) cvWriteFrame( CvVideoWriter* writer, const IplImage* image ); 577 | 578 | /* close video file writer */ 579 | CVAPI(void) cvReleaseVideoWriter( CvVideoWriter** writer ); 580 | 581 | /****************************************************************************************\ 582 | * Obsolete functions/synonyms * 583 | \****************************************************************************************/ 584 | 585 | #define cvCaptureFromFile cvCreateFileCapture 586 | #define cvCaptureFromCAM cvCreateCameraCapture 587 | #define cvCaptureFromAVI cvCaptureFromFile 588 | #define cvCreateAVIWriter cvCreateVideoWriter 589 | #define cvWriteToAVI cvWriteFrame 590 | #define cvAddSearchPath(path) 591 | #define cvvInitSystem cvInitSystem 592 | #define cvvNamedWindow cvNamedWindow 593 | #define cvvShowImage cvShowImage 594 | #define cvvResizeWindow cvResizeWindow 595 | #define cvvDestroyWindow cvDestroyWindow 596 | #define cvvCreateTrackbar cvCreateTrackbar 597 | #define cvvLoadImage(name) cvLoadImage((name),1) 598 | #define cvvSaveImage cvSaveImage 599 | #define cvvAddSearchPath cvAddSearchPath 600 | #define cvvWaitKey(name) cvWaitKey(0) 601 | #define cvvWaitKeyEx(name,delay) cvWaitKey(delay) 602 | #define cvvConvertImage cvConvertImage 603 | #define HG_AUTOSIZE CV_WINDOW_AUTOSIZE 604 | #define set_preprocess_func cvSetPreprocessFuncWin32 605 | #define set_postprocess_func cvSetPostprocessFuncWin32 606 | 607 | #if defined WIN32 || defined _WIN32 608 | 609 | CVAPI(void) cvSetPreprocessFuncWin32_(const void* callback); 610 | CVAPI(void) cvSetPostprocessFuncWin32_(const void* callback); 611 | #define cvSetPreprocessFuncWin32(callback) cvSetPreprocessFuncWin32_((const void*)(callback)) 612 | #define cvSetPostprocessFuncWin32(callback) cvSetPostprocessFuncWin32_((const void*)(callback)) 613 | 614 | #endif 615 | 616 | #ifdef __cplusplus 617 | } 618 | #endif 619 | 620 | #endif 621 | -------------------------------------------------------------------------------- /Calibration/opencv_h/imgproc_c.h: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef __OPENCV_IMGPROC_IMGPROC_C_H__ 44 | #define __OPENCV_IMGPROC_IMGPROC_C_H__ 45 | 46 | #include "core_c.h" 47 | #include "types_c_imgproc.h" 48 | 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | /*********************** Background statistics accumulation *****************************/ 54 | 55 | /* Adds image to accumulator */ 56 | CVAPI(void) cvAcc( const CvArr* image, CvArr* sum, 57 | const CvArr* mask CV_DEFAULT(NULL) ); 58 | 59 | /* Adds squared image to accumulator */ 60 | CVAPI(void) cvSquareAcc( const CvArr* image, CvArr* sqsum, 61 | const CvArr* mask CV_DEFAULT(NULL) ); 62 | 63 | /* Adds a product of two images to accumulator */ 64 | CVAPI(void) cvMultiplyAcc( const CvArr* image1, const CvArr* image2, CvArr* acc, 65 | const CvArr* mask CV_DEFAULT(NULL) ); 66 | 67 | /* Adds image to accumulator with weights: acc = acc*(1-alpha) + image*alpha */ 68 | CVAPI(void) cvRunningAvg( const CvArr* image, CvArr* acc, double alpha, 69 | const CvArr* mask CV_DEFAULT(NULL) ); 70 | 71 | /****************************************************************************************\ 72 | * Image Processing * 73 | \****************************************************************************************/ 74 | 75 | /* Copies source 2D array inside of the larger destination array and 76 | makes a border of the specified type (IPL_BORDER_*) around the copied area. */ 77 | CVAPI(void) cvCopyMakeBorder( const CvArr* src, CvArr* dst, CvPoint offset, 78 | int bordertype, CvScalar value CV_DEFAULT(cvScalarAll(0))); 79 | 80 | /* Smoothes array (removes noise) */ 81 | CVAPI(void) cvSmooth( const CvArr* src, CvArr* dst, 82 | int smoothtype CV_DEFAULT(CV_GAUSSIAN), 83 | int size1 CV_DEFAULT(3), 84 | int size2 CV_DEFAULT(0), 85 | double sigma1 CV_DEFAULT(0), 86 | double sigma2 CV_DEFAULT(0)); 87 | 88 | /* Convolves the image with the kernel */ 89 | CVAPI(void) cvFilter2D( const CvArr* src, CvArr* dst, const CvMat* kernel, 90 | CvPoint anchor CV_DEFAULT(cvPoint(-1,-1))); 91 | 92 | /* Finds integral image: SUM(X,Y) = sum(x. 458 | After that sum of histogram bins is equal to */ 459 | CVAPI(void) cvNormalizeHist( CvHistogram* hist, double factor ); 460 | 461 | 462 | /* Clear all histogram bins that are below the threshold */ 463 | CVAPI(void) cvThreshHist( CvHistogram* hist, double threshold ); 464 | 465 | 466 | /* Compares two histogram */ 467 | CVAPI(double) cvCompareHist( const CvHistogram* hist1, 468 | const CvHistogram* hist2, 469 | int method); 470 | 471 | /* Copies one histogram to another. Destination histogram is created if 472 | the destination pointer is NULL */ 473 | CVAPI(void) cvCopyHist( const CvHistogram* src, CvHistogram** dst ); 474 | 475 | 476 | /* Calculates bayesian probabilistic histograms 477 | (each or src and dst is an array of histograms */ 478 | CVAPI(void) cvCalcBayesianProb( CvHistogram** src, int number, 479 | CvHistogram** dst); 480 | 481 | /* Calculates array histogram */ 482 | CVAPI(void) cvCalcArrHist( CvArr** arr, CvHistogram* hist, 483 | int accumulate CV_DEFAULT(0), 484 | const CvArr* mask CV_DEFAULT(NULL) ); 485 | 486 | CV_INLINE void cvCalcHist( IplImage** image, CvHistogram* hist, 487 | int accumulate CV_DEFAULT(0), 488 | const CvArr* mask CV_DEFAULT(NULL) ) 489 | { 490 | cvCalcArrHist( (CvArr**)image, hist, accumulate, mask ); 491 | } 492 | 493 | /* Calculates back project */ 494 | CVAPI(void) cvCalcArrBackProject( CvArr** image, CvArr* dst, 495 | const CvHistogram* hist ); 496 | #define cvCalcBackProject(image, dst, hist) cvCalcArrBackProject((CvArr**)image, dst, hist) 497 | 498 | 499 | /* Does some sort of template matching but compares histograms of 500 | template and each window location */ 501 | CVAPI(void) cvCalcArrBackProjectPatch( CvArr** image, CvArr* dst, CvSize range, 502 | CvHistogram* hist, int method, 503 | double factor ); 504 | #define cvCalcBackProjectPatch( image, dst, range, hist, method, factor ) \ 505 | cvCalcArrBackProjectPatch( (CvArr**)image, dst, range, hist, method, factor ) 506 | 507 | 508 | /* calculates probabilistic density (divides one histogram by another) */ 509 | CVAPI(void) cvCalcProbDensity( const CvHistogram* hist1, const CvHistogram* hist2, 510 | CvHistogram* dst_hist, double scale CV_DEFAULT(255) ); 511 | 512 | /* equalizes histogram of 8-bit single-channel image */ 513 | CVAPI(void) cvEqualizeHist( const CvArr* src, CvArr* dst ); 514 | 515 | 516 | /* Applies distance transform to binary image */ 517 | CVAPI(void) cvDistTransform( const CvArr* src, CvArr* dst, 518 | int distance_type CV_DEFAULT(CV_DIST_L2), 519 | int mask_size CV_DEFAULT(3), 520 | const float* mask CV_DEFAULT(NULL), 521 | CvArr* labels CV_DEFAULT(NULL), 522 | int labelType CV_DEFAULT(CV_DIST_LABEL_CCOMP)); 523 | 524 | 525 | /* Applies fixed-level threshold to grayscale image. 526 | This is a basic operation applied before retrieving contours */ 527 | CVAPI(double) cvThreshold( const CvArr* src, CvArr* dst, 528 | double threshold, double max_value, 529 | int threshold_type ); 530 | 531 | /* Applies adaptive threshold to grayscale image. 532 | The two parameters for methods CV_ADAPTIVE_THRESH_MEAN_C and 533 | CV_ADAPTIVE_THRESH_GAUSSIAN_C are: 534 | neighborhood size (3, 5, 7 etc.), 535 | and a constant subtracted from mean (...,-3,-2,-1,0,1,2,3,...) */ 536 | CVAPI(void) cvAdaptiveThreshold( const CvArr* src, CvArr* dst, double max_value, 537 | int adaptive_method CV_DEFAULT(CV_ADAPTIVE_THRESH_MEAN_C), 538 | int threshold_type CV_DEFAULT(CV_THRESH_BINARY), 539 | int block_size CV_DEFAULT(3), 540 | double param1 CV_DEFAULT(5)); 541 | 542 | /* Fills the connected component until the color difference gets large enough */ 543 | CVAPI(void) cvFloodFill( CvArr* image, CvPoint seed_point, 544 | CvScalar new_val, CvScalar lo_diff CV_DEFAULT(cvScalarAll(0)), 545 | CvScalar up_diff CV_DEFAULT(cvScalarAll(0)), 546 | CvConnectedComp* comp CV_DEFAULT(NULL), 547 | int flags CV_DEFAULT(4), 548 | CvArr* mask CV_DEFAULT(NULL)); 549 | 550 | /****************************************************************************************\ 551 | * Feature detection * 552 | \****************************************************************************************/ 553 | 554 | /* Runs canny edge detector */ 555 | CVAPI(void) cvCanny( const CvArr* image, CvArr* edges, double threshold1, 556 | double threshold2, int aperture_size CV_DEFAULT(3) ); 557 | 558 | /* Calculates constraint image for corner detection 559 | Dx^2 * Dyy + Dxx * Dy^2 - 2 * Dx * Dy * Dxy. 560 | Applying threshold to the result gives coordinates of corners */ 561 | CVAPI(void) cvPreCornerDetect( const CvArr* image, CvArr* corners, 562 | int aperture_size CV_DEFAULT(3) ); 563 | 564 | /* Calculates eigen values and vectors of 2x2 565 | gradient covariation matrix at every image pixel */ 566 | CVAPI(void) cvCornerEigenValsAndVecs( const CvArr* image, CvArr* eigenvv, 567 | int block_size, int aperture_size CV_DEFAULT(3) ); 568 | 569 | /* Calculates minimal eigenvalue for 2x2 gradient covariation matrix at 570 | every image pixel */ 571 | CVAPI(void) cvCornerMinEigenVal( const CvArr* image, CvArr* eigenval, 572 | int block_size, int aperture_size CV_DEFAULT(3) ); 573 | 574 | /* Harris corner detector: 575 | Calculates det(M) - k*(trace(M)^2), where M is 2x2 gradient covariation matrix for each pixel */ 576 | CVAPI(void) cvCornerHarris( const CvArr* image, CvArr* harris_responce, 577 | int block_size, int aperture_size CV_DEFAULT(3), 578 | double k CV_DEFAULT(0.04) ); 579 | 580 | /* Adjust corner position using some sort of gradient search */ 581 | CVAPI(void) cvFindCornerSubPix( const CvArr* image, CvPoint2D32f* corners, 582 | int count, CvSize win, CvSize zero_zone, 583 | CvTermCriteria criteria ); 584 | 585 | /* Finds a sparse set of points within the selected region 586 | that seem to be easy to track */ 587 | CVAPI(void) cvGoodFeaturesToTrack( const CvArr* image, CvArr* eig_image, 588 | CvArr* temp_image, CvPoint2D32f* corners, 589 | int* corner_count, double quality_level, 590 | double min_distance, 591 | const CvArr* mask CV_DEFAULT(NULL), 592 | int block_size CV_DEFAULT(3), 593 | int use_harris CV_DEFAULT(0), 594 | double k CV_DEFAULT(0.04) ); 595 | 596 | /* Finds lines on binary image using one of several methods. 597 | line_storage is either memory storage or 1 x CvMat, its 598 | number of columns is changed by the function. 599 | method is one of CV_HOUGH_*; 600 | rho, theta and threshold are used for each of those methods; 601 | param1 ~ line length, param2 ~ line gap - for probabilistic, 602 | param1 ~ srn, param2 ~ stn - for multi-scale */ 603 | CVAPI(CvSeq*) cvHoughLines2( CvArr* image, void* line_storage, int method, 604 | double rho, double theta, int threshold, 605 | double param1 CV_DEFAULT(0), double param2 CV_DEFAULT(0)); 606 | 607 | /* Finds circles in the image */ 608 | CVAPI(CvSeq*) cvHoughCircles( CvArr* image, void* circle_storage, 609 | int method, double dp, double min_dist, 610 | double param1 CV_DEFAULT(100), 611 | double param2 CV_DEFAULT(100), 612 | int min_radius CV_DEFAULT(0), 613 | int max_radius CV_DEFAULT(0)); 614 | 615 | /* Fits a line into set of 2d or 3d points in a robust way (M-estimator technique) */ 616 | CVAPI(void) cvFitLine( const CvArr* points, int dist_type, double param, 617 | double reps, double aeps, float* line ); 618 | 619 | #ifdef __cplusplus 620 | } 621 | #endif 622 | 623 | #endif 624 | -------------------------------------------------------------------------------- /Calibration/opencv_h/miniflann.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef _OPENCV_MINIFLANN_HPP_ 44 | #define _OPENCV_MINIFLANN_HPP_ 45 | 46 | #ifdef __cplusplus 47 | 48 | #include "core.hpp" 49 | #include "defines.h" 50 | 51 | namespace cv 52 | { 53 | 54 | namespace flann 55 | { 56 | 57 | struct CV_EXPORTS IndexParams 58 | { 59 | IndexParams(); 60 | ~IndexParams(); 61 | 62 | std::string getString(const std::string& key, const std::string& defaultVal=std::string()) const; 63 | int getInt(const std::string& key, int defaultVal=-1) const; 64 | double getDouble(const std::string& key, double defaultVal=-1) const; 65 | 66 | void setString(const std::string& key, const std::string& value); 67 | void setInt(const std::string& key, int value); 68 | void setDouble(const std::string& key, double value); 69 | void setFloat(const std::string& key, float value); 70 | void setBool(const std::string& key, bool value); 71 | void setAlgorithm(int value); 72 | 73 | void getAll(std::vector& names, 74 | std::vector& types, 75 | std::vector& strValues, 76 | std::vector& numValues) const; 77 | 78 | void* params; 79 | }; 80 | 81 | struct CV_EXPORTS KDTreeIndexParams : public IndexParams 82 | { 83 | KDTreeIndexParams(int trees=4); 84 | }; 85 | 86 | struct CV_EXPORTS LinearIndexParams : public IndexParams 87 | { 88 | LinearIndexParams(); 89 | }; 90 | 91 | struct CV_EXPORTS CompositeIndexParams : public IndexParams 92 | { 93 | CompositeIndexParams(int trees = 4, int branching = 32, int iterations = 11, 94 | cvflann::flann_centers_init_t centers_init = cvflann::FLANN_CENTERS_RANDOM, float cb_index = 0.2 ); 95 | }; 96 | 97 | struct CV_EXPORTS AutotunedIndexParams : public IndexParams 98 | { 99 | AutotunedIndexParams(float target_precision = 0.8, float build_weight = 0.01, 100 | float memory_weight = 0, float sample_fraction = 0.1); 101 | }; 102 | 103 | struct CV_EXPORTS HierarchicalClusteringIndexParams : public IndexParams 104 | { 105 | HierarchicalClusteringIndexParams(int branching = 32, 106 | cvflann::flann_centers_init_t centers_init = cvflann::FLANN_CENTERS_RANDOM, int trees = 4, int leaf_size = 100 ); 107 | }; 108 | 109 | struct CV_EXPORTS KMeansIndexParams : public IndexParams 110 | { 111 | KMeansIndexParams(int branching = 32, int iterations = 11, 112 | cvflann::flann_centers_init_t centers_init = cvflann::FLANN_CENTERS_RANDOM, float cb_index = 0.2 ); 113 | }; 114 | 115 | struct CV_EXPORTS LshIndexParams : public IndexParams 116 | { 117 | LshIndexParams(int table_number, int key_size, int multi_probe_level); 118 | }; 119 | 120 | struct CV_EXPORTS SavedIndexParams : public IndexParams 121 | { 122 | SavedIndexParams(const std::string& filename); 123 | }; 124 | 125 | struct CV_EXPORTS SearchParams : public IndexParams 126 | { 127 | SearchParams( int checks = 32, float eps = 0, bool sorted = true ); 128 | }; 129 | 130 | class CV_EXPORTS_W Index 131 | { 132 | public: 133 | CV_WRAP Index(); 134 | CV_WRAP Index(InputArray features, const IndexParams& params, cvflann::flann_distance_t distType=cvflann::FLANN_DIST_L2); 135 | virtual ~Index(); 136 | 137 | CV_WRAP virtual void build(InputArray features, const IndexParams& params, cvflann::flann_distance_t distType=cvflann::FLANN_DIST_L2); 138 | CV_WRAP virtual void knnSearch(InputArray query, OutputArray indices, 139 | OutputArray dists, int knn, const SearchParams& params=SearchParams()); 140 | 141 | CV_WRAP virtual int radiusSearch(InputArray query, OutputArray indices, 142 | OutputArray dists, double radius, int maxResults, 143 | const SearchParams& params=SearchParams()); 144 | 145 | CV_WRAP virtual void save(const std::string& filename) const; 146 | CV_WRAP virtual bool load(InputArray features, const std::string& filename); 147 | CV_WRAP virtual void release(); 148 | CV_WRAP cvflann::flann_distance_t getDistance() const; 149 | CV_WRAP cvflann::flann_algorithm_t getAlgorithm() const; 150 | 151 | protected: 152 | cvflann::flann_distance_t distType; 153 | cvflann::flann_algorithm_t algo; 154 | int featureType; 155 | void* index; 156 | }; 157 | 158 | } } // namespace cv::flann 159 | 160 | #endif // __cplusplus 161 | 162 | #endif 163 | -------------------------------------------------------------------------------- /Calibration/opencv_h/types_c_imgproc.h: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef __OPENCV_IMGPROC_TYPES_C_H__ 44 | #define __OPENCV_IMGPROC_TYPES_C_H__ 45 | 46 | #include "core_c.h" 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | /* Connected component structure */ 53 | typedef struct CvConnectedComp 54 | { 55 | double area; /* area of the connected component */ 56 | CvScalar value; /* average color of the connected component */ 57 | CvRect rect; /* ROI of the component */ 58 | CvSeq* contour; /* optional component boundary 59 | (the contour might have child contours corresponding to the holes)*/ 60 | } 61 | CvConnectedComp; 62 | 63 | /* Image smooth methods */ 64 | enum 65 | { 66 | CV_BLUR_NO_SCALE =0, 67 | CV_BLUR =1, 68 | CV_GAUSSIAN =2, 69 | CV_MEDIAN =3, 70 | CV_BILATERAL =4 71 | }; 72 | 73 | /* Filters used in pyramid decomposition */ 74 | enum 75 | { 76 | CV_GAUSSIAN_5x5 = 7 77 | }; 78 | 79 | /* Special filters */ 80 | enum 81 | { 82 | CV_SCHARR =-1, 83 | CV_MAX_SOBEL_KSIZE =7 84 | }; 85 | 86 | /* Constants for color conversion */ 87 | enum 88 | { 89 | CV_BGR2BGRA =0, 90 | CV_RGB2RGBA =CV_BGR2BGRA, 91 | 92 | CV_BGRA2BGR =1, 93 | CV_RGBA2RGB =CV_BGRA2BGR, 94 | 95 | CV_BGR2RGBA =2, 96 | CV_RGB2BGRA =CV_BGR2RGBA, 97 | 98 | CV_RGBA2BGR =3, 99 | CV_BGRA2RGB =CV_RGBA2BGR, 100 | 101 | CV_BGR2RGB =4, 102 | CV_RGB2BGR =CV_BGR2RGB, 103 | 104 | CV_BGRA2RGBA =5, 105 | CV_RGBA2BGRA =CV_BGRA2RGBA, 106 | 107 | CV_BGR2GRAY =6, 108 | CV_RGB2GRAY =7, 109 | CV_GRAY2BGR =8, 110 | CV_GRAY2RGB =CV_GRAY2BGR, 111 | CV_GRAY2BGRA =9, 112 | CV_GRAY2RGBA =CV_GRAY2BGRA, 113 | CV_BGRA2GRAY =10, 114 | CV_RGBA2GRAY =11, 115 | 116 | CV_BGR2BGR565 =12, 117 | CV_RGB2BGR565 =13, 118 | CV_BGR5652BGR =14, 119 | CV_BGR5652RGB =15, 120 | CV_BGRA2BGR565 =16, 121 | CV_RGBA2BGR565 =17, 122 | CV_BGR5652BGRA =18, 123 | CV_BGR5652RGBA =19, 124 | 125 | CV_GRAY2BGR565 =20, 126 | CV_BGR5652GRAY =21, 127 | 128 | CV_BGR2BGR555 =22, 129 | CV_RGB2BGR555 =23, 130 | CV_BGR5552BGR =24, 131 | CV_BGR5552RGB =25, 132 | CV_BGRA2BGR555 =26, 133 | CV_RGBA2BGR555 =27, 134 | CV_BGR5552BGRA =28, 135 | CV_BGR5552RGBA =29, 136 | 137 | CV_GRAY2BGR555 =30, 138 | CV_BGR5552GRAY =31, 139 | 140 | CV_BGR2XYZ =32, 141 | CV_RGB2XYZ =33, 142 | CV_XYZ2BGR =34, 143 | CV_XYZ2RGB =35, 144 | 145 | CV_BGR2YCrCb =36, 146 | CV_RGB2YCrCb =37, 147 | CV_YCrCb2BGR =38, 148 | CV_YCrCb2RGB =39, 149 | 150 | CV_BGR2HSV =40, 151 | CV_RGB2HSV =41, 152 | 153 | CV_BGR2Lab =44, 154 | CV_RGB2Lab =45, 155 | 156 | CV_BayerBG2BGR =46, 157 | CV_BayerGB2BGR =47, 158 | CV_BayerRG2BGR =48, 159 | CV_BayerGR2BGR =49, 160 | 161 | CV_BayerBG2RGB =CV_BayerRG2BGR, 162 | CV_BayerGB2RGB =CV_BayerGR2BGR, 163 | CV_BayerRG2RGB =CV_BayerBG2BGR, 164 | CV_BayerGR2RGB =CV_BayerGB2BGR, 165 | 166 | CV_BGR2Luv =50, 167 | CV_RGB2Luv =51, 168 | CV_BGR2HLS =52, 169 | CV_RGB2HLS =53, 170 | 171 | CV_HSV2BGR =54, 172 | CV_HSV2RGB =55, 173 | 174 | CV_Lab2BGR =56, 175 | CV_Lab2RGB =57, 176 | CV_Luv2BGR =58, 177 | CV_Luv2RGB =59, 178 | CV_HLS2BGR =60, 179 | CV_HLS2RGB =61, 180 | 181 | CV_BayerBG2BGR_VNG =62, 182 | CV_BayerGB2BGR_VNG =63, 183 | CV_BayerRG2BGR_VNG =64, 184 | CV_BayerGR2BGR_VNG =65, 185 | 186 | CV_BayerBG2RGB_VNG =CV_BayerRG2BGR_VNG, 187 | CV_BayerGB2RGB_VNG =CV_BayerGR2BGR_VNG, 188 | CV_BayerRG2RGB_VNG =CV_BayerBG2BGR_VNG, 189 | CV_BayerGR2RGB_VNG =CV_BayerGB2BGR_VNG, 190 | 191 | CV_BGR2HSV_FULL = 66, 192 | CV_RGB2HSV_FULL = 67, 193 | CV_BGR2HLS_FULL = 68, 194 | CV_RGB2HLS_FULL = 69, 195 | 196 | CV_HSV2BGR_FULL = 70, 197 | CV_HSV2RGB_FULL = 71, 198 | CV_HLS2BGR_FULL = 72, 199 | CV_HLS2RGB_FULL = 73, 200 | 201 | CV_LBGR2Lab = 74, 202 | CV_LRGB2Lab = 75, 203 | CV_LBGR2Luv = 76, 204 | CV_LRGB2Luv = 77, 205 | 206 | CV_Lab2LBGR = 78, 207 | CV_Lab2LRGB = 79, 208 | CV_Luv2LBGR = 80, 209 | CV_Luv2LRGB = 81, 210 | 211 | CV_BGR2YUV = 82, 212 | CV_RGB2YUV = 83, 213 | CV_YUV2BGR = 84, 214 | CV_YUV2RGB = 85, 215 | 216 | CV_BayerBG2GRAY = 86, 217 | CV_BayerGB2GRAY = 87, 218 | CV_BayerRG2GRAY = 88, 219 | CV_BayerGR2GRAY = 89, 220 | 221 | //YUV 4:2:0 formats family 222 | CV_YUV2RGB_NV12 = 90, 223 | CV_YUV2BGR_NV12 = 91, 224 | CV_YUV2RGB_NV21 = 92, 225 | CV_YUV2BGR_NV21 = 93, 226 | CV_YUV420sp2RGB = CV_YUV2RGB_NV21, 227 | CV_YUV420sp2BGR = CV_YUV2BGR_NV21, 228 | 229 | CV_YUV2RGBA_NV12 = 94, 230 | CV_YUV2BGRA_NV12 = 95, 231 | CV_YUV2RGBA_NV21 = 96, 232 | CV_YUV2BGRA_NV21 = 97, 233 | CV_YUV420sp2RGBA = CV_YUV2RGBA_NV21, 234 | CV_YUV420sp2BGRA = CV_YUV2BGRA_NV21, 235 | 236 | CV_YUV2RGB_YV12 = 98, 237 | CV_YUV2BGR_YV12 = 99, 238 | CV_YUV2RGB_IYUV = 100, 239 | CV_YUV2BGR_IYUV = 101, 240 | CV_YUV2RGB_I420 = CV_YUV2RGB_IYUV, 241 | CV_YUV2BGR_I420 = CV_YUV2BGR_IYUV, 242 | CV_YUV420p2RGB = CV_YUV2RGB_YV12, 243 | CV_YUV420p2BGR = CV_YUV2BGR_YV12, 244 | 245 | CV_YUV2RGBA_YV12 = 102, 246 | CV_YUV2BGRA_YV12 = 103, 247 | CV_YUV2RGBA_IYUV = 104, 248 | CV_YUV2BGRA_IYUV = 105, 249 | CV_YUV2RGBA_I420 = CV_YUV2RGBA_IYUV, 250 | CV_YUV2BGRA_I420 = CV_YUV2BGRA_IYUV, 251 | CV_YUV420p2RGBA = CV_YUV2RGBA_YV12, 252 | CV_YUV420p2BGRA = CV_YUV2BGRA_YV12, 253 | 254 | CV_YUV2GRAY_420 = 106, 255 | CV_YUV2GRAY_NV21 = CV_YUV2GRAY_420, 256 | CV_YUV2GRAY_NV12 = CV_YUV2GRAY_420, 257 | CV_YUV2GRAY_YV12 = CV_YUV2GRAY_420, 258 | CV_YUV2GRAY_IYUV = CV_YUV2GRAY_420, 259 | CV_YUV2GRAY_I420 = CV_YUV2GRAY_420, 260 | CV_YUV420sp2GRAY = CV_YUV2GRAY_420, 261 | CV_YUV420p2GRAY = CV_YUV2GRAY_420, 262 | 263 | //YUV 4:2:2 formats family 264 | CV_YUV2RGB_UYVY = 107, 265 | CV_YUV2BGR_UYVY = 108, 266 | //CV_YUV2RGB_VYUY = 109, 267 | //CV_YUV2BGR_VYUY = 110, 268 | CV_YUV2RGB_Y422 = CV_YUV2RGB_UYVY, 269 | CV_YUV2BGR_Y422 = CV_YUV2BGR_UYVY, 270 | CV_YUV2RGB_UYNV = CV_YUV2RGB_UYVY, 271 | CV_YUV2BGR_UYNV = CV_YUV2BGR_UYVY, 272 | 273 | CV_YUV2RGBA_UYVY = 111, 274 | CV_YUV2BGRA_UYVY = 112, 275 | //CV_YUV2RGBA_VYUY = 113, 276 | //CV_YUV2BGRA_VYUY = 114, 277 | CV_YUV2RGBA_Y422 = CV_YUV2RGBA_UYVY, 278 | CV_YUV2BGRA_Y422 = CV_YUV2BGRA_UYVY, 279 | CV_YUV2RGBA_UYNV = CV_YUV2RGBA_UYVY, 280 | CV_YUV2BGRA_UYNV = CV_YUV2BGRA_UYVY, 281 | 282 | CV_YUV2RGB_YUY2 = 115, 283 | CV_YUV2BGR_YUY2 = 116, 284 | CV_YUV2RGB_YVYU = 117, 285 | CV_YUV2BGR_YVYU = 118, 286 | CV_YUV2RGB_YUYV = CV_YUV2RGB_YUY2, 287 | CV_YUV2BGR_YUYV = CV_YUV2BGR_YUY2, 288 | CV_YUV2RGB_YUNV = CV_YUV2RGB_YUY2, 289 | CV_YUV2BGR_YUNV = CV_YUV2BGR_YUY2, 290 | 291 | CV_YUV2RGBA_YUY2 = 119, 292 | CV_YUV2BGRA_YUY2 = 120, 293 | CV_YUV2RGBA_YVYU = 121, 294 | CV_YUV2BGRA_YVYU = 122, 295 | CV_YUV2RGBA_YUYV = CV_YUV2RGBA_YUY2, 296 | CV_YUV2BGRA_YUYV = CV_YUV2BGRA_YUY2, 297 | CV_YUV2RGBA_YUNV = CV_YUV2RGBA_YUY2, 298 | CV_YUV2BGRA_YUNV = CV_YUV2BGRA_YUY2, 299 | 300 | CV_YUV2GRAY_UYVY = 123, 301 | CV_YUV2GRAY_YUY2 = 124, 302 | //CV_YUV2GRAY_VYUY = CV_YUV2GRAY_UYVY, 303 | CV_YUV2GRAY_Y422 = CV_YUV2GRAY_UYVY, 304 | CV_YUV2GRAY_UYNV = CV_YUV2GRAY_UYVY, 305 | CV_YUV2GRAY_YVYU = CV_YUV2GRAY_YUY2, 306 | CV_YUV2GRAY_YUYV = CV_YUV2GRAY_YUY2, 307 | CV_YUV2GRAY_YUNV = CV_YUV2GRAY_YUY2, 308 | 309 | // alpha premultiplication 310 | CV_RGBA2mRGBA = 125, 311 | CV_mRGBA2RGBA = 126, 312 | 313 | CV_RGB2YUV_I420 = 127, 314 | CV_BGR2YUV_I420 = 128, 315 | CV_RGB2YUV_IYUV = CV_RGB2YUV_I420, 316 | CV_BGR2YUV_IYUV = CV_BGR2YUV_I420, 317 | 318 | CV_RGBA2YUV_I420 = 129, 319 | CV_BGRA2YUV_I420 = 130, 320 | CV_RGBA2YUV_IYUV = CV_RGBA2YUV_I420, 321 | CV_BGRA2YUV_IYUV = CV_BGRA2YUV_I420, 322 | CV_RGB2YUV_YV12 = 131, 323 | CV_BGR2YUV_YV12 = 132, 324 | CV_RGBA2YUV_YV12 = 133, 325 | CV_BGRA2YUV_YV12 = 134, 326 | 327 | CV_COLORCVT_MAX = 135 328 | }; 329 | 330 | 331 | /* Sub-pixel interpolation methods */ 332 | enum 333 | { 334 | CV_INTER_NN =0, 335 | CV_INTER_LINEAR =1, 336 | CV_INTER_CUBIC =2, 337 | CV_INTER_AREA =3, 338 | CV_INTER_LANCZOS4 =4 339 | }; 340 | 341 | /* ... and other image warping flags */ 342 | enum 343 | { 344 | CV_WARP_FILL_OUTLIERS =8, 345 | CV_WARP_INVERSE_MAP =16 346 | }; 347 | 348 | /* Shapes of a structuring element for morphological operations */ 349 | enum 350 | { 351 | CV_SHAPE_RECT =0, 352 | CV_SHAPE_CROSS =1, 353 | CV_SHAPE_ELLIPSE =2, 354 | CV_SHAPE_CUSTOM =100 355 | }; 356 | 357 | /* Morphological operations */ 358 | enum 359 | { 360 | CV_MOP_ERODE =0, 361 | CV_MOP_DILATE =1, 362 | CV_MOP_OPEN =2, 363 | CV_MOP_CLOSE =3, 364 | CV_MOP_GRADIENT =4, 365 | CV_MOP_TOPHAT =5, 366 | CV_MOP_BLACKHAT =6 367 | }; 368 | 369 | /* Spatial and central moments */ 370 | typedef struct CvMoments 371 | { 372 | double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; /* spatial moments */ 373 | double mu20, mu11, mu02, mu30, mu21, mu12, mu03; /* central moments */ 374 | double inv_sqrt_m00; /* m00 != 0 ? 1/sqrt(m00) : 0 */ 375 | } 376 | CvMoments; 377 | 378 | /* Hu invariants */ 379 | typedef struct CvHuMoments 380 | { 381 | double hu1, hu2, hu3, hu4, hu5, hu6, hu7; /* Hu invariants */ 382 | } 383 | CvHuMoments; 384 | 385 | /* Template matching methods */ 386 | enum 387 | { 388 | CV_TM_SQDIFF =0, 389 | CV_TM_SQDIFF_NORMED =1, 390 | CV_TM_CCORR =2, 391 | CV_TM_CCORR_NORMED =3, 392 | CV_TM_CCOEFF =4, 393 | CV_TM_CCOEFF_NORMED =5 394 | }; 395 | 396 | typedef float (CV_CDECL * CvDistanceFunction)( const float* a, const float* b, void* user_param ); 397 | 398 | /* Contour retrieval modes */ 399 | enum 400 | { 401 | CV_RETR_EXTERNAL=0, 402 | CV_RETR_LIST=1, 403 | CV_RETR_CCOMP=2, 404 | CV_RETR_TREE=3, 405 | CV_RETR_FLOODFILL=4 406 | }; 407 | 408 | /* Contour approximation methods */ 409 | enum 410 | { 411 | CV_CHAIN_CODE=0, 412 | CV_CHAIN_APPROX_NONE=1, 413 | CV_CHAIN_APPROX_SIMPLE=2, 414 | CV_CHAIN_APPROX_TC89_L1=3, 415 | CV_CHAIN_APPROX_TC89_KCOS=4, 416 | CV_LINK_RUNS=5 417 | }; 418 | 419 | /* 420 | Internal structure that is used for sequental retrieving contours from the image. 421 | It supports both hierarchical and plane variants of Suzuki algorithm. 422 | */ 423 | typedef struct _CvContourScanner* CvContourScanner; 424 | 425 | /* Freeman chain reader state */ 426 | typedef struct CvChainPtReader 427 | { 428 | CV_SEQ_READER_FIELDS() 429 | char code; 430 | CvPoint pt; 431 | schar deltas[8][2]; 432 | } 433 | CvChainPtReader; 434 | 435 | /* initializes 8-element array for fast access to 3x3 neighborhood of a pixel */ 436 | #define CV_INIT_3X3_DELTAS( deltas, step, nch ) \ 437 | ((deltas)[0] = (nch), (deltas)[1] = -(step) + (nch), \ 438 | (deltas)[2] = -(step), (deltas)[3] = -(step) - (nch), \ 439 | (deltas)[4] = -(nch), (deltas)[5] = (step) - (nch), \ 440 | (deltas)[6] = (step), (deltas)[7] = (step) + (nch)) 441 | 442 | 443 | /****************************************************************************************\ 444 | * Planar subdivisions * 445 | \****************************************************************************************/ 446 | 447 | typedef size_t CvSubdiv2DEdge; 448 | 449 | #define CV_QUADEDGE2D_FIELDS() \ 450 | int flags; \ 451 | struct CvSubdiv2DPoint* pt[4]; \ 452 | CvSubdiv2DEdge next[4]; 453 | 454 | #define CV_SUBDIV2D_POINT_FIELDS()\ 455 | int flags; \ 456 | CvSubdiv2DEdge first; \ 457 | CvPoint2D32f pt; \ 458 | int id; 459 | 460 | #define CV_SUBDIV2D_VIRTUAL_POINT_FLAG (1 << 30) 461 | 462 | typedef struct CvQuadEdge2D 463 | { 464 | CV_QUADEDGE2D_FIELDS() 465 | } 466 | CvQuadEdge2D; 467 | 468 | typedef struct CvSubdiv2DPoint 469 | { 470 | CV_SUBDIV2D_POINT_FIELDS() 471 | } 472 | CvSubdiv2DPoint; 473 | 474 | #define CV_SUBDIV2D_FIELDS() \ 475 | CV_GRAPH_FIELDS() \ 476 | int quad_edges; \ 477 | int is_geometry_valid; \ 478 | CvSubdiv2DEdge recent_edge; \ 479 | CvPoint2D32f topleft; \ 480 | CvPoint2D32f bottomright; 481 | 482 | typedef struct CvSubdiv2D 483 | { 484 | CV_SUBDIV2D_FIELDS() 485 | } 486 | CvSubdiv2D; 487 | 488 | 489 | typedef enum CvSubdiv2DPointLocation 490 | { 491 | CV_PTLOC_ERROR = -2, 492 | CV_PTLOC_OUTSIDE_RECT = -1, 493 | CV_PTLOC_INSIDE = 0, 494 | CV_PTLOC_VERTEX = 1, 495 | CV_PTLOC_ON_EDGE = 2 496 | } 497 | CvSubdiv2DPointLocation; 498 | 499 | typedef enum CvNextEdgeType 500 | { 501 | CV_NEXT_AROUND_ORG = 0x00, 502 | CV_NEXT_AROUND_DST = 0x22, 503 | CV_PREV_AROUND_ORG = 0x11, 504 | CV_PREV_AROUND_DST = 0x33, 505 | CV_NEXT_AROUND_LEFT = 0x13, 506 | CV_NEXT_AROUND_RIGHT = 0x31, 507 | CV_PREV_AROUND_LEFT = 0x20, 508 | CV_PREV_AROUND_RIGHT = 0x02 509 | } 510 | CvNextEdgeType; 511 | 512 | /* get the next edge with the same origin point (counterwise) */ 513 | #define CV_SUBDIV2D_NEXT_EDGE( edge ) (((CvQuadEdge2D*)((edge) & ~3))->next[(edge)&3]) 514 | 515 | 516 | /* Contour approximation algorithms */ 517 | enum 518 | { 519 | CV_POLY_APPROX_DP = 0 520 | }; 521 | 522 | /* Shape matching methods */ 523 | enum 524 | { 525 | CV_CONTOURS_MATCH_I1 =1, 526 | CV_CONTOURS_MATCH_I2 =2, 527 | CV_CONTOURS_MATCH_I3 =3 528 | }; 529 | 530 | /* Shape orientation */ 531 | enum 532 | { 533 | CV_CLOCKWISE =1, 534 | CV_COUNTER_CLOCKWISE =2 535 | }; 536 | 537 | 538 | /* Convexity defect */ 539 | typedef struct CvConvexityDefect 540 | { 541 | CvPoint* start; /* point of the contour where the defect begins */ 542 | CvPoint* end; /* point of the contour where the defect ends */ 543 | CvPoint* depth_point; /* the farthest from the convex hull point within the defect */ 544 | float depth; /* distance between the farthest point and the convex hull */ 545 | } CvConvexityDefect; 546 | 547 | 548 | /* Histogram comparison methods */ 549 | enum 550 | { 551 | CV_COMP_CORREL =0, 552 | CV_COMP_CHISQR =1, 553 | CV_COMP_INTERSECT =2, 554 | CV_COMP_BHATTACHARYYA =3, 555 | CV_COMP_HELLINGER =CV_COMP_BHATTACHARYYA 556 | }; 557 | 558 | /* Mask size for distance transform */ 559 | enum 560 | { 561 | CV_DIST_MASK_3 =3, 562 | CV_DIST_MASK_5 =5, 563 | CV_DIST_MASK_PRECISE =0 564 | }; 565 | 566 | /* Content of output label array: connected components or pixels */ 567 | enum 568 | { 569 | CV_DIST_LABEL_CCOMP = 0, 570 | CV_DIST_LABEL_PIXEL = 1 571 | }; 572 | 573 | /* Distance types for Distance Transform and M-estimators */ 574 | enum 575 | { 576 | CV_DIST_USER =-1, /* User defined distance */ 577 | CV_DIST_L1 =1, /* distance = |x1-x2| + |y1-y2| */ 578 | CV_DIST_L2 =2, /* the simple euclidean distance */ 579 | CV_DIST_C =3, /* distance = max(|x1-x2|,|y1-y2|) */ 580 | CV_DIST_L12 =4, /* L1-L2 metric: distance = 2(sqrt(1+x*x/2) - 1)) */ 581 | CV_DIST_FAIR =5, /* distance = c^2(|x|/c-log(1+|x|/c)), c = 1.3998 */ 582 | CV_DIST_WELSCH =6, /* distance = c^2/2(1-exp(-(x/c)^2)), c = 2.9846 */ 583 | CV_DIST_HUBER =7 /* distance = |x| threshold ? max_value : 0 */ 591 | CV_THRESH_BINARY_INV =1, /* value = value > threshold ? 0 : max_value */ 592 | CV_THRESH_TRUNC =2, /* value = value > threshold ? threshold : value */ 593 | CV_THRESH_TOZERO =3, /* value = value > threshold ? value : 0 */ 594 | CV_THRESH_TOZERO_INV =4, /* value = value > threshold ? 0 : value */ 595 | CV_THRESH_MASK =7, 596 | CV_THRESH_OTSU =8 /* use Otsu algorithm to choose the optimal threshold value; 597 | combine the flag with one of the above CV_THRESH_* values */ 598 | }; 599 | 600 | /* Adaptive threshold methods */ 601 | enum 602 | { 603 | CV_ADAPTIVE_THRESH_MEAN_C =0, 604 | CV_ADAPTIVE_THRESH_GAUSSIAN_C =1 605 | }; 606 | 607 | /* FloodFill flags */ 608 | enum 609 | { 610 | CV_FLOODFILL_FIXED_RANGE =(1 << 16), 611 | CV_FLOODFILL_MASK_ONLY =(1 << 17) 612 | }; 613 | 614 | 615 | /* Canny edge detector flags */ 616 | enum 617 | { 618 | CV_CANNY_L2_GRADIENT =(1 << 31) 619 | }; 620 | 621 | /* Variants of a Hough transform */ 622 | enum 623 | { 624 | CV_HOUGH_STANDARD =0, 625 | CV_HOUGH_PROBABILISTIC =1, 626 | CV_HOUGH_MULTI_SCALE =2, 627 | CV_HOUGH_GRADIENT =3 628 | }; 629 | 630 | 631 | /* Fast search data structures */ 632 | struct CvFeatureTree; 633 | struct CvLSH; 634 | struct CvLSHOperations; 635 | 636 | #ifdef __cplusplus 637 | } 638 | #endif 639 | 640 | #endif 641 | -------------------------------------------------------------------------------- /Calibration/opencv_h/version.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // Intel License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright( C) 2000, Intel Corporation, all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of Intel Corporation may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the Intel Corporation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | //(including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort(including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | /* 43 | definition of the current version of OpenCV 44 | Usefull to test in user programs 45 | */ 46 | 47 | #ifndef __OPENCV_VERSION_HPP__ 48 | #define __OPENCV_VERSION_HPP__ 49 | 50 | #define CV_VERSION_EPOCH 2 51 | #define CV_VERSION_MAJOR 4 52 | #define CV_VERSION_MINOR 5 53 | #define CV_VERSION_REVISION 0 54 | 55 | #define CVAUX_STR_EXP(__A) #__A 56 | #define CVAUX_STR(__A) CVAUX_STR_EXP(__A) 57 | 58 | #if CV_VERSION_REVISION 59 | # define CV_VERSION CVAUX_STR(CV_VERSION_EPOCH) "." CVAUX_STR(CV_VERSION_MAJOR) "." CVAUX_STR(CV_VERSION_MINOR) "." CVAUX_STR(CV_VERSION_REVISION) 60 | #else 61 | # define CV_VERSION CVAUX_STR(CV_VERSION_EPOCH) "." CVAUX_STR(CV_VERSION_MAJOR) "." CVAUX_STR(CV_VERSION_MINOR) 62 | #endif 63 | 64 | /* old style version constants*/ 65 | #define CV_MAJOR_VERSION CV_VERSION_EPOCH 66 | #define CV_MINOR_VERSION CV_VERSION_MAJOR 67 | #define CV_SUBMINOR_VERSION CV_VERSION_MINOR 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /Calibration/opencv_lib/opencv_calib3d245.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Calibration/opencv_lib/opencv_calib3d245.lib -------------------------------------------------------------------------------- /Calibration/opencv_lib/opencv_calib3d245d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Calibration/opencv_lib/opencv_calib3d245d.lib -------------------------------------------------------------------------------- /Calibration/opencv_lib/opencv_core245.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Calibration/opencv_lib/opencv_core245.lib -------------------------------------------------------------------------------- /Calibration/opencv_lib/opencv_core245d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Calibration/opencv_lib/opencv_core245d.lib -------------------------------------------------------------------------------- /Calibration/opencv_lib/opencv_features2d245.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Calibration/opencv_lib/opencv_features2d245.lib -------------------------------------------------------------------------------- /Calibration/opencv_lib/opencv_features2d245d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Calibration/opencv_lib/opencv_features2d245d.lib -------------------------------------------------------------------------------- /Calibration/opencv_lib/opencv_flann245.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Calibration/opencv_lib/opencv_flann245.lib -------------------------------------------------------------------------------- /Calibration/opencv_lib/opencv_flann245d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Calibration/opencv_lib/opencv_flann245d.lib -------------------------------------------------------------------------------- /Calibration/opencv_lib/opencv_highgui245.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Calibration/opencv_lib/opencv_highgui245.lib -------------------------------------------------------------------------------- /Calibration/opencv_lib/opencv_highgui245d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Calibration/opencv_lib/opencv_highgui245d.lib -------------------------------------------------------------------------------- /Calibration/opencv_lib/opencv_imgproc245.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Calibration/opencv_lib/opencv_imgproc245.lib -------------------------------------------------------------------------------- /Calibration/opencv_lib/opencv_imgproc245d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Calibration/opencv_lib/opencv_imgproc245d.lib -------------------------------------------------------------------------------- /Debug/opencv_calib3d245d.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Debug/opencv_calib3d245d.dll -------------------------------------------------------------------------------- /Debug/opencv_core245d.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Debug/opencv_core245d.dll -------------------------------------------------------------------------------- /Debug/opencv_features2d245d.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Debug/opencv_features2d245d.dll -------------------------------------------------------------------------------- /Debug/opencv_flann245d.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Debug/opencv_flann245d.dll -------------------------------------------------------------------------------- /Debug/opencv_highgui245d.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Debug/opencv_highgui245d.dll -------------------------------------------------------------------------------- /Debug/opencv_imgproc245d.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Debug/opencv_imgproc245d.dll -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Readme.md -------------------------------------------------------------------------------- /Release/config.yml: -------------------------------------------------------------------------------- 1 | %YAML:1.0 2 | filepath: "../data/pair1/" 3 | code: "0101111100110100100001" 4 | auto: 1 5 | imagelist: 6 | - "imagelist-1" 7 | imagelist-1: 8 | - "3_13293115_0.jpg" 9 | - "3_13293116_0.jpg" 10 | - "3_13502663_0.jpg" 11 | - "3_13502667_0.jpg" 12 | - "3_13502670_0.jpg" 13 | - "3_13502673_0.jpg" 14 | - "3_13502680_0.jpg" 15 | - "3_13502683_0.jpg" 16 | - "3_13502686_0.jpg" 17 | - "3_13502693_0.jpg" 18 | backgroundlist: 19 | - "4_13293115_0.jpg" 20 | - "4_13293116_0.jpg" 21 | - "4_13502663_0.jpg" 22 | - "4_13502667_0.jpg" 23 | - "4_13502670_0.jpg" 24 | - "4_13502673_0.jpg" 25 | - "4_13502680_0.jpg" 26 | - "4_13502683_0.jpg" 27 | - "4_13502686_0.jpg" 28 | - "4_13502693_0.jpg" 29 | kinect_sn: 30 | - "0_color.jpg" 31 | - "1_color.jpg" 32 | kinect_info: “kinect_info.yml" 33 | kinect_calib_name: "kinect_calib.yml" 34 | camera_calib_name: "cam_calib.yml" 35 | isrotated: "1011110010" 36 | camPair: 37 | - 1 38 | - 4 39 | - 9 40 | - 3 41 | - 6 42 | - 8 43 | - 2 44 | - 5 45 | - 7 46 | - 0 47 | radii:200 48 | DF: 20 49 | init_cx: 1500 50 | init_cy: 2000 51 | initfc: 52 | - 7500 53 | - 7500 54 | - 7500 55 | - 7500 56 | - 7500 57 | - 7500 58 | - 7500 59 | - 7500 60 | - 7500 61 | - 7500 -------------------------------------------------------------------------------- /Release/opencv_calib3d245.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Release/opencv_calib3d245.dll -------------------------------------------------------------------------------- /Release/opencv_core245.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Release/opencv_core245.dll -------------------------------------------------------------------------------- /Release/opencv_features2d245.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Release/opencv_features2d245.dll -------------------------------------------------------------------------------- /Release/opencv_flann245.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Release/opencv_flann245.dll -------------------------------------------------------------------------------- /Release/opencv_highgui245.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Release/opencv_highgui245.dll -------------------------------------------------------------------------------- /Release/opencv_imgproc245.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/Release/opencv_imgproc245.dll -------------------------------------------------------------------------------- /data/pair1/3_13293115_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/data/pair1/3_13293115_0.jpg -------------------------------------------------------------------------------- /data/pair1/3_13293116_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/data/pair1/3_13293116_0.jpg -------------------------------------------------------------------------------- /data/pair1/3_13502663_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/data/pair1/3_13502663_0.jpg -------------------------------------------------------------------------------- /data/pair1/3_13502667_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/data/pair1/3_13502667_0.jpg -------------------------------------------------------------------------------- /data/pair1/3_13502670_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/data/pair1/3_13502670_0.jpg -------------------------------------------------------------------------------- /data/pair1/3_13502673_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/data/pair1/3_13502673_0.jpg -------------------------------------------------------------------------------- /data/pair1/3_13502680_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/data/pair1/3_13502680_0.jpg -------------------------------------------------------------------------------- /data/pair1/3_13502683_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/data/pair1/3_13502683_0.jpg -------------------------------------------------------------------------------- /data/pair1/3_13502686_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/data/pair1/3_13502686_0.jpg -------------------------------------------------------------------------------- /data/pair1/3_13502693_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/data/pair1/3_13502693_0.jpg -------------------------------------------------------------------------------- /data/pair1/4_13293115_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/data/pair1/4_13293115_0.jpg -------------------------------------------------------------------------------- /data/pair1/4_13293116_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/data/pair1/4_13293116_0.jpg -------------------------------------------------------------------------------- /data/pair1/4_13502663_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/data/pair1/4_13502663_0.jpg -------------------------------------------------------------------------------- /data/pair1/4_13502667_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/data/pair1/4_13502667_0.jpg -------------------------------------------------------------------------------- /data/pair1/4_13502670_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/data/pair1/4_13502670_0.jpg -------------------------------------------------------------------------------- /data/pair1/4_13502673_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/data/pair1/4_13502673_0.jpg -------------------------------------------------------------------------------- /data/pair1/4_13502680_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/data/pair1/4_13502680_0.jpg -------------------------------------------------------------------------------- /data/pair1/4_13502683_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/data/pair1/4_13502683_0.jpg -------------------------------------------------------------------------------- /data/pair1/4_13502686_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/data/pair1/4_13502686_0.jpg -------------------------------------------------------------------------------- /data/pair1/4_13502693_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/data/pair1/4_13502693_0.jpg -------------------------------------------------------------------------------- /data/pair1/name: -------------------------------------------------------------------------------- 1 | 3_13293115_0.jpg 2 | 3_13293116_0.jpg 3 | 3_13502663_0.jpg 4 | 3_13502667_0.jpg 5 | 3_13502670_0.jpg 6 | 3_13502673_0.jpg 7 | 3_13502680_0.jpg 8 | 3_13502683_0.jpg 9 | 3_13502686_0.jpg 10 | 3_13502693_0.jpg 11 | 4_13293115_0.jpg 12 | 4_13293116_0.jpg 13 | 4_13502663_0.jpg 14 | 4_13502667_0.jpg 15 | 4_13502670_0.jpg 16 | 4_13502673_0.jpg 17 | 4_13502680_0.jpg 18 | 4_13502683_0.jpg 19 | 4_13502686_0.jpg 20 | 4_13502693_0.jpg 21 | name 22 | -------------------------------------------------------------------------------- /多视角相机标定工具V1.0-设计说明书.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seed93/Calibration/da370f4e49a389b2ceddc1d2c8ab78f41f81260e/多视角相机标定工具V1.0-设计说明书.pdf --------------------------------------------------------------------------------