Exact histogram specification as described in http://www.mcc.unam.mx/avisos/materiales/exacthistospecific.pdf