pdollar / toolbox

Piotr's Image & Video Matlab Toolbox
849 stars 500 forks source link

possible bug in resample? #1

Closed chyh1990 closed 9 years ago

chyh1990 commented 9 years ago

in resample():

if(ybd[0]>4) for(; y<hn; y++) { B0[ybs[y]] += C[yas[y]] * ywts[y]; }

This function yields unpredictable result if the output buffer(B) is not initialized (to zero);

pdollar commented 9 years ago

If calling from Matlab via mexFunction() output array B is initialized via "mxCreateNumericArray" in line 151. mxCreateNumericArray initializes all elements to 0. So this should not be a problem as the output B will have all 0s to start. If calling in some other way, you should make sure to allocate B so that it has all 0 elements.