Ask Your Question
1

C++ Mat.at<uchar> to Java

asked 2017-06-27 14:34:59 -0500

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

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2017-06-27 14:53:30 -0500

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]

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-06-27 14:34:59 -0500

Seen: 550 times

Last updated: Jun 27 '17