@@ -670,7 +670,7 @@ void vtkPlusAndorVideoSource::ApplyCosmicRayCorrection(int bin, cv::Mat& floatIm
670670}
671671
672672// ----------------------------------------------------------------------------
673- void vtkPlusAndorVideoSource::ApplyFrameCorrections (int binning)
673+ void vtkPlusAndorVideoSource::ApplyFrameCorrections (int binning, float exposureTime )
674674{
675675 cv::Mat cvIMG (frameSize[0 ], frameSize[1 ], CV_16UC1, &rawFrame[0 ]); // uses rawFrame as buffer
676676 CorrectBadPixels (binning, cvIMG);
@@ -696,6 +696,9 @@ void vtkPlusAndorVideoSource::ApplyFrameCorrections(int binning)
696696 // Divide the image by the 32-bit floating point correction image
697697 cv::divide (result, cvFlatCorrection, result, 1 , CV_32FC1);
698698 LOG_INFO (" Applied multiplicative flat correction" );
699+
700+ // Convert image from count to counts/seconds
701+ cv::divide (result, exposureTime, result, 1 , CV_32FC1);
699702 result.convertTo (cvIMG, CV_16UC1);
700703}
701704
@@ -709,7 +712,7 @@ PlusStatus vtkPlusAndorVideoSource::AcquireBLIFrame(int binning, int vsSpeed, in
709712
710713 if (this ->UseFrameCorrections )
711714 {
712- ApplyFrameCorrections (binning);
715+ ApplyFrameCorrections (binning, exposureTime );
713716 AddFrameToDataSource (BLICorrected);
714717 }
715718
@@ -726,7 +729,7 @@ PlusStatus vtkPlusAndorVideoSource::AcquireGrayscaleFrame(int binning, int vsSpe
726729
727730 if (this ->UseFrameCorrections )
728731 {
729- ApplyFrameCorrections (binning);
732+ ApplyFrameCorrections (binning, exposureTime );
730733 AddFrameToDataSource (GrayCorrected);
731734 }
732735
@@ -775,7 +778,7 @@ PlusStatus vtkPlusAndorVideoSource::SetBiasDarkCorrectionImage(const std::string
775778{
776779 try
777780 {
778- cvBiasDarkCorrection = cv::imread (biasDarkFilePath, cv::IMREAD_GRAYSCALE );
781+ cvBiasDarkCorrection = cv::imread (biasDarkFilePath, cv::IMREAD_UNCHANGED );
779782 if (cvBiasDarkCorrection.empty ())
780783 {
781784 throw " Bias+dark correction image empty!" ;
@@ -794,7 +797,7 @@ PlusStatus vtkPlusAndorVideoSource::SetFlatCorrectionImage(std::string flatFileP
794797{
795798 try
796799 {
797- cvFlatCorrection = cv::imread (flatFilePath, cv::IMREAD_GRAYSCALE );
800+ cvFlatCorrection = cv::imread (flatFilePath, cv::IMREAD_UNCHANGED );
798801 if (cvFlatCorrection.empty ())
799802 {
800803 throw " Flat correction image empty!" ;
@@ -993,6 +996,36 @@ bool vtkPlusAndorVideoSource::GetUseCosmicRayCorrection()
993996 return this ->UseCosmicRayCorrection ;
994997}
995998
999+ // ----------------------------------------------------------------------------
1000+ PlusStatus vtkPlusAndorVideoSource::SetCameraIntrinsics (std::array<double , 9 > intrinsics)
1001+ {
1002+ std::copy (std::begin (intrinsics), std::end (intrinsics), this ->cameraIntrinsics );
1003+ return PLUS_SUCCESS;
1004+ }
1005+
1006+ // ----------------------------------------------------------------------------
1007+ std::array<double , 9 > vtkPlusAndorVideoSource::GetCameraIntrinsics ()
1008+ {
1009+ std::array<double , 9 > returnIntrinsics;
1010+ std::copy (this ->cameraIntrinsics , this ->cameraIntrinsics + 9 , std::begin (returnIntrinsics));
1011+ return returnIntrinsics;
1012+ }
1013+
1014+ // ----------------------------------------------------------------------------
1015+ PlusStatus vtkPlusAndorVideoSource::SetDistanceCoefficients (std::array<double , 4 > coefficients)
1016+ {
1017+ std::copy (std::begin (coefficients), std::end (coefficients), this ->distanceCoefficients );
1018+ return PLUS_SUCCESS;
1019+ }
1020+
1021+ // ----------------------------------------------------------------------------
1022+ std::array<double , 4 > vtkPlusAndorVideoSource::GetDistanceCoefficients ()
1023+ {
1024+ std::array<double , 4 > returnCoefficients;
1025+ std::copy (this ->distanceCoefficients , this ->distanceCoefficients + 4 , std::begin (returnCoefficients));
1026+ return returnCoefficients;
1027+ }
1028+
9961029// ----------------------------------------------------------------------------
9971030PlusStatus vtkPlusAndorVideoSource::SetRequireCoolTemp (bool requireCoolTemp)
9981031{
0 commit comments