First time here? Check out the FAQ!

Ask Your Question
1

C++ Mat.at<uchar> to Java

asked Jun 27 '17

Mark1 gravatar image

Hi I am trying to convert some C++ OpenCV code to Java OpenCV code. I am trying to convert the following lines to Java:

for(int i = 0; i < image.rows; i++){
  for(int j = 0; j < image.cols; j++){         
    uchar p = im.at<uchar>(i, j);
  }
}

Can anyone help me out in explaining what the C++ code is doing and how to convert it? Thanks in advance

Preview: (hide)

1 answer

Sort by » oldest newest most voted
2

answered Jun 27 '17

LBerger gravatar image

In C++ at method is used for pixel access. im.at<uchar>(i,j) gives pixel value at row i and column j. Pixel type is unsigned char.

I don't know java but i think you can find an answer in this sample : you can use get method

im.get(i,j)[0]

Preview: (hide)

Question Tools

1 follower

Stats

Asked: Jun 27 '17

Seen: 3,120 times

Last updated: Jun 27 '17