First time here? Check out the FAQ!

Ask Your Question
2

Accessing pixels in Mat using Android (Java API)

asked Mar 10 '13

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?

Preview: (hide)

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 (Mar 11 '13)edit

1 answer

Sort by » oldest newest most voted
3

answered Mar 10 '13

Daniil Osokin gravatar image

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

Preview: (hide)

Question Tools

1 follower

Stats

Asked: Mar 10 '13

Seen: 7,095 times

Last updated: Mar 10 '13