Fix incorrect Mat address reconstruction on 64-bit platforms

This fixes random failures in Java wrappers.
This commit is contained in:
Andrey Kamaev 2013-01-15 19:23:49 +04:00
parent c49b23d4dd
commit bf3c2b0bbb
2 changed files with 2 additions and 2 deletions

View File

@ -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++)
{
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 );
v_mat.push_back(m);
}

View File

@ -262,7 +262,7 @@ public class Converters {
int[] buff = new int[count * 2];
m.get(0, 0, buff);
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));
}
}