一.机器视觉
1.二维图像:
$ roslaunch usb_cam usb_cam-test.launch
$ rostopic list
$ rosmsg show sensor_msgs/Image
std_msgs/Header header:消息头 消息序号(自动) 时间戳 (手动)绑定坐标系(手动) 大多数不需要配置
uint32 seq:
time stampint32 height:分辨率
uint32 width:分辨率
string encoding:编码格式 无压缩
uint8 is_bigendian 图像数据的大小端储存模式
uint32 step:一行图像数据的字节数量,作为数据的步长参数
uint8[] data:储存图像数据的数组,大小为step*height个字节
压缩图像消息:
$ rostopic info /usb_cam/image_raw/compressed
$ rosmsg show sensor_msgs/CompressedImage
成员变量:
std_msgs/Header header
uint32 seq
time stamp
string frame_idstring format:图像的压缩编码格式(jpeg,png,bmp)
uint8[] data:储存图像数据数组
2.三维图像
$ roslaunch freenect_launch freenect.launch
$ rostopic info/camera/depth_registered/points
$ rosmsg show sensor_msgs/PointCloud2
width height 特别说明:当height设置为1时,表示点云数据是无序的;
cloud.width = 640;cloud.height=480;//表示点云数据是有序的,640行,480列。cloud.width = 307200, cloud.height = 1;//表示点云数据是无序的。
points
包含所有存储的点云(Point<T>)的数组。如果一个点云包含XYZ的数据,那么points的数据结构为pcl::PointXYZ。
pcl::Poin<pcl::PointXYZ> cloud;
std::vector<pcl::PointXYZ> data = cloud.points;
is_dense
指定某些点的XYZ值中的所有点的数据是有限的(真) ,还是可能包含INF / NaN值(假) 。
fields:每个点的数据类型
为何要进行摄像头标定:为避免数据源造成的误差,对摄像头的参数进行标定
3.ros+opencv
$ roslaunch robot_vision usb_cam.launch
$ rosrun robot_vision cv_bridge_test.py
$ rqt_image_view