C++ – Accessing certain pixel’s intensity value(grayscale image) in openCV

cimage processingopencv

I just realised that there is nothing on the web, after much searching about how to access a pixel's intensity value in OpenCv. A grayscale image.

Most online searches are about how to access BGR values of a colour image, like this one: Accessing certain pixel RGB value in openCV

image.at<> is basically for 3 channels, namely the BGR, out of curiousity, is there another similar method from OpenCV of accessing a certain pixel value of a grayscale image?

Best Answer

You can use image.at<uchar>(j,i) to acces a pixel value of a grayscale image.