Robotics StackExchange | Archived questions

depth info segmentation fault

Hi, I searched many of answer blogs but didn't help. So I'm here.

I'm trying to get the depth info of a ball on the flight. I'm using openni and opencv2 on ros groovy. I'm getting a weird segmentation fault when I run the node. Following is the flowchart of my code .

depthingcallBack(){ get depth img Mat dimg; get dept info of dimg(i,j), where (i, j) is are the pixel coordinate of the center of the ball and (i, j) is calculated in rgbimgcallback() publish depth info; }

rgbimgcallback(){ get rgb image Mat rgb_img; do some image manipulation and get a filtered image; find largest contour using opencv methods; draw bounding rectangle around the largest contour; find the center (i, j); }

main(){

  node handle
  subscribe depth image and call depth_ing_callBack()
  subscribe rgb image and call rgb_img_callback()

}

Outcome:: case1: The node runs fine if I start the node keeping the ball inside the image frame. Once the ball is out of the image, the seg fault occurs. But some times it keeps running.
case2: It gives seg fault immediately, if I start the node without keeping the ball inside the image frame.

Am I missing something ?

Asked by samrat on 2013-12-12 08:54:52 UTC

Comments

Answers