compute image contrast I need to get information about contrast of an image, and I compute its value in this way:

contrast=Pmax/Pmin


where Pmax is the pixel of the image with the highest value, an Pmin is the pixel of the image with the lower value.

Is this the correct way, or there is another approach?
There are many approaches to achieve this. For example, check the following work by Pederson et. al.:

Evaluation of contrast measures in relation to observers perceived contrast Marius Pedersen1, Alessandro Rizzi2, Jon Yngve Hardeberg1 and Gabriele Simone1.