33 #include <opencv2/core/core.hpp>
34 #include <opencv2/imgproc/imgproc.hpp>
39 CV_Assert(image.depth() == CV_8U);
40 CV_Assert(image.channels() == 3);
42 int nRows = image.rows;
43 int nCols = image.cols;
46 if (image.isContinuous()) {
56 for (i = 0; i < nRows; ++i) {
57 p = image.ptr<uchar>(i);
58 for (j = 0; j < nCols; j += 6) {
59 img[index_img++] = p[j + 1];
60 img[index_img++] = p[j];
61 img[index_img++] = p[j + 2];
62 img[index_img++] = p[j + 3];
72 cvtColor(image, image, COLOR_BGR2YUV);
80 CV_Assert(image.depth() == CV_8U);
81 CV_Assert(image.channels() == 1);
83 int n_rows = image.rows;
84 int n_cols = image.cols;
87 if (image.isContinuous()) {
97 for (i = 0; i < n_rows; ++i) {
98 p = image.ptr<uchar>(i);
99 for (j = 0; j < n_cols; j++) {
100 img[index_img++] = 127;
101 img[index_img++] = p[j];
void grayscale_opencv_to_yuv422(Mat image, char *img, int width, int height)
void coloryuv_opencv_to_yuv422(Mat image, char *img, int width, int height)
void colorrgb_opencv_to_yuv422(Mat image, char *img, int width, int height)
A small library with functions to convert between the Paparazzi used YUV422 arrays and the opencv ima...