Why is cvtColort ~10 times faster than:
float coeffs[3];
coeffs[0] = 0;
coeffs[1] = 1;
coeffs[2] = 0;
gray = Mat(color.rows, color.cols, CV_8UC1);
for (int i = 0; i < color.rows; i++) {
for (int j = 0; j < color.cols; j++) {
gray.at<uchar>(i, j) = 0;
for (int k = 0; k < 3; k++) {
gray.at<uchar>(i, j) += coeffs[k] * color.at<Vec3b>(i, j)[k];
}
}
}
I tried changing row/col for order but it does not change the time.