Added more comprobations to avoid zero division.
Multiscale detection is performed.
pixelShift is now obtained from image size.