fixed StereoBM crash on MacOSX 10.7
This commit is contained in:
parent
d60623279c
commit
fb804cb352
@ -540,7 +540,7 @@ findStereoCorrespondenceBM( const Mat& left, const Mat& right,
|
||||
sad = (int*)alignPtr(buf + sizeof(sad[0]), ALIGN);
|
||||
hsad0 = (int*)alignPtr(sad + ndisp + 1 + dy0*ndisp, ALIGN);
|
||||
htext = (int*)alignPtr((int*)(hsad0 + (height+dy1)*ndisp) + wsz2 + 2, ALIGN);
|
||||
cbuf0 = (uchar*)alignPtr(htext + height + wsz2 + 2 + dy0*ndisp, ALIGN);
|
||||
cbuf0 = (uchar*)alignPtr((uchar*)(htext + height + wsz2 + 2) + dy0*ndisp, ALIGN);
|
||||
|
||||
for( x = 0; x < TABSZ; x++ )
|
||||
tab[x] = (uchar)std::abs(x - ftzero);
|
||||
@ -552,8 +552,8 @@ findStereoCorrespondenceBM( const Mat& left, const Mat& right,
|
||||
for( x = -wsz2-1; x < wsz2; x++ )
|
||||
{
|
||||
hsad = hsad0 - dy0*ndisp; cbuf = cbuf0 + (x + wsz2 + 1)*cstep - dy0*ndisp;
|
||||
lptr = lptr0 + MIN(MAX(x, -lofs), width-lofs-1) - dy0*sstep;
|
||||
rptr = rptr0 + MIN(MAX(x, -rofs), width-rofs-1) - dy0*sstep;
|
||||
lptr = lptr0 + std::min(std::max(x, -lofs), width-lofs-1) - dy0*sstep;
|
||||
rptr = rptr0 + std::min(std::max(x, -rofs), width-rofs-1) - dy0*sstep;
|
||||
|
||||
for( y = -dy0; y < height + dy1; y++, hsad += ndisp, cbuf += ndisp, lptr += sstep, rptr += sstep )
|
||||
{
|
||||
@ -567,7 +567,7 @@ findStereoCorrespondenceBM( const Mat& left, const Mat& right,
|
||||
htext[y] += tab[lval];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// initialize the left and right borders of the disparity map
|
||||
for( y = 0; y < height; y++ )
|
||||
{
|
||||
@ -852,10 +852,12 @@ static void findStereoCorrespondenceBM( const Mat& left0, const Mat& right0, Mat
|
||||
}
|
||||
|
||||
int wsz = state->SADWindowSize;
|
||||
int bufSize0 = (ndisp + 2)*sizeof(int) + (height+wsz+2)*ndisp*sizeof(int) +
|
||||
(height + wsz + 2)*sizeof(int) +
|
||||
(height+wsz+2)*ndisp*(wsz+1)*sizeof(uchar) + 256;
|
||||
int bufSize1 = (width + state->preFilterSize + 2) * sizeof(int) + 256;
|
||||
int bufSize0 = (int)((ndisp + 2)*sizeof(int));
|
||||
bufSize0 += (int)((height+wsz+2)*ndisp*sizeof(int));
|
||||
bufSize0 += (int)((height + wsz + 2)*sizeof(int));
|
||||
bufSize0 += (int)((height+wsz+2)*ndisp*(wsz+2)*sizeof(uchar) + 256);
|
||||
|
||||
int bufSize1 = (int)((width + state->preFilterSize + 2) * sizeof(int) + 256);
|
||||
int bufSize2 = 0;
|
||||
if( state->speckleRange >= 0 && state->speckleWindowSize > 0 )
|
||||
bufSize2 = width*height*(sizeof(cv::Point_<short>) + sizeof(int) + sizeof(uchar));
|
||||
|
Loading…
Reference in New Issue
Block a user