Peenoo / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

The implementations of CvMat::get/put(i,j) and CvMat::get/put(i, j, k) are wrong #167

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In opencv_core.java, in class CvMat.

The matrix element offset calculation used in the get/put(i, j) and get/put(i, 
j, k) incorrectly assumes that the step() method does not include the memory 
taken by the channels into the result. This produces IndexOutOfBoundsException 
when trying to access the multichannel matrix.

Currently the expression is "(i*step()/elemSize() + j)*channels()", it should 
be "i*step()/elemSize()+j*channels()" instead.

What steps will reproduce the problem?
1.Load a RGB image into a matrix with cvLoadImageM().
2.Try accessing the bottom right pixel.

What is the expected output? What do you see instead?
Expected output is a value of one of the channels. An IndexOutOfBoundsException 
is thrown instead.

What version of the product are you using? On what operating system?
Version 2012021. On Windows XP 32.

Original issue reported on code.google.com by vejobro...@gmail.com on 6 Mar 2012 at 5:10

GoogleCodeExporter commented 9 years ago
Ah yes, thank you for reporting. Will fix

Original comment by samuel.a...@gmail.com on 7 Mar 2012 at 5:53

GoogleCodeExporter commented 9 years ago
Fixed in latest release, thanks again for reporting!

Original comment by samuel.a...@gmail.com on 29 Mar 2012 at 12:38