Since, OpenCV’s documentation is more than lacking a few sentences I’ll post some important facts that can easily be missed.
To access the elements of a
one can use the
method. Usually, the elements are stored as doubles (
). So to get for example elements (1,1) the call is
but you’re not forbidden to call
OpenCV won’t complain that you’re reading the wrong data type. OpenCV also doesn’t perform a type conversion. Hence, you’ll end up with the wrong data.
In summary, make sure you’re reading the correct data type. You might use the
method to figure out the internal type of the matrix