Real-Time RGB-D Camera Relocalization via Randomized Ferns for Keyframe Encoding