Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

OpenCV's Java bindings Mat.get() gives weird results

$
0
0
I have a 8UC1 Mat image. I'm trying to convert it to Java 2D byte array with [x][y] coordinates. Here's what I have so far: byte[][] arr = new byte[mat.cols()][mat.rows()]; for (int colIndex = 0; colIndex < mat.cols(); colIndex++) { mat.get(0, colIndex, arr[colIndex]); } However, that gives me totally scrambled results. For example a mat with .dump() such as this: [255, 255, 255, 255, 255, 255, 255, 255, 255, 255; 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; 255, 255, 255, 255, 255, 255, 255, 255, 255, 255; 255, 255, 255, 255, 255, 255, 255, 255, 255, 255; 255, 255, 255, 255, 255, 255, 255, 255, 255, 255] gives me this (don't mind the -1, that's OK): -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 0 0 -1 -1 -1 -1 -1 -1 0 0 0 0

Viewing all articles
Browse latest Browse all 41027

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>