encoder initialized

fixed camera, and added encoder initialize and close.