preperation for pixel distance threshold