From 5228cf50d4e324e18e556c0912e3df1f032dcf18 Mon Sep 17 00:00:00 2001
From: am0ebe <am0ebe@gmx.de>
Date: Mon, 7 Feb 2022 17:09:57 +0100
Subject: [PATCH] .

---
 .gitignore        |  1 +
 examples/Demo.cpp | 38 +++++++++++++++-----------------------
 opencv            | 11 +++++++++++
 3 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/.gitignore b/.gitignore
index 911fd32..45f1086 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 c01770c..89b7d93 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 a8f6d8f..a93ce4d 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
-- 
GitLab