On a black and white image, is there a way to calculate how much black and how much white is used?

On a black and white image, is there a way to calculate how much black and how much white is used?