Source: https://www.lri.fr/~jcohen/documents/HDR/chap6.pdf