Ask Your Question

Accessing pixels in Mat using Android (Java API)

asked 2013-03-10 01:34:29 -0600

user1446598 gravatar image

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;<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?

edit retag flag offensive close merge delete



You should use;uchar&gt;(i,j) but not;float&gt;(i,j) to access grey-scale image pixels in C++

Andrey Pavlenko gravatar imageAndrey Pavlenko ( 2013-03-11 06:17:45 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-03-10 04:51:39 -0600

Daniil Osokin gravatar image

Hi! Check the answer on this question: "How to get and modify the pixel of Mat in Java?".

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-03-10 01:34:29 -0600

Seen: 7,021 times

Last updated: Mar 10 '13