Two possible colors , i.e. Black or white. Black is represented by the value 0 while 1 represents white. Binary grayscale image consists of 8 bits per pixel. This means you can have 256 different shades where 0 pixels will represent black while 255 denotes white. For example, the image below shows a grayscale image represented as a matrix. Grayscale image color image color images are represented as a combination of red, blue, and green , and all other colors can be achieved by mixing these primary colors in the correct proportions.
Color image a color image also consists of 8 bits per pixel. As a result, 256 different color shades can be represented with 0 denoting black and 255 white. Let's look at the famous colored image of a mandrel that has been cited in many examples of image e commerce photo editing service processing . Chuck image if we were to check the shape of the image above, we would get: chuck 1 this means that we can represent the image above in the form of a three-dimensional matrix. Three-dimensional mandrel images and opencv opencv can be used to perform simple image operations such as: open and save images draw simple shapes on images write on pictures these are basic operations
needed to create a base before moving on to be able to use all the advanced features that opencv offers. For the following examples we will use jupyter as the python ide. Import images in opencv to be able to import images in opencv, follow these steps: 1) import the necessary libraries import images 1 2) read the image using the imread function . For this example we will use the image of the mandrel (you can download it here ) import images 2 3) choose the type and shape of the matrix . With the following code we will transform the image into a numpy matrix with a shape of 1300×1950