Prerequisite – RGB image representation
A colored image can be represented as a 3 order matrix. The first order is for the rows, the second order is for the columns and the third order is for specifying the color of the corresponding pixel. Here we use the RGB color format, so the third order will take 3 values of Red, Green ans Blue respectively. The values of the rows and columns depends on the size of the image.
- Load the image into a variable J by using imread().
- Store the number of rows and columns of the image in variables, r and c.
- Create 3 zero matrices R, G and B (one for each of the 3 colors) of size rXc.
- Store the corresponding color plane of the image in the corresponding zero matrix.
1: Red 2: Green 3: Blue
- Display the images by using imshow(), but typecast them into uint8 first.