1 | initial version |
From the head:
#include <opencv2/opencv.hpp>
using namespace cv;
// Your CV_16U3 Mat
Mat image16u3 = //$your data$;
// Convert it to CV_8U3 Mat
Mat image8u3;
image16u3.convertTo(image8U3, CV_8U3);
// Convert color to grayscale
Mat image8u1;
cvtColor(image8u3, image8u1, COLOR_RGB2GRAY);
2 | No.2 Revision |
From the head:
#include <opencv2/opencv.hpp>
using namespace cv;
// Your CV_16U3 Mat
Mat image16u3 = //$your data$;
// Convert it to CV_8U3 Mat
Mat image8u3;
image16u3.convertTo(image8U3, CV_8U3);
CV_8UC3); // CV_8U should work as well
// Convert color to grayscale
Mat image8u1;
cvtColor(image8u3, image8u1, COLOR_RGB2GRAY);
Edit: Code corrected (see below)