Ask Your Question
2

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

edit retag flag offensive close merge delete

Comments

1

You should use mat.at&lt;uchar&gt;(i,j) but not mat.at&lt;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
3

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

Stats

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

Seen: 7,078 times

Last updated: Mar 10 '13