How to view the colour of a pixel

Apologies for the newbie question, but I’ve been working on a Java openCV project and I need to determine the colour at a certain pixel in the image. How would I go about this assuming I don’t want to use the File and Color libraries most tutorials seem to use?

1st : tutorials and javadocs

accessing pixels goes like this:

Mat frame = ...
double[] d = frame.get(77,88); // y,x !
Scalar p = new Scalar(d);

// you can nicely print it !
System.out.println(p);

to “view” the value, maybe reserve some region:

Rect roi = new Rect(10,10,20,20);

and draw color there:

frame.submat(roi).setTo(p);