diff --git a/.gitignore b/.gitignore index 911fd327c56aa34cfaa095db8ef756e68dda99c0..45f108620b1d399a57b839a45f5ef142ba46635b 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,4 @@ bgslibrary_gui .pypirc upload.sh *.sublime-workspace +README.html diff --git a/examples/Demo.cpp b/examples/Demo.cpp index c01770ced407e3763b2d56b3cb0dae9a89b7a60e..89b7d933d54c33f941c1d3c9dd65096911a053a2 100644 --- a/examples/Demo.cpp +++ b/examples/Demo.cpp @@ -33,6 +33,7 @@ using namespace cv; using namespace std; Scalar color_red( 0,0,255,255 ); +const int FILE_ERROR = -3; int g_badSignalFlagAbort = 0; @@ -117,15 +118,15 @@ int main(int argc, char * argv[]) } char *camerFile = getCmdOption(argv, argv + argc, "-p"); - string cameraParameterFile("."); + string camParamFile("."); if (camerFile) { //test dir exists - cameraParameterFile = string(camerFile); + camParamFile = string(camerFile); } - cout << "args: -i " << inputFile << " -a " << amountFiles << " -c" << centerFileString << " -o " << outputDir << " -p " << cameraParameterFile << endl; + cout << "args: -i " << inputFile << " -a " << amountFiles << " -c" << centerFileString << " -o " << outputDir << " -p " << camParamFile << endl; //!**** end parse input***********/ //libarchive things @@ -215,31 +216,22 @@ int main(int argc, char * argv[]) //open camera config file - cv::String camParam (cameraParameterFile); - // std::vector<int> intrinsicsCameraMatrix; // = {1000, 0, 320, 0, 1000, 240, 0, 0, 1}; - // std::vector<double> distortionCoeff; // = {1000, 0, 320, 0, 1000, 240, 0, 0, 1}; - Mat intrinsicsCameraMatrix; // = {1000, 0, 320, 0, 1000, 240, 0, 0, 1}; - // Mat distortionCoeff; // = {0.1, 0.01, -0.001, 0, 0}; + Mat distCoeffs; + Mat cameraMatrix; { - cout << "read cam parameter of: " << cameraParameterFile << endl; - FileStorage fs(camParam, FileStorage::READ); + std::string camParamFile = cameraParameterFile; + FileStorage fs(camParamFile, FileStorage::READ); if (!fs.isOpened()) { - cerr << "error opening '" << cameraParameterFile << "' will abort" << endl; - return -1; + std::cerr << "error opening '" << camParamFile << "' will abort" << endl; + return FILE_ERROR; } -// Mat_<double>(3,3) -// Mat_<double>(5,1) - fs["camera_matrix"] >> (Mat_<double>(3,3))intrinsicsCameraMatrix; - // fs["distortion_coefficients"] >> distortionCoeff; - // intrinsicsCameraMatrix = (int) fs["camera_matrix"]; - // intrinsicsCameraMatrix = fs["camera_matrix"].mat(); - // cout << "ISMAT?" << intrinsicsCameraMatrix.isMap() << endl; - // pp(intrinsicsCameraMatrix); - // pp(distortionCoeff); + fs["camera_matrix"] >> cameraMatrix; + fs["distortion_coefficients"] >> distCoeffs; - } + cout << cameraMatrix << endl << distCoeffs << endl; + } //fs.release(); system( "echo 'sleep a bit... ' && sleep 12" ); exit(EXIT_SUCCESS); @@ -322,7 +314,7 @@ int main(int argc, char * argv[]) //! step 0 correct lense distortion Mat imgLenseCorrection = img_input.clone(); //see https://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html#undistort - cv::undistort(img_input, imgLenseCorrection, intrinsicsCameraMatrix, distortionCoeff); + cv::undistort(img_input, imgLenseCorrection, cameraMatrix, distCoeffs); //! step 1) cut out a smaller ROI img_input = TToolBox::cropImageCircle(imgLenseCorrection,circleCenterX,circleCenterY,circleRadius); diff --git a/opencv b/opencv index a8f6d8f5af6686bc865343d9528cde2218953ef6..a93ce4da30e1e99d3098a97ea4260e2f28fe40b2 100644 --- a/opencv +++ b/opencv @@ -103,3 +103,14 @@ https://docs.opencv.org/4.x/d0/d49/tutorial_moments.html #BGS https://docs.opencv.org/4.x/d8/d38/tutorial_bgsegm_bg_subtraction.html + + + +# alliedvision-vimba-sdk +####################### + AsynchronousGrab example > to use with opencv + + /tmp/mozilla_sugu0/Vimba_installation_under_Linux-1.pdf + + C-api + https://www.ansatt.hig.no/ares/Support/Camera%20drivers/AVT/Vimba/1.1/VimbaC/Documentation/Vimba%20C%20Manual.pdf