Knowledge of optimal quantum measurements is important for a wide range of situations, including quantum communication and quantum metrology. Quantum measurements are usually optimised with an ideal experimental realisation in mind. Real devices and detectors are, however, imperfect. This has to be taken into account when optimising quantum measurements. In this paper, we derive the optimal minimum-cost and minimum-error measurements for a general model of imperfect detection.