This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

VLIB erode dilate moving left?

Hi, 

I notice every time I applied VLIB erode or dilate, the binary image will move to left for 1 pixel. 

I realize that's because of the mask size is 3x3. Am I right about this? 

Similarly, for VLIB_xyGradientsAndMagnitude(), the right way to call it is:

VLIB_xyGradientsAndMagnitude(pImg,
                                                    pGradX + width + 1,
                                                    pGradY + width + 1,
                                                    pGradMag + width + 1,

                                                   ... );

So the +1 is kinda compensating the 1 pixel. However in dilate or erode, the input is packed binary image, so there is no easy way to compensate this, right? 

For one time dilate or erode, 1 pixel is ok. However after some combination of opening or closing, the shift is dramatic. 

So I should manually compensating the shift afterwards, right? Thanks a lot.