|
From: <jl...@us...> - 2008-12-31 03:45:04
|
Revision: 8763
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8763&view=rev
Author: jleibs
Date: 2008-12-31 03:45:00 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
Adding ability to set/check camera parameters.
Modified Paths:
--------------
pkg/trunk/drivers/cam/dcam/src/nodes/dcam.cpp
pkg/trunk/drivers/cam/dcam/src/nodes/stereodcam.cpp
pkg/trunk/image_msgs/msg/StereoInfo.msg
pkg/trunk/vision/stereo_image_proc/include/cam_bridge.h
pkg/trunk/vision/stereo_image_proc/src/stereoproc.cpp
Modified: pkg/trunk/drivers/cam/dcam/src/nodes/dcam.cpp
===================================================================
--- pkg/trunk/drivers/cam/dcam/src/nodes/dcam.cpp 2008-12-31 03:44:57 UTC (rev 8762)
+++ pkg/trunk/drivers/cam/dcam/src/nodes/dcam.cpp 2008-12-31 03:45:00 UTC (rev 8763)
@@ -337,16 +337,16 @@
stereo_info_.width = stcam->stIm->imWidth;
stereo_info_.dpp = stcam->stIm->dpp;
- stereo_info_.numDisp = stcam->stIm->numDisp;
- stereo_info_.imDtop = stcam->stIm->imDtop;
- stereo_info_.imDleft = stcam->stIm->imDleft;
- stereo_info_.imDwidth = stcam->stIm->imDwidth;
- stereo_info_.imDheight = stcam->stIm->imDheight;
- stereo_info_.corrSize = stcam->stIm->corrSize;
- stereo_info_.filterSize = stcam->stIm->filterSize;
- stereo_info_.horOffset = stcam->stIm->horOffset;
- stereo_info_.textureThresh = stcam->stIm->textureThresh;
- stereo_info_.uniqueThresh = stcam->stIm->uniqueThresh;
+ stereo_info_.num_disp = stcam->stIm->numDisp;
+ stereo_info_.im_Dtop = stcam->stIm->imDtop;
+ stereo_info_.im_Dleft = stcam->stIm->imDleft;
+ stereo_info_.im_Dwidth = stcam->stIm->imDwidth;
+ stereo_info_.im_Dheight = stcam->stIm->imDheight;
+ stereo_info_.corr_size = stcam->stIm->corrSize;
+ stereo_info_.filter_size = stcam->stIm->filterSize;
+ stereo_info_.hor_offset = stcam->stIm->horOffset;
+ stereo_info_.texture_thresh = stcam->stIm->textureThresh;
+ stereo_info_.unique_thresh = stcam->stIm->uniqueThresh;
memcpy((char*)(&stereo_info_.T[0]), (char*)(stcam->stIm->T), 3*sizeof(double));
memcpy((char*)(&stereo_info_.Om[0]), (char*)(stcam->stIm->Om), 3*sizeof(double));
Modified: pkg/trunk/drivers/cam/dcam/src/nodes/stereodcam.cpp
===================================================================
--- pkg/trunk/drivers/cam/dcam/src/nodes/stereodcam.cpp 2008-12-31 03:44:57 UTC (rev 8762)
+++ pkg/trunk/drivers/cam/dcam/src/nodes/stereodcam.cpp 2008-12-31 03:45:00 UTC (rev 8763)
@@ -32,6 +32,35 @@
* POSSIBILITY OF SUCH DAMAGE.
*********************************************************************/
+/**
+
+@mainpage
+
+@htmlinclude manifest.html
+
+stereodcam node uses the parameters:
+
+- @b ~exposure (int)
+- @b ~gain (int)
+- @b ~brightness (int)
+- @b ~exposure_auto (bool)
+- @b ~gain_auto (bool)
+- @b ~brightness_auto (bool)
+- @b ~companding (bool)
+- @b ~hdr (bool)
+- @b ~unique_check (bool)
+- @b ~texture_thresh (int)
+- @b ~unique_thresh (int)
+- @b ~smoothness_thresh (int)
+- @b ~horopter (int)
+- @b ~speckle_size (int)
+- @b ~speckle_diff (int)
+- @b ~corr_size (int)
+- @b ~num_disp (int)
+
+**/
+
+
#include <cstdio>
#include "dcam/dcam.h"
@@ -156,14 +185,14 @@
// Fetch the camera string and send it to the parameter server if people want it (they shouldn't)
std::string params(stcam_->getParameters());
- set_param("~/params", params);
+ set_param("~params", params);
- set_param("~/exposure_max", (int)stcam_->expMax);
- set_param("~/exposure_min", (int)stcam_->expMin);
- set_param("~/gain_max", (int)stcam_->gainMax);
- set_param("~/gain_min", (int)stcam_->gainMin);
- set_param("~/brightness_max", (int)stcam_->brightMax);
- set_param("~/brightness_min", (int)stcam_->brightMin);
+ set_param("~exposure_max", (int)stcam_->expMax);
+ set_param("~exposure_min", (int)stcam_->expMin);
+ set_param("~gain_max", (int)stcam_->gainMax);
+ set_param("~gain_min", (int)stcam_->gainMin);
+ set_param("~brightness_max", (int)stcam_->brightMax);
+ set_param("~brightness_min", (int)stcam_->brightMin);
// Configure camera
stcam_->setFormat(mode, fps, speed);
@@ -198,23 +227,32 @@
void checkAndSetAll()
{
- checkAndSetIntBool("exposure", boost::bind(&dcam::Dcam::setExposure, stcam_, _1, _2));
- checkAndSetIntBool("gain", boost::bind(&dcam::Dcam::setGain, stcam_, _1, _2));
- checkAndSetIntBool("brightness", boost::bind(&dcam::Dcam::setBrightness, stcam_, _1, _2));
- checkAndSetBool("companding", boost::bind(&dcam::Dcam::setCompanding, stcam_, _1));
- checkAndSetBool("hdr", boost::bind(&dcam::Dcam::setHDR, stcam_, _1));
+ checkAndSetIntBool("exposure", boost::bind(&dcam::Dcam::setExposure, stcam_, _1, _2));
+ checkAndSetIntBool("gain", boost::bind(&dcam::Dcam::setGain, stcam_, _1, _2));
+ checkAndSetIntBool("brightness", boost::bind(&dcam::Dcam::setBrightness, stcam_, _1, _2));
+ checkAndSetBool("companding", boost::bind(&dcam::Dcam::setCompanding, stcam_, _1));
+ checkAndSetBool("hdr", boost::bind(&dcam::Dcam::setHDR, stcam_, _1));
+ checkAndSetBool("unique_check", boost::bind(&dcam::StereoDcam::setUniqueCheck, stcam_, _1));
+ checkAndSetInt("texture_thresh", boost::bind(&dcam::StereoDcam::setTextureThresh, stcam_, _1));
+ checkAndSetInt("unique_thresh", boost::bind(&dcam::StereoDcam::setUniqueThresh, stcam_, _1));
+ checkAndSetInt("smoothness_thresh", boost::bind(&dcam::StereoDcam::setSmoothnessThresh, stcam_, _1));
+ checkAndSetInt("horopter", boost::bind(&dcam::StereoDcam::setHoropter, stcam_, _1));
+ checkAndSetInt("speckle_size", boost::bind(&dcam::StereoDcam::setSpeckleSize, stcam_, _1));
+ checkAndSetInt("speckle_diff", boost::bind(&dcam::StereoDcam::setSpeckleDiff, stcam_, _1));
+ checkAndSetInt("corr_size", boost::bind(&dcam::StereoDcam::setCorrsize, stcam_, _1));
+ checkAndSetInt("num_disp", boost::bind(&dcam::StereoDcam::setNumDisp, stcam_, _1));
}
void checkAndSetIntBool(std::string param_name, boost::function<void(int, bool)> setfunc)
{
- if (has_param(std::string("~/") + param_name) || has_param(std::string("~/") + param_name + std::string("_auto")))
+ if (has_param(std::string("~") + param_name) || has_param(std::string("~") + param_name + std::string("_auto")))
{
int val = 0;
bool isauto = false;
- param( std::string("~/") + param_name, val, 0);
- param( std::string("~/") + param_name + std::string("_auto"), isauto, false);
+ param( std::string("~") + param_name, val, 0);
+ param( std::string("~") + param_name + std::string("_auto"), isauto, false);
int testval = (val * (!isauto));
@@ -230,11 +268,11 @@
void checkAndSetBool(std::string param_name, boost::function<bool(bool)> setfunc)
{
- if (has_param(std::string("~/") + param_name))
+ if (has_param(std::string("~") + param_name))
{
bool on = false;
- param(std::string("~/") + param_name, on, false);
+ param(std::string("~") + param_name, on, false);
std::map<std::string, int>::iterator cacheval = paramcache_.find(param_name);
@@ -249,12 +287,12 @@
void checkAndSetInt(std::string param_name, boost::function<bool(int)> setfunc)
{
- if (has_param(std::string("~/") + param_name))
+ if (has_param(std::string("~") + param_name))
{
int val = 0;
- param(std::string("~/") + param_name, val, 0);
+ param(std::string("~") + param_name, val, 0);
std::map<std::string, int>::iterator cacheval = paramcache_.find(param_name);
Modified: pkg/trunk/image_msgs/msg/StereoInfo.msg
===================================================================
--- pkg/trunk/image_msgs/msg/StereoInfo.msg 2008-12-31 03:44:57 UTC (rev 8762)
+++ pkg/trunk/image_msgs/msg/StereoInfo.msg 2008-12-31 03:45:00 UTC (rev 8763)
@@ -14,16 +14,20 @@
float64[16] RP # Reprojection Matrix
int32 dpp
-int32 numDisp
-int32 imDtop
-int32 imDleft
-int32 imDwidth
-int32 imDheight
-int32 corrSize
-int32 filterSize
-int32 horOffset
-int32 textureThresh
-int32 uniqueThresh
+int32 num_disp
+int32 im_Dtop
+int32 im_Dleft
+int32 im_Dwidth
+int32 im_Dheight
+int32 corr_size
+int32 filter_size
+int32 hor_offset
+int32 texture_thresh
+int32 unique_thresh
+int32 smooth_thresh
+int32 speckle_diff
+int32 speckle_region_size
+byte unique_check
byte has_disparity
Modified: pkg/trunk/vision/stereo_image_proc/include/cam_bridge.h
===================================================================
--- pkg/trunk/vision/stereo_image_proc/include/cam_bridge.h 2008-12-31 03:44:57 UTC (rev 8762)
+++ pkg/trunk/vision/stereo_image_proc/include/cam_bridge.h 2008-12-31 03:45:00 UTC (rev 8763)
@@ -129,16 +129,20 @@
raw_stereo.stereo_info.height = stIm->imHeight;
raw_stereo.stereo_info.width = stIm->imWidth;
raw_stereo.stereo_info.dpp = stIm->dpp;
- raw_stereo.stereo_info.numDisp = stIm->numDisp;
- raw_stereo.stereo_info.imDtop = stIm->imDtop;
- raw_stereo.stereo_info.imDleft = stIm->imDleft;
- raw_stereo.stereo_info.imDwidth = stIm->imDwidth;
- raw_stereo.stereo_info.imDheight = stIm->imDheight;
- raw_stereo.stereo_info.corrSize = stIm->corrSize;
- raw_stereo.stereo_info.filterSize = stIm->filterSize;
- raw_stereo.stereo_info.horOffset = stIm->horOffset;
- raw_stereo.stereo_info.textureThresh = stIm->textureThresh;
- raw_stereo.stereo_info.uniqueThresh = stIm->uniqueThresh;
+ raw_stereo.stereo_info.num_disp = stIm->numDisp;
+ raw_stereo.stereo_info.im_Dtop = stIm->imDtop;
+ raw_stereo.stereo_info.im_Dleft = stIm->imDleft;
+ raw_stereo.stereo_info.im_Dwidth = stIm->imDwidth;
+ raw_stereo.stereo_info.im_Dheight = stIm->imDheight;
+ raw_stereo.stereo_info.corr_size = stIm->corrSize;
+ raw_stereo.stereo_info.filter_size = stIm->filterSize;
+ raw_stereo.stereo_info.hor_offset = stIm->horOffset;
+ raw_stereo.stereo_info.texture_thresh = stIm->textureThresh;
+ raw_stereo.stereo_info.unique_thresh = stIm->uniqueThresh;
+ raw_stereo.stereo_info.smooth_thresh = stIm->smoothThresh;
+ raw_stereo.stereo_info.speckle_diff = stIm->speckleDiff;
+ raw_stereo.stereo_info.speckle_region_size = stIm->speckleRegionSize;
+ raw_stereo.stereo_info.unique_check = stIm->unique_check;
memcpy((char*)(&raw_stereo.stereo_info.T[0]), (char*)(stIm->T), 3*sizeof(double));
memcpy((char*)(&raw_stereo.stereo_info.Om[0]), (char*)(stIm->Om), 3*sizeof(double));
memcpy((char*)(&raw_stereo.stereo_info.RP[0]), (char*)(stIm->RP), 16*sizeof(double));
@@ -243,17 +247,22 @@
stIm->hasDisparity = true;
}
- stIm->dpp = raw_stereo.stereo_info.dpp;
- stIm->numDisp = raw_stereo.stereo_info.numDisp;
- stIm->imDtop = raw_stereo.stereo_info.imDtop;
- stIm->imDleft = raw_stereo.stereo_info.imDleft;
- stIm->imDwidth = raw_stereo.stereo_info.imDwidth;
- stIm->imDheight = raw_stereo.stereo_info.imDheight;
- stIm->corrSize = raw_stereo.stereo_info.corrSize;
- stIm->filterSize = raw_stereo.stereo_info.filterSize;
- stIm->horOffset = raw_stereo.stereo_info.horOffset;
- stIm->textureThresh = raw_stereo.stereo_info.textureThresh;
- stIm->uniqueThresh = raw_stereo.stereo_info.uniqueThresh;
+
+ stIm->dpp = raw_stereo.stereo_info.dpp;
+ stIm->numDisp = raw_stereo.stereo_info.num_disp;
+ stIm->imDtop = raw_stereo.stereo_info.im_Dtop;
+ stIm->imDleft = raw_stereo.stereo_info.im_Dleft;
+ stIm->imDwidth = raw_stereo.stereo_info.im_Dwidth;
+ stIm->imDheight = raw_stereo.stereo_info.im_Dheight;
+ stIm->corrSize = raw_stereo.stereo_info.corr_size;
+ stIm->filterSize = raw_stereo.stereo_info.filter_size;
+ stIm->horOffset = raw_stereo.stereo_info.hor_offset;
+ stIm->textureThresh = raw_stereo.stereo_info.texture_thresh;
+ stIm->uniqueThresh = raw_stereo.stereo_info.unique_thresh;
+ stIm->smoothThresh = raw_stereo.stereo_info.smooth_thresh;
+ stIm->speckleDiff = raw_stereo.stereo_info.speckle_diff;
+ stIm->speckleRegionSize = raw_stereo.stereo_info.speckle_region_size;
+ stIm->unique_check = raw_stereo.stereo_info.unique_check;
memcpy((char*)(stIm->T), (char*)(&raw_stereo.stereo_info.T[0]), 3*sizeof(double));
memcpy((char*)(stIm->Om), (char*)(&raw_stereo.stereo_info.Om[0]), 3*sizeof(double));
memcpy((char*)(stIm->RP), (char*)(&raw_stereo.stereo_info.RP[0]), 16*sizeof(double));
Modified: pkg/trunk/vision/stereo_image_proc/src/stereoproc.cpp
===================================================================
--- pkg/trunk/vision/stereo_image_proc/src/stereoproc.cpp 2008-12-31 03:44:57 UTC (rev 8762)
+++ pkg/trunk/vision/stereo_image_proc/src/stereoproc.cpp 2008-12-31 03:45:00 UTC (rev 8763)
@@ -191,17 +191,22 @@
stereo_info_.width = stdata_->imWidth;
stereo_info_.dpp = stdata_->dpp;
- stereo_info_.numDisp = stdata_->numDisp;
- stereo_info_.imDtop = stdata_->imDtop;
- stereo_info_.imDleft = stdata_->imDleft;
- stereo_info_.imDwidth = stdata_->imDwidth;
- stereo_info_.imDheight = stdata_->imDheight;
- stereo_info_.corrSize = stdata_->corrSize;
- stereo_info_.filterSize = stdata_->filterSize;
- stereo_info_.horOffset = stdata_->horOffset;
- stereo_info_.textureThresh = stdata_->textureThresh;
- stereo_info_.uniqueThresh = stdata_->uniqueThresh;
+ stereo_info_.num_disp = stdata_->numDisp;
+ stereo_info_.im_Dtop = stdata_->imDtop;
+ stereo_info_.im_Dleft = stdata_->imDleft;
+ stereo_info_.im_Dwidth = stdata_->imDwidth;
+ stereo_info_.im_Dheight = stdata_->imDheight;
+ stereo_info_.corr_size = stdata_->corrSize;
+ stereo_info_.filter_size = stdata_->filterSize;
+ stereo_info_.hor_offset = stdata_->horOffset;
+ stereo_info_.texture_thresh = stdata_->textureThresh;
+ stereo_info_.unique_thresh = stdata_->uniqueThresh;
+ stereo_info_.smooth_thresh = stdata_->smoothThresh;
+ stereo_info_.speckle_diff = stdata_->speckleDiff;
+ stereo_info_.speckle_region_size = stdata_->speckleRegionSize;
+ stereo_info_.unique_check = stdata_->unique_check;
+
memcpy((char*)(&stereo_info_.T[0]), (char*)(stdata_->T), 3*sizeof(double));
memcpy((char*)(&stereo_info_.Om[0]), (char*)(stdata_->Om), 3*sizeof(double));
memcpy((char*)(&stereo_info_.RP[0]), (char*)(stdata_->RP), 16*sizeof(double));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|