Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mvBlueFOX3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
labrobotica
drivers
mvBlueFOX3
Commits
9b9a58da
Commit
9b9a58da
authored
8 years ago
by
Angel Santamaria-Navarro
Browse files
Options
Downloads
Patches
Plain Diff
debuggin delays. Some more features added
parent
aeaa4c94
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/examples/mvbluefox3_test.cpp
+2
-1
2 additions, 1 deletion
src/examples/mvbluefox3_test.cpp
src/mvbluefox3.cpp
+59
-21
59 additions, 21 deletions
src/mvbluefox3.cpp
src/mvbluefox3.h
+41
-31
41 additions, 31 deletions
src/mvbluefox3.h
with
102 additions
and
53 deletions
src/examples/mvbluefox3_test.cpp
+
2
−
1
View file @
9b9a58da
#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
;
...
...
This diff is collapsed.
Click to expand it.
src/mvbluefox3.cpp
+
59
−
21
View file @
9b9a58da
...
...
@@ -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 ¶ms, 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 ¶ms, 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 ¶ms, 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
This diff is collapsed.
Click to expand it.
src/mvbluefox3.h
+
41
−
31
View file @
9b9a58da
...
...
@@ -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
=
tru
e
;
gamma
=
fals
e
;
// 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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment