Connection between grey scale and intensity in image matrices

image processingmatrix

Let A be a image matrix where each element in the matrix displays the integer value of the pixel intensity for a specific pixel. We also have a greyscale between two values.

For example let A be a image matrix symbolizing a 4×4 pixel image. The greyscale of the picture is [0,3] where 0 is black and 3 white.

$$
A =
\begin{pmatrix}
1 & 1 & 0 & 3\\
0 & 2 & 0 & 2\\
2 & 3 & 0 & 3\\
1 & 0 & 3 & 1
\end{pmatrix}
$$

Here is where I am confused, mainly in terminology. What element are of intensity 0 and 1 in the image matrix? Does intensity 1 here mean just simply each matrix element containing a 1? Or does intensity 1 mean white and therefore the elements containing a 3 in the matrix are considered of intensity 1?

Best Answer

For example let A be a image matrix symbolizing a 4x4 pixel image. The greyscale of the picture is [0,3] where 0 is black and 3 white.

This quote would indicate that, as you suspected, an intensity of 1 means white. Normally, I have seen "intensity" referred to as "brightness" or "value" in programs like Photoshop, Blender, etc. So, in your matrix you would divide everything by 3 to get the "intensity".

You can visualize this with the following code in Python:

import seaborn as sns
import matplotlib.pyplot as plt

image_matrix = [[1, 1, 0, 3],
                [0, 2, 0, 2],
                [2, 3, 0, 3],
                [1, 0, 3, 1]]

ax = sns.heatmap(image_matrix, annot=True, cmap="gist_gray")
plt.show()

enter image description here

This is a fairly common way of representing grayscale images. An 8-bit grayscale image, for example, will have a range from 0 to 2^8 - 1, or 0 to 255 for each pixel. An RGB image will have a third dimension for the "intensity" of the red, green, and blue values.

Related Question