How to get pixel data from ofxCvGrayscaleImage?

I am trying to find the white color in real time video flow. after turning the video into ofxCvGrayscaleImage as following:
grayImg = colorImg;

I suppose in ofxCvGrayscaleImage, each pixel’s brightness is represented by a single 8-bit number,is that right? Then how can I get those numbers for each pixel from 0 to 255?
Is there a way to get the pixel data as we do in grayscale ofImage?something similar to the following:

ofColor colorAtXY = myImage.getColor(x, y);
float brightnessOfColorAtXY = colorAtXY.getBrightness();

Thanks a lot!

grayImg.getPixels() will give you the raw data (it’s an unsigned char array)
grayImg.getPixelsRef() will get you the ofPixels object, which you can then interact with at a more high level.

if I wanted to get the pixel at 10,5 and the width of the image was 200, it would look like:

unsigned char * data = grayImg.getPixels();
cout << data [  5 * 200 + 10 ] << endl;

or using ofPixels

ofPixels pix = grayImg.getPixelsRef();
cout << pix.getColor(10,5).getBrightness() << endl;

hope this helps,