Ask Your Question
0

how to align depth image and rgb image from kinect using opencv(python wrapper)?

asked 2016-11-15 18:08:58 -0600

santhukar gravatar image

updated 2016-11-16 01:22:59 -0600

berak gravatar image

I performed the calibration as described in tutorial (http://wiki.ros.org/openni_launch/Tut...), I am using libfreenect ,

## i obtained the following as correction yaml files

how use the depth or disparity image from kinect in function reprojectImageTo3D() ( it requires disparity image and Q matrix) to obtain 3D map.

2 )how can i compute Q matrix ?

DEPTH CALIBRATION DATA

image_width: 640
image_height: 488
camera_name: depth_0000000000000000
camera_matrix:
  rows: 3
  cols: 3
  data: [562.2209020269851, 0, 295.4125802978841, 0, 565.8847255058765, 262.3259607398875, 0, 0, 1]
distortion_model: plumb_bob
distortion_coefficients:
  rows: 1
  cols: 5
  data: [-0.1259995811013459, 0.1811366154284992, 0.01130003143823414, -0.009229840629574821, 0]
rectification_matrix:
  rows: 3
  cols: 3
  data: [1, 0, 0, 0, 1, 0, 0, 0, 1]
projection_matrix:
  rows: 3
  cols: 4
  data: [555.9630126953125, 0, 290.5473281458035, 0, 0, 559.1112060546875, 267.2632963446558, 0, 0, 0, 1, 0]

RGB CALIBRATION DATA

image_width: 640
image_height: 480
camera_name: rgb_0000000000000000
camera_matrix:
  rows: 3
  cols: 3
  data: [495.9302302198659, 0, 306.9398440268479, 0, 499.8108755587267, 249.034495543172, 0, 0, 1]
distortion_model: plumb_bob
distortion_coefficients:
  rows: 1
  cols: 5
  data: [-0.03382499267587227, -0.009317764701757332, 0.01484486854679595, -0.005902203980048986, 0]
rectification_matrix:
  rows: 3
  cols: 3
  data: [1, 0, 0, 0, 1, 0, 0, 0, 1]
projection_matrix:
  rows: 3
  cols: 4
  data: [489.8033447265625, 0, 302.1437562610008, 0, 0, 495.2186279296875, 254.955970881063, 0, 0, 0, 1, 0]
edit retag flag offensive close merge delete

Comments

would you be so nice, and replace the screenshot with a text version ?

berak gravatar imageberak ( 2016-11-15 20:15:07 -0600 )edit

Thanks for the suggestion,

santhukar gravatar imagesanthukar ( 2016-11-15 23:27:49 -0600 )edit

Thank you, can you point me how to get 3D map after aligning depth and rgd image?, I thought of using reprojectImageTo3D() but it requires Q matrix,for Kinect how can compute Q matrix and disparity matrix?

santhukar gravatar imagesanthukar ( 2016-11-16 06:16:50 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-11-16 07:11:02 -0600

berak gravatar image

for a stereo cam, you would use stereoRectify() to obtain R,T and Q mat's, then use block-matchhing to get the disparity.

you case ofc. is different, since you already got a depth image. you might try to construct Q from img size and focal length :

Q = np.float32([[1, 0, 0, -0.5*w],
                [0,-1, 0,  0.5*h], # turn points 180 deg around x-axis,
                [0, 0, 0,     -f], # so that y-axis looks up
                [0, 0, 1,      0]])
edit flag offensive delete link more

Comments

I am using kinect

santhukar gravatar imagesanthukar ( 2016-11-16 07:23:55 -0600 )edit

you told us before.

berak gravatar imageberak ( 2016-11-16 07:46:58 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-11-15 18:08:58 -0600

Seen: 2,137 times

Last updated: Nov 16 '16