I’m using the camera in the latest OpenCV 2.4.3 android project, and converting a Mat to a bitmap. The utility method I’m using (provided in the OpenCV project) requires a bitmap of the same width and height as the Mat to do the conversion. When I access the mat’s height, it’s 0. The width is 640 (as expected, I expected the height to be 480).
The Mat is continuous, and while I could understand this effecting mat.rows(), it shouldn’t change the height?
For those asking for code: if you look at the Sample code, the camera activity has the following method:
public Mat onCameraFrame(Mat inputFrame) {
inputFrame.copyTo(mRgba);
DoSomething(mRgba.getNativeObjAddr());
return mRgba;
}
When I use the following to check the dimensions:
Log.d(TAG, "Width: " + mRgba.width() + ", Height:" + mRgba.height());
I get:
Width: 640, Height:0
The answer is that when I call:
that indirectly calls this:
which presumably changes the height to 0.