A doctor convicted of secretly taking intimate photos and videos of patients has been released from jail, saying he wants to work hard to be a "better man".