Hi, there some problems for connecting two packages. That, i learn learning_image_transport, and i create anther package named "subscriber" for subscribing the image which "learning_image_transport" published.
And the code of "subscriber" packages, /src/subscriber.cpp:
#include <ros/ros.h>
#include <image_transport/image_transport.h>
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <cv_bridge/CvBridge.h>
IplImage* img_original=NULL;
void imageCallback(const sensor_msgs::ImageConstPtr& msg)
{
sensor_msgs::CvBridge bridge;
img_original=bridge.imgMsgToCv(msg,"bgr8");
try
{
cvShowImage("view",img_original);
}
catch(sensor_msgs::CvBridgeException& e)
{
ROS_ERROR("Could not convert from '%s' to ''bgr8",msg->encoding.c_str());
}
}
int main(int argc,char**argv)
{
ros::init(argc,argv,"image_subscriber",ros::init_options::AnonymousName);
ros::NodeHandle nh;
cvNamedWindow("Subscriber");
cvStartWindowThread();
image_transport::ImageTransport it(nh);
image_transport::Subscriber sub=it.subscribe(argv[1],1,imageCallback);
ros::spin();
cvDestroyWindow("Subscriber");
}
for checking my rxgraph:
that "image_subscriver" node has already connected "image_publisher" node. But why it does not preform the image?
PS: my rostopic list as follow: /camera/image /camera/image/compressed /camera/image/compressed/parameter_descriptions /camera/image/compressed/parameter_updates /camera/image/theora /camera/image/theora/parameter_descriptions /camera/image/theora/parameter_updates /rosout /rosout_agg
Originally posted by Yongqiang Gao on ROS Answers with karma: 133 on 2011-03-09
Post score: 0
Original comments
Comment by KoenBuys on 2011-03-10:
You might want to choose your title a little bit more detailed