scan-c
cv::Mat src = cv::imread(filePaths[0], cv::IMREAD_COLOR);
cv::cvtColor(src, gray, cv::COLOR_RGB2GRAY);
cv::Mat gray0(gray.clone());
int nCols = gray0.cols * gray0.channels();
if (gray0.isContinuous())
for (int row = 0; row < nRows; ++row)
uchar* p = gray0.ptr(row);
for (int col = 0; col < nCols; ++col)
scan-iterator
cv::Mat gray1(gray.clone());
cv::MatIterator_ begin = gray1.begin();
cv::MatIterator_ end = gray1.end();
for (; begin != end; ++begin, ++k)
cv::Mat src1 = src.clone();
cv::MatIterator_ begin3 = src1.begin();
cv::MatIterator_ end3 = src1.end();
for (; begin3 != end3; ++begin3, ++k)
scan Vec3b
cv::Mat gray2 = gray.clone();
for (int j = 0; j < gray2.rows; ++j)
for (int i = 0; i < gray2.cols; ++i)
gray2.at(j, i) = k % 255;
cv::Mat src2 = src.clone();
for (int j = 0; j < src2.rows; ++j)
for (int i = 0; i < src2.cols; ++i)
_src2(j, i).val[0] = k % 255;
_src2(j, i)[1] = k % 255;
_src2(j, i).val[2] = k % 255;