Reading a digital image (color image) in GNU Octave
Digital image:
An image is defined as a two dimensional function of f(x,y), where x and y are spatial coordinates, and the amplitude of f at any pair of coordinates (x,y) is called the intensity of the image at that point. When x, y and the amplitude f are all finite and discrete quantities, we call the image a digital image.
An image is defined as a two dimensional function of f(x,y), where x and y are spatial coordinates, and the amplitude of f at any pair of coordinates (x,y) is called the intensity of the image at that point. When x, y and the amplitude f are all finite and discrete quantities, we call the image a digital image.
A color digital image:
A color image consists of 3 channels- namely the R(Red), G(Green) and B(Blue). For more information on color image click here.
A color image consists of 3 channels- namely the R(Red), G(Green) and B(Blue). For more information on color image click here.
Let us start with a simple code of reading a digital (color) image.
Octave Code:
clc;
clear all;
input_image = imread("Ubuntu.jpg");
imshow(input_image);
clear all;
input_image = imread("Ubuntu.jpg");
imshow(input_image);
Explanation:
imread (): Reads the digital image and creates a variable input_image and stores the digital image as a two dimensional array of size M×N ; where M equals to number of rows and N equals to no of columns. M and N basically represent the size of image in terms of height and width respectively. You can check the size of the image by checking the property of the image.
imread (): Reads the digital image and creates a variable input_image and stores the digital image as a two dimensional array of size M×N ; where M equals to number of rows and N equals to no of columns. M and N basically represent the size of image in terms of height and width respectively. You can check the size of the image by checking the property of the image.
imshow (): Display the digital image stored.
Observation:
If you closely observe the workspace in main window, one can observe the variables created in workspace. Here is the snapshot of the workspace.
If you closely observe the workspace in main window, one can observe the variables created in workspace. Here is the snapshot of the workspace.
Snapshot of the workspace |
A variable input_image of class uint8 and dimension 285×285×3 has been created. We will talk about the class later and concentrate on the dimension of the image here. The properties of the image Ubuntu.jpg is shown here.
Properties of the image Ubuntu.jpg |
The width and height of the image is 285 pixels and 285 pixels respectively. While the input image is a color image and has 3 channels we have the dimensions 285×285×3.
Comments
Post a Comment