An ex-cop jailed for two decades forced a woman to have sex with him after threatening to release intimate images of her, a court has been told.