1.sensor_msgs::Image
- data按rgbrgb…的方式保存图像
#include <fstream>
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace std;
int data[3 * 640 * 480];
void array2mat(const std::vector<unsigned char> data, int width, int height)
{
cv::Mat src = cv::Mat::zeros(height, width, CV_8UC3);
for (int i = 0; i < height; ++i)
{
for (int j = 0; j < width; j++)
{
src.at<cv::Vec3b>(i, j)[0] = data[(width * i + j)*3+2