我有一个RGB图像。我使用以下命令将其加载到opencv中:
Mat image;
image = imread(argv[1], CV_LOAD_IMAGE_COLOR); // Read the file
现在,我需要根据图像数据创建一个uchar * array。
我该怎么做?
最佳答案
uchar* cv::Mat::data
pointer to the data
并且不要忘记
Mat
的实际行大小可能与width * sizeof(element)不同: cv::Mat::step is needed because the matrix can be a part of another matrix
or because there can some padding space in the end of each row for a proper
alignment.
关于opencv - 如何将opencv image(8UC3)转换为char *数组,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34367633/