Freenect camera

three kinds of messages

  1. rgb camera
  2. depth camera
  3. ir camera

ir camera returns a picture looks like a rgb picture, but with some patterns in it. According to the patterns, camera obtains the depth picture.

click here to see the properties of every message, Compact Message Definition:

std_msgs/Header header
uint32 height
uint32 width
string encoding
uint8 is_bigendian
uint32 step
uint8[] data

Encoding

I think, the most important property is encoding, which decide the data type of the picture.
use following code to see the encoding type of one particular image:

cout << tem_msg->encoding.c_str() << endl

use following code to see the meaning of encoding and to to select a opencv image type to convert ros image into:

gedit /opt/ros/kinetic/include/sensor_msgs/image_encodings.h

click here to see OpenCV CvMat types.

Besides rgb channels, there might be a alpla channel, which means transparency.

click here to see how to convert ros images into opencv images. Apparently, It is easier to process the pictures when converted into opencv form.

Header

img_l_msg->header.stamp.toSec()

header.stamp suggests the exact time when the message is sent.
header has some other properties which, however, I don’t know how to use yet, camera id etc.

Information of Camera

#   image_raw - raw data from the camera driver, possibly Bayer encoded
#   image            - monochrome, distorted
#   image_color      - color, distorted
#   image_rect       - monochrome, rectified
#   image_rect_color - color, rectified
  • Bayer coding is when a pixel has only one color(red green or blue), because that is how most camera works. To get a normal picture, we use the 8 pixels round one pixel to get its missing color channel.

  • mono- means one

  • distorted means a straight line is no more a straight line because the faulty of lens. Using the camera parameter to rectify the picture.

Thus, I think image_rect_color is the most useful message.

猜你喜欢

转载自blog.csdn.net/qq_39575818/article/details/87637364
今日推荐