Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Accessing pixels in Mat using Android (Java API)

I am trying to access pixels' intensity values in Mat objects (image mats and histogram mats to be specific; such as gray scale value in gray scale images) and am unsure how to do so using the Java API (not NDK).

  • In C++, it could be done as so; mat.at<float>(i,j)
  • In the OpenCV Java API there is a get(int row, int col) method, but it returns a double[]; I am unsure what this array includes, my assumption it includes each channel's value (in the given color type's order) in that very (row, col) location but could not find verifying detail in the docs.

In short; how do I access a pixel's intensity value in a Mat (single or multi-channel) using the OpenCV Java API in Android?