mirror of
https://github.com/opencv/opencv.git
synced 2024-12-01 14:59:54 +08:00
Fix incorrect Mat address reconstruction on 64-bit platforms
This fixes random failures in Java wrappers.
This commit is contained in:
parent
c49b23d4dd
commit
bf3c2b0bbb
@ -219,7 +219,7 @@ void Mat_to_vector_Mat(cv::Mat& mat, std::vector<cv::Mat>& v_mat)
|
|||||||
for(int i=0; i<mat.rows; i++)
|
for(int i=0; i<mat.rows; i++)
|
||||||
{
|
{
|
||||||
Vec<int, 2> a = mat.at< Vec<int, 2> >(i, 0);
|
Vec<int, 2> a = mat.at< Vec<int, 2> >(i, 0);
|
||||||
long long addr = (((long long)a[0])<<32) | a[1];
|
long long addr = (((long long)a[0])<<32) | (a[1]&0xffffffff);
|
||||||
Mat& m = *( (Mat*) addr );
|
Mat& m = *( (Mat*) addr );
|
||||||
v_mat.push_back(m);
|
v_mat.push_back(m);
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ public class Converters {
|
|||||||
int[] buff = new int[count * 2];
|
int[] buff = new int[count * 2];
|
||||||
m.get(0, 0, buff);
|
m.get(0, 0, buff);
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
long addr = (((long) buff[i * 2]) << 32) | ((long) buff[i * 2 + 1]);
|
long addr = (((long) buff[i * 2]) << 32) | (((long) buff[i * 2 + 1]) & 0xffffffffL);
|
||||||
mats.add(new Mat(addr));
|
mats.add(new Mat(addr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user