23 #include "../tools/alvisiondefinitions.h" 24 #include "../tools/from_any_value.hpp" 35 #include <opencv2/imgproc/imgproc.hpp> 40 #include <boost/foreach.hpp> 41 #define for_each BOOST_FOREACH 48 namespace camera_info_definitions
53 static const sensor_msgs::CameraInfo cam_info_msg;
57 const sensor_msgs::CameraInfo&
getCameraInfo(
int camera_source,
int resolution )
103 ROS_WARN(
"VGA resolution is not supported for the depth camera, use QVGA or lower");
141 ROS_WARN(
"VGA resolution is not supported for the depth camera, use QVGA or lower");
176 std::cout <<
"no camera information found for camera_source " << camera_source <<
" and res: " << resolution << std::endl;
184 const std::string& name,
185 const float& frequency,
186 const qi::SessionPtr& session,
187 const int& camera_source,
188 const int& resolution,
189 const bool& has_stereo) :
BaseConverter( name, frequency, session ),
190 p_video_( session->service(
"ALVideoDevice") ),
191 camera_source_(camera_source),
192 resolution_(resolution),
195 msg_colorspace_( (camera_source_!=
AL::
kDepthCamera)?
"rgb8":
"16UC1" ),
196 cv_mat_type_( (camera_source_!=
AL::
kDepthCamera)?CV_8UC3:CV_16U ),
197 camera_info_( camera_info_definitions::
getCameraInfo(camera_source, resolution) )
199 switch (camera_source) {
235 std::cout <<
"Unsubscribe camera handle " <<
handle_ << std::endl;
269 std::cerr <<
name_ <<
"Camera Handle is empty - cannot retrieve image" << std::endl;
270 std::cerr <<
name_ <<
"Might be a NAOqi problem. Try to restart the ALVideoDevice." << std::endl;
274 qi::AnyValue image_anyvalue =
p_video_.call<qi::AnyValue>(
"getImageRemote",
handle_);
279 catch(std::runtime_error& e)
281 std::cout <<
"Cannot retrieve image" << std::endl;
286 cv::Mat cv_img(image.height, image.width,
cv_mat_type_, image.buffer);
sensor_msgs::CameraInfo createCameraInfoStereoQ720PX2()
sensor_msgs::CameraInfo createCameraInfoStereoQQQ720PX2()
const int kRawDepthColorSpace
const sensor_msgs::CameraInfo & getEmptyInfo()
void callAll(const std::vector< message_actions::MessageAction > &actions)
sensor_msgs::CameraInfo createCameraInfoDEPTHVGA()
sensor_msgs::CameraInfo createCameraInfoDEPTHQQQ720P()
sensor_msgs::CameraInfo camera_info_
const int kDepthColorSpace
sensor_msgs::CameraInfo createCameraInfoStereoQQ720PX2()
CameraConverter(const std::string &name, const float &frequency, const qi::SessionPtr &session, const int &camera_source, const int &resolution, const bool &has_stereo=false)
sensor_msgs::CameraInfo createCameraInfoTOPQVGA()
sensor_msgs::CameraInfo createCameraInfoTOPVGA()
sensor_msgs::CameraInfo createCameraInfoDEPTHQQQQ720P()
sensor_msgs::CameraInfo createCameraInfoDEPTHQQVGA()
sensor_msgs::CameraInfo createCameraInfoDEPTHQVGA()
sensor_msgs::CameraInfo createCameraInfoBOTTOMQVGA()
sensor_msgs::CameraInfo createCameraInfoStereoQQQQ720PX2()
sensor_msgs::CameraInfo createCameraInfoStereo720PX2()
sensor_msgs::CameraInfo createCameraInfoDEPTHQQ720P()
sensor_msgs::CameraInfo createCameraInfoBOTTOMVGA()
sensor_msgs::CameraInfo createCameraInfoDEPTH720P()
const int kInfraredOrStereoCamera
void registerCallback(const message_actions::MessageAction action, Callback_t cb)
boost::function< void(sensor_msgs::ImagePtr, sensor_msgs::CameraInfo)> Callback_t
const sensor_msgs::CameraInfo & getCameraInfo(int camera_source, int resolution)
const int kInfraredColorSpace
sensor_msgs::CameraInfo createCameraInfoDEPTHQ720P()
std::string msg_colorspace_
sensor_msgs::CameraInfo createCameraInfoTOPQQVGA()
std::map< message_actions::MessageAction, Callback_t > callbacks_
sensor_msgs::ImagePtr toImageMsg() const
sensor_msgs::ImagePtr msg_
sensor_msgs::CameraInfo createCameraInfoBOTTOMQQVGA()