Optimal extinction measurements: I. Single-object extinction inference