public Mat(Mat m, Rect roi) - opencv4android Version 2.4.1 (Bug #2063)
Description
- This constructor is not functioning properly.
- I have to swap the value of x and y, also width and height, of ROI, to make it work as it should, like this:
int temp = roi.width; roi.width = roi.height; roi.height = temp; temp = roi.x; roi.x = roi.y; roi.y = temp;
- In Mat.java I found the constructor code :
public Mat(Mat m, Rect roi) { nativeObj = n_Mat(m.nativeObj, roi.x, roi.x + roi.width, roi.y, roi.y + roi.height); return; }
Where the description for n_Mat is:
long org.opencv.core.Mat.n_Mat(long m_nativeObj, int rowRange_start, int rowRange_end, int
colRange_start, int colRange_end)
I then tried to display image.rows (in c++) for a image with a width of 547 and a height of 289, the result is 289.
- So i reckon the constructor should actually be:
public Mat(Mat m, Rect roi)
{
nativeObj = n_Mat(m.nativeObj, roi.y, roi.y + roi.height, roi.x, roi.x + roi.width);
return;
}
BTW, I am using opencv4android version 2.4.1 (with eclipse).
Associated revisions
fix for #2063 ( Mat(Mat m, Rect roi) returns wrong sub-mat)
Merge pull request #2063 from vpisarev:ocl_moments
History
Updated by Kirill Kornyakov over 12 years ago
Andrey, could you please check it?
- Category set to java bindings
- Assignee set to Andrey Pavlenko
Updated by Andrey Pavlenko over 12 years ago
Thanks for reporting! Fixed in r8705, targeted to coming 2.4.2.
- Status changed from Open to Done
- Target version set to 2.4.2