ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

fairy's profile - activity

2014-08-17 20:32:27 -0500 received badge  Famous Question (source)
2014-01-13 04:16:00 -0500 received badge  Famous Question (source)
2013-09-20 05:33:42 -0500 received badge  Famous Question (source)
2013-08-01 03:56:05 -0500 received badge  Notable Question (source)
2013-08-01 03:49:31 -0500 received badge  Popular Question (source)
2013-07-31 17:26:20 -0500 received badge  Notable Question (source)
2013-07-31 09:58:03 -0500 asked a question subscribe multiple topics using two callbacks and one class then pass the value of one callback to other

hello! i m working on a ros integrated with opencv using cvbridge library, i have worked with opencv and ros separately then use cvbridge for integration of both of them, actually i m developing a playing activity with turtlebot, my task is to find ball and then hit the ball towards goaling point, for this purpose i have tracked a circle then found its centre co-ordinates, now i want to retrieve a depth of the circle centre by subscribing it to depth topic so basically i need two topics rgb and depth simultanueosly, i have done multiple topic subscription in ros using two call backs in a single class, both callbacks subscribe to different topic but its working till one callback use rospointer msg and other using opencv data type like iplimage, mat

void imageCb(const sensor_msgs::ImageConstPtr& msg)
{
    sensor_msgs::CvBridge bridge;
    IplImage* img = bridge.imgMsgToCv(msg,"bgr8");
}


void imageCb1(const sensor_msgs::ImageConstPtr& msg1)
{
     cv_bridge::CvImagePtr cv_ptr1;
     try
     {
         cv_ptr1 = cv_bridge::toCvCopy(msg1, enc::TYPE_32FC1);
     }
     catch (cv_bridge::Exception& e)
     {
         ROS_ERROR("cv_bridge exception: %s", e.what());
         return;
     }

     if (cv_ptr1->image.rows > 60 && cv_ptr1->image.cols > 60)
         cv::circle(cv_ptr1->image, cv::Point(50, 50), 10, CV_RGB(255,0,0));

     cv::imshow(WINDOW1, cv_ptr1->image);
     cv::waitKey(3);

     image_pub_1.publish(cv_ptr1->toImageMsg());
}

but when i am trying to use opencv purely in both callbacks by using conversion,

void imageCb1(const sensor_msgs::ImageConstPtr& msg1)
{ 
    sensor_msgs::CvBridge bridge1;
    IplImage* img1 = bridge1.img1MsgToCv(msg1,"TYPE_32FC1");    
    Mat mat(img1);
}

void imageCb(const sensor_msgs::ImageConstPtr& msg)
{
    sensor_msgs::CvBridge bridge;
    IplImage* img1 = bridge.img1MsgToCv(msg1,"bgr8");
}

conflict occur that produces segmentation fault

2013-07-31 08:15:59 -0500 received badge  Notable Question (source)
2013-07-30 22:38:09 -0500 commented answer depth of points in RGB using kinect driver

thanks for the answer, but can I retrieve depth of particular point without going in to pcl? by making use of opencv function cvGet2D in order to access the intensity of particular point

2013-07-29 10:29:53 -0500 received badge  Popular Question (source)
2013-07-26 23:01:08 -0500 received badge  Editor (source)
2013-07-26 23:00:15 -0500 asked a question depth of points in RGB using kinect driver

the depth values that obtain by kinect driver is actually a no. of streams that continuously changing even if kinect remain stationary can u tell me plz y is it so? secondly if i want to access the depth of particular point out of the depth of all points that is seen by kinect, how can i do it? plz guide me

2013-07-25 09:14:47 -0500 commented answer What is the best way to get depth values from kinect?

the depth values that obtain by kinect driver is actually a no. of streams that continuously changing even if kinect remain stationary can u tell me plz y is it so? secondly if i want to access the depth of particular point out of the depth of all points that is seen by kinect, how can i do it? plz guide me

2013-07-23 11:03:37 -0500 received badge  Popular Question (source)
2013-07-23 06:41:47 -0500 asked a question accessing value of variable of one callback in other callback

I have 2 callbacks in my program subcribing on depth and rgb image.I have detected circle and calculated its centre point from rgb data now I am trying to access the depth value of that centre point by passing the point to the second callback but when I run the code it generate "segmentation fault". Is there any solution for this??? kindly help