当前位置: 首页>>代码示例>>C++>>正文


C++ image_transport::CameraPublisher类代码示例

本文整理汇总了C++中image_transport::CameraPublisher的典型用法代码示例。如果您正苦于以下问题:C++ CameraPublisher类的具体用法?C++ CameraPublisher怎么用?C++ CameraPublisher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CameraPublisher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: publishRgbImage

  void OpenNINode::publishRgbImage(const openni_wrapper::Image& rgb_img, image_transport::CameraPublisher img_pub) const {
      sensor_msgs::ImagePtr rgb_msg = boost::make_shared<sensor_msgs::Image>();
      ros::Time time = ros::Time::now();
      rgb_msg->header.stamp    = time;
      rgb_msg->encoding        = enc::RGB8;
      rgb_msg->width           = depth_width_;
      rgb_msg->height          = depth_height_;
      rgb_msg->step            = rgb_msg->width * 3;
      rgb_msg->data.resize(rgb_msg->height * rgb_msg->step);

      rgb_img.fillRGB(rgb_msg->width, rgb_msg->height, reinterpret_cast<unsigned char*>(&rgb_msg->data[0]), rgb_msg->step);

      img_pub.publish(rgb_msg, getDepthCameraInfo(rgb_msg->width, rgb_msg->height, time, 1));
    }
开发者ID:Rbelder,项目名称:saphari_final_review,代码行数:14,代码来源:driver.cpp

示例2: publishframe

void publishframe(camera_info_manager::CameraInfoManager *mgr, const image_transport::CameraPublisher &campub, const sensor_msgs::ImagePtr img, const std::string& frame)
{
  ros::Time timestamp = ros::Time::now();
  sensor_msgs::CameraInfo::Ptr cinfo(new sensor_msgs::CameraInfo(mgr->getCameraInfo()));
  std_msgs::Header::Ptr imageheader(new std_msgs::Header());
  std_msgs::Header::Ptr cinfoheader(new std_msgs::Header());
  imageheader->frame_id = frame;
  cinfoheader->frame_id = frame;
  imageheader->stamp = timestamp;
  cinfoheader->stamp = timestamp;
  img->header = *imageheader;
  cinfo->header = *cinfoheader;
  campub.publish(img, cinfo);
}
开发者ID:Galactus,项目名称:ROS_OpenLeap,代码行数:14,代码来源:ros_leap_driver.cpp

示例3: publishDepthImage

  void OpenNINode::publishDepthImage(const openni_wrapper::DepthImage& depth, image_transport::CameraPublisher depth_pub) const {
      sensor_msgs::ImagePtr depth_msg = boost::make_shared<sensor_msgs::Image>();
      ros::Time time = ros::Time::now();
      depth_msg->header.stamp    = time;
      depth_msg->encoding        = sensor_msgs::image_encodings::TYPE_32FC1;
      depth_msg->width           = depth_width_;
      depth_msg->height          = depth_height_;
      depth_msg->step            = depth_msg->width * sizeof(float);
      depth_msg->data.resize(depth_msg->height * depth_msg->step);

      depth.fillDepthImage(depth_msg->width, depth_msg->height, reinterpret_cast<float*>(&depth_msg->data[0]), depth_msg->step);

      depth_pub.publish(depth_msg, getDepthCameraInfo(depth_msg->width, depth_msg->height, time, 1));
      //pub.publish(depth_msg);
    }
开发者ID:Rbelder,项目名称:saphari_final_review,代码行数:15,代码来源:driver.cpp

示例4: spin

    	/// Continuously advertises xyz and grey images.
	bool spin()
	{
		boost::mutex::scoped_lock lock(service_mutex_);
		sensor_msgs::Image::Ptr xyz_image_msg_ptr;
		sensor_msgs::Image::Ptr grey_image_msg_ptr;
		sensor_msgs::CameraInfo tof_image_info;
	
		if(tof_camera_->AcquireImages(0, &grey_image_32F1_, &xyz_image_32F3_, false, false, ipa_CameraSensors::INTENSITY) & ipa_Utils::RET_FAILED)
		{
			ROS_ERROR("[tof_camera] Tof image acquisition failed");
			return false;
		}

		/// Filter images by amplitude and remove tear-off edges
		//if(filter_xyz_tearoff_edges_ || filter_xyz_by_amplitude_)
		//	ROS_ERROR("[tof_camera] FUNCTION UNCOMMENT BY JSF");
		if(filter_xyz_tearoff_edges_) ipa_Utils::FilterTearOffEdges(xyz_image_32F3_, 0, (float)tearoff_tear_half_fraction_);
		if(filter_xyz_by_amplitude_) ipa_Utils::FilterByAmplitude(xyz_image_32F3_, grey_image_32F1_, 0, 0, lower_amplitude_threshold_, upper_amplitude_threshold_);

		try
		{
			IplImage img = xyz_image_32F3_;
			xyz_image_msg_ptr = sensor_msgs::CvBridge::cvToImgMsg(&img, "passthrough");
		}
		catch (sensor_msgs::CvBridgeException error)
		{
			ROS_ERROR("[tof_camera] Could not convert 32bit xyz IplImage to ROS message");
			return false;
		}

		try
		{
			IplImage img = grey_image_32F1_;
			grey_image_msg_ptr = sensor_msgs::CvBridge::cvToImgMsg(&img, "passthrough");
		}
		catch (sensor_msgs::CvBridgeException error)
		{
			ROS_ERROR("[tof_camera] Could not convert 32bit grey IplImage to ROS message");
			return false;
		}

		/// Set time stamp
		ros::Time now = ros::Time::now();
		xyz_image_msg_ptr->header.stamp = now;
		grey_image_msg_ptr->header.stamp = now;

		tof_image_info = camera_info_msg_;
		tof_image_info.width = grey_image_32F1_.cols;
		tof_image_info.height = grey_image_32F1_.rows;
		tof_image_info.header.stamp = now;

		/// publish message
		xyz_image_publisher_.publish(*xyz_image_msg_ptr, tof_image_info);
		grey_image_publisher_.publish(*grey_image_msg_ptr, tof_image_info);

		return true;
	}
开发者ID:ipa-mars,项目名称:care-o-bot,代码行数:58,代码来源:tof_camera.cpp

示例5: imageCB

  void imageCB(const sensor_msgs::ImageConstPtr& image_l,
	       const sensor_msgs::CameraInfoConstPtr& info_l,
	       const sensor_msgs::ImageConstPtr& image_r,
	       const sensor_msgs::CameraInfoConstPtr& info_r)  {

    sensor_msgs::Image img = *image_r;
    sensor_msgs::CameraInfo info = *info_r;

    //img.header.stamp = image_l->header.stamp;
    //info.header.stamp = info_l->header.stamp;

    pub_left_.publish(image_l, info_l);
    pub_right_.publish(img, info, info_l->header.stamp);
    //pub_right_.publish(*image_r, *info_r, info_l->header.stamp);
  }
开发者ID:130s,项目名称:jsk_common,代码行数:15,代码来源:stereo_synchronizer.cpp

示例6: ir_img

void
pubRealSenseInfraredImageMsg(cv::Mat& ir_mat)
{
	sensor_msgs::ImagePtr ir_img(new sensor_msgs::Image);;

	ir_img->header.seq = head_sequence_id;
	ir_img->header.stamp = head_time_stamp;
	ir_img->header.frame_id = depth_frame_id;


	ir_img->width = ir_mat.cols;
	ir_img->height = ir_mat.rows;

	ir_img->encoding = sensor_msgs::image_encodings::MONO8;
	ir_img->is_bigendian = 0;

	int step = sizeof(unsigned char) * ir_img->width;
	int size = step * ir_img->height;
	ir_img->step = step;
	ir_img->data.resize(size);
	memcpy(&ir_img->data[0], ir_mat.data, size);

	ir_camera_info->header.frame_id = depth_frame_id;
	ir_camera_info->header.stamp = head_time_stamp;
	ir_camera_info->header.seq = head_sequence_id;

	realsense_infrared_image_pub.publish(ir_img, ir_camera_info);
}
开发者ID:nlyubova,项目名称:realsense_camera,代码行数:28,代码来源:realsense_camera.cpp

示例7: depth_img

void
pubRealSenseDepthImageMsg32F(cv::Mat& depth_mat)
{
  sensor_msgs::ImagePtr depth_img(new sensor_msgs::Image);

  depth_img->header.seq = head_sequence_id;
  depth_img->header.stamp = head_time_stamp;
  depth_img->header.frame_id = depth_frame_id;

  depth_img->width = depth_mat.cols;
  depth_img->height = depth_mat.rows;

  depth_img->encoding = sensor_msgs::image_encodings::TYPE_32FC1;
  depth_img->is_bigendian = 0;

  int step = sizeof(float) * depth_img->width;
  int size = step * depth_img->height;
  depth_img->step = step;
  depth_img->data.resize(size);
  memcpy(&depth_img->data[0], depth_mat.data, size);

  ir_camera_info->header.frame_id = depth_frame_id;
  ir_camera_info->header.stamp = head_time_stamp;
  ir_camera_info->header.seq = head_sequence_id;

/*double minVal, maxVal;
cv::minMaxLoc(depth_mat, &minVal, &maxVal);
std::cout << " ***** " << minVal << " " << maxVal << std::endl;*/

  realsense_depth_image_pub.publish(depth_img, ir_camera_info);
//pub_depth_info.publish(ir_camera_info);
}
开发者ID:nlyubova,项目名称:realsense_camera,代码行数:32,代码来源:realsense_camera.cpp

示例8: connectCb

// Handles (un)subscribing when clients (un)subscribe
void CropDecimateNodelet::connectCb()
{
  boost::lock_guard<boost::mutex> lock(connect_mutex_);
  if (pub_.getNumSubscribers() == 0)
    sub_.shutdown();
  else if (!sub_)
    sub_ = it_in_->subscribeCamera("image_raw", queue_size_, &CropDecimateNodelet::imageCb, this);
}
开发者ID:strawlab,项目名称:image_pipeline,代码行数:9,代码来源:crop_decimate.cpp

示例9:

  virtual ~SensorStreamManager()
  {
    stream_.removeNewFrameListener(this);
    stream_.stop();
    stream_.destroy();

    publisher_.shutdown();
  }
开发者ID:amiltonwong,项目名称:openni2_camera,代码行数:8,代码来源:camera.cpp

示例10: getNumDepthSubscribers

int getNumDepthSubscribers()
{
    int n = realsense_points_pub.getNumSubscribers() + realsense_reg_points_pub.getNumSubscribers() + realsense_depth_image_pub.getNumSubscribers();
#ifdef V4L2_PIX_FMT_INZI
    n += realsense_infrared_image_pub.getNumSubscribers();
#endif
    return n;
}
开发者ID:nlyubova,项目名称:realsense_camera,代码行数:8,代码来源:realsense_camera.cpp

示例11: publishImage

  void publishImage (FlyCapture2::Image * frame)
  {
    //sensor_msgs::CameraInfoPtr cam_info(new sensor_msgs::CameraInfo(cam_info_->getCameraInfo()));
    // or with a member variable:
    cam_info_ptr_ = sensor_msgs::CameraInfoPtr(new sensor_msgs::CameraInfo(cam_info_mgr_->getCameraInfo()));

    if (processFrame (frame, img_, cam_info_ptr_))
      streaming_pub_.publish (img_, *cam_info_ptr_);
  }
开发者ID:ccny-ros-pkg,项目名称:ccny_camera_drivers,代码行数:9,代码来源:pgr_camera_node.cpp

示例12: stop

  void stop ()
  {
    if (!running)
      return;

    cam_->stop ();              // Must stop camera before streaming_pub_.
    poll_srv_.shutdown ();
    streaming_pub_.shutdown ();

    running = false;
  }
开发者ID:ccny-ros-pkg,项目名称:ccny_camera_drivers,代码行数:11,代码来源:pgr_camera_node.cpp

示例13: connectCb

// Handles (un)subscribing when clients (un)subscribe
void CropDecimateNodelet::connectCb()
{
  boost::lock_guard<boost::mutex> lock(connect_mutex_);
  if (pub_.getNumSubscribers() == 0)
    sub_.shutdown();
  else if (!sub_)
  {
    image_transport::TransportHints hints("raw", ros::TransportHints(), getPrivateNodeHandle());
    sub_ = it_in_->subscribeCamera("image_raw", queue_size_, &CropDecimateNodelet::imageCb, this, hints);
  }
}
开发者ID:OSURoboticsClub,项目名称:Rover2016,代码行数:12,代码来源:crop_decimate.cpp

示例14: onSubscriptionChanged

  virtual void onSubscriptionChanged(const image_transport::SingleSubscriberPublisher& topic)
  {
    size_t disparity_clients = disparity_publisher_.getNumSubscribers() + disparity_registered_publisher_.getNumSubscribers();
    size_t depth_clients = publisher_.getNumSubscribers() + depth_registered_publisher_.getNumSubscribers();
    size_t all_clients = disparity_clients + depth_clients;

    if(!running_ && all_clients > 0)
    {
      running_ = (stream_.start() == STATUS_OK);
    }
    else if(running_ && all_clients == 0)
    {
      stream_.stop();
      running_ = false;
    }

    if(running_)
    {
      updateActivePublisher();
    }
  }
开发者ID:amiltonwong,项目名称:openni2_camera,代码行数:21,代码来源:camera.cpp

示例15: take_and_send_image

  bool take_and_send_image()
  {
    usb_cam_camera_grab_image(camera_image_);
    fillImage(img_, "rgb8", camera_image_->height, camera_image_->width, 3 * camera_image_->width, camera_image_->image);
    img_.header.stamp = ros::Time::now();

    sensor_msgs::CameraInfoPtr ci(new sensor_msgs::CameraInfo(cinfo_->getCameraInfo()));
    ci->header.frame_id = img_.header.frame_id;
    ci->header.stamp = img_.header.stamp;

    image_pub_.publish(img_, *ci);
    return true;
  }
开发者ID:eigendreams,项目名称:workspace,代码行数:13,代码来源:usb_cam_node.cpp


注:本文中的image_transport::CameraPublisher类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。