Locality preserving hashing