depth info segmentation fault [closed]
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 .
depth_ing_callBack(){ get depth img Mat d_img; get dept info of d_img(i,j), where (i, j) is are the pixel coordinate of the center of the ball and (i, j) is calculated in rgb_img_callback() publish depth info; }
rgb_img_callback(){ 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 ?