Skip to content
Snippets Groups Projects
Commit 9b9a58da authored by Angel Santamaria-Navarro's avatar Angel Santamaria-Navarro
Browse files

debuggin delays. Some more features added

parent aeaa4c94
No related branches found
No related tags found
No related merge requests found
#include "mvbluefox3.h"
#include <boost/timer.hpp>
#include <unistd.h>
#define WINDOW_NAME "mvBlueFOX3 TEST"
......@@ -35,7 +36,7 @@ t.restart();
cam_ptr->GetImage(image);
cv::imshow( WINDOW_NAME, image );
if(cv::waitKey(30) >= 0) break;
std::cout << '\r' << "fps:" << 1.0/t.elapsed() << std::flush;
// std::cout << '\r' << "fps:" << 1.0/t.elapsed() << std::flush;
}
std::cout << std::endl;
......
......@@ -4,9 +4,6 @@
#include <iostream>
#include <sstream>
// TODO: Color twist filter (ImageProcessing/ColorTwist) with setSaturation().
// TODO: Trigger: triggerMode and triggerSource (Acquisition Control).
namespace CMvbluefox3 {
CMvbluefox3::CMvbluefox3(const std::string &serial)
......@@ -181,6 +178,7 @@ void CMvbluefox3::GetImage(char **image)
// DEBUG
// std::cout << this->stats_->framesPerSecond.read() << std::endl;
std::cout << this->ac_ctrl_->mvResultingFrameRate.read() << std::endl;
}
#ifdef HAVE_OPENCV_H
......@@ -246,19 +244,6 @@ int CMvbluefox3::ReqExposeUs(void)
return this->request_->infoExposeTime_us.read();
}
int CMvbluefox3::GetTimeoutMS(void)
{
int val;
ReadProperty(this->bf_sets_->cameraSetting.imageRequestTimeout_ms,val);
return val;
}
void CMvbluefox3::SetTimeoutMS(int timeout_ms)
{
WriteProperty(this->bf_sets_->cameraSetting.imageRequestTimeout_ms,timeout_ms);
this->timeout_ms_ = timeout_ms;
}
void CMvbluefox3::Configure(CParams &params, bool ini)
{
// Clear request queue
......@@ -280,7 +265,7 @@ void CMvbluefox3::Configure(CParams &params, bool ini)
if (ini || this->params_.mirror != params.mirror)
SetImgMirror(params.mirror);
// Area of Intreset
// // Area of Intreset
if (ini || this->params_.aoi_width != params.aoi_width || this->params_.aoi_height != params.aoi_height || this->params_.aoi_start_x != params.aoi_start_x || this->params_.aoi_start_y != params.aoi_start_y)
SetAoi(params.aoi_width, params.aoi_height, params.aoi_start_x, params_.aoi_start_y);
......@@ -310,6 +295,10 @@ void CMvbluefox3::Configure(CParams &params, bool ini)
if (ini || this->params_.dark_cfilter != params.dark_cfilter)
SetDarkCFilter(params.dark_cfilter);
// Request time out
if (ini || this->params_.req_timeout != params.req_timeout)
SetTimeoutMS(params.req_timeout);
// Pixel Clock
if (ini || this->params_.pixel_clock != params.pixel_clock)
SetPixelClock(params.pixel_clock);
......@@ -330,10 +319,9 @@ void CMvbluefox3::Configure(CParams &params, bool ini)
if (ini || this->params_.auto_blck_level != params.auto_blck_level || this->params_.blck_level != params.blck_level)
SetBlackLevel(params.auto_blck_level, params.blck_level);
// WriteProperty(this->bf_sets_->imageProcessing.colorTwistInputCorrectionMatrixEnable,bFalse);
// WriteProperty(this->bf_sets_->imageProcessing.colorTwistEnable,bFalse);
// WriteProperty(this->bf_sets_->imageProcessing.colorTwistOutputCorrectionMatrixEnable,bFalse);
// Twsit color filter
if (ini || this->params_.twist_cfilter != params.twist_cfilter)
ColorTwistFilter(params.twist_cfilter);
// Cache these parameters
params_ = params;
......@@ -579,6 +567,19 @@ void CMvbluefox3::SetDarkCFilter(int &dcfm)
}
}
void CMvbluefox3::SetTimeoutMS(int &timeout_ms)
{
WriteProperty(this->bf_sets_->cameraSetting.imageRequestTimeout_ms,timeout_ms);
this->timeout_ms_ = timeout_ms;
}
int CMvbluefox3::GetTimeoutMS(void)
{
int val;
ReadProperty(this->bf_sets_->cameraSetting.imageRequestTimeout_ms,val);
return val;
}
void CMvbluefox3::SetPixelClock(int &pclk_khz)
{
if (this->dev_ctrl_->mvDeviceClockFrequency.isValid())
......@@ -650,4 +651,41 @@ void CMvbluefox3::SetBlackLevel(bool &auto_blck_level, int &blck_level)
}
}
void CMvbluefox3::ColorTwistFilter(bool &ct_enbl)
{
// TODO: Color twist filter (ImageProcessing/ColorTwist) with setSaturation().
if (ct_enbl)
{
if (!this->bf_sets_->imageProcessing.colorTwistEnable.isValid())
throw CmvBlueFOX3Exception(_HERE_, "Color twist filter option is not available for this model.");
try{
WriteProperty(this->bf_sets_->imageProcessing.colorTwistEnable,bTrue);
this->bf_sets_->imageProcessing.setSaturation(1);
WriteProperty(this->bf_sets_->imageProcessing.colorTwistInputCorrectionMatrixEnable,bTrue);
WriteProperty(this->bf_sets_->imageProcessing.colorTwistOutputCorrectionMatrixEnable,bTrue);
WriteProperty(this->bf_sets_->imageProcessing.colorTwistInputCorrectionMatrixMode,cticmmDeviceSpecific);
WriteProperty(this->bf_sets_->imageProcessing.colorTwistOutputCorrectionMatrixMode,ctocmmXYZTosRGB_D50);
WriteProperty(this->bf_sets_->imageProcessing.colorTwistInputCorrectionMatrixEnable,bFalse);
WriteProperty(this->bf_sets_->imageProcessing.colorTwistOutputCorrectionMatrixEnable,bFalse);
}catch (CmvBlueFOX3Exception& e) {
throw CmvBlueFOX3Exception(_HERE_, "Unable to set color twist filter: " + e.what() );
}
}
else
{
if (this->bf_sets_->imageProcessing.colorTwistEnable.isValid())
{
try{
WriteProperty(this->bf_sets_->imageProcessing.colorTwistEnable,bFalse);
WriteProperty(this->bf_sets_->imageProcessing.colorTwistInputCorrectionMatrixEnable,bFalse);
WriteProperty(this->bf_sets_->imageProcessing.colorTwistOutputCorrectionMatrixEnable,bFalse);
}catch (CmvBlueFOX3Exception& e) {
throw CmvBlueFOX3Exception(_HERE_, "Unable to set color twist filter: " + e.what() );
}
}
}
}
} // End of CMvbluefox3 namespace
\ No newline at end of file
......@@ -48,16 +48,17 @@ private:
frame_rate = 100000;
frate_limit_mode = 0;
pixel_clock = 66000;
req_timeout = 2000;
auto_ctrl_enbl = false;
auto_ctrl_speed = 1;
auto_expose = true;
auto_expose_upperlimit = 200000;
auto_expose_upperlimit = 32759;
auto_expose_des_grey_val = 50;
expose_us = 10000;
auto_gain = false;
gain_db = 0;
gamma = true;
gamma = false;
// Image processing
whiteblnce_auto_enbl = true;
......@@ -67,6 +68,7 @@ private:
blck_level = 0;
hdr_enbl = false;
dark_cfilter = 0;
twist_cfilter = false;
}
public:
......@@ -89,6 +91,7 @@ public:
int frame_rate; // Frame rate.
int frate_limit_mode; // Calculation of the maximum frame rate.
int pixel_clock; // Pixel_clock.
int req_timeout; // request timeout [ms].
bool auto_ctrl_enbl; // Auto controller mode (enable).
int auto_ctrl_speed; // Speed of auto controller mode.
......@@ -107,6 +110,7 @@ public:
int blck_level; // Black level (if auto_blck_level = false).
bool hdr_enbl; // High dynamic range (enable).
int dark_cfilter; // Dark current filter.
bool twist_cfilter; // Color twist filter.
/**
* \brief Class constructor
......@@ -202,6 +206,20 @@ class CMvbluefox3
*/
void GetImageReqFormat(mvIMPACT::acquire::Request *request);
/**
* \brief Request single image
*
* Sends a single request to the default request queue of the device.
*/
void RequestSingle(void);
/**
* \brief Request multiple images
*
* Sends multiple (n) requests to the default request queue of the device.
*/
void RequestMultiple(int n);
/**
* \brief Pixel clock to frame rate
*
......@@ -318,6 +336,20 @@ class CMvbluefox3
*/
void SetPixelClock(int &pclk_khz);
/**
* \brief Set timeout [ms]
*
* Sets the timeout for the frame request operation.
*/
void SetTimeoutMS(int &timeout_ms);
/**
* \brief Get timeout [ms]
*
* Returns the timeout set in the frame request operation.
*/
int GetTimeoutMS(void);
/**
* \brief Set Gamma.
*
......@@ -332,6 +364,13 @@ class CMvbluefox3
*/
void SetBlackLevel(bool &auto_blck_level, int &blck_level);
/**
* \brief Color twsit filter.
*
* Color twsit filter.
*/
void ColorTwistFilter(bool &ct_enbl);
public:
/**
......@@ -362,20 +401,6 @@ class CMvbluefox3
*/
std::string GetSerial(void);
/**
* \brief Request single image
*
* Sends a single request to the default request queue of the device.
*/
void RequestSingle(void);
/**
* \brief Request multiple images
*
* Sends multiple (n) requests to the default request queue of the device.
*/
void RequestMultiple(int n);
/**
* \brief Get single image
*
......@@ -400,21 +425,6 @@ class CMvbluefox3
* Configure main camera parameters.
*/
void Configure(CParams &params, bool ini = false);
/**
* \brief Get timeout [ms]
*
* Returns the timeout set in the frame request operation.
*/
int GetTimeoutMS(void);
/**
* \brief Set timeout [ms]
*
* Sets the timeout for the frame request operation.
*/
void SetTimeoutMS(int timeout_ms);
};
} // End of CMvbluefox3 namespace
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment