Be careful to be aware of the type of cv::Mat you are dealing with. For example, if you have a cv::Mat of type CV_8UC3, but access it with image.at<uchar>(r,c) no error will occur, but your program will have some unexpected behavior.
cv::Mat
CV_8UC3
image.at<uchar>(r,c)