Lets Learn together... Happy Reading

" Two roads diverged in a wood, and I,
I took the one less traveled by,
And that has made all the difference "-Robert Frost

Image Processing with Python

 Python is a high level programming language which has easy to code syntax and offers packages for wide range of applications including numerical computing and graphics designing.
Anaconda is a python distribution which is freely downloadable. You can download and install the anaconda package in your node from the below mentioned link:




Anaconda includes most of the important packages such as matplotlib, Numpy, Jupyter, Scipy,pandas, scikits-image. You can check all available packages from the anaconda command prompt:
Type :   conda list

These packages will be of great help for plotting figures, mathematical and statistical processing, image processing and machine learning and so on and so forth.


Spyder is an interactive development environment for python. 



You can write your python scripts in the editor and click on the run icon. The result can be viewed on the ipython console.  The variable explorer contains the details /information about the variables initialized and available.


The size of the image is 100 x 200 i.e 100 columns and 200 rows. The image is RGB. i.e it contains Red, Green and Blue component. The positioning starts from 0.
At [0,0] the Red component has the value 254 , Green and Blue component are zero
At [99,0] the Red component is zero , Green component is 255 and the Blue component is zero
At [0,199], all the components are zero
At [99,199], Blue component is 255 , Red and Green components are zero 

Python Script:

import matplotlib.pyplot as plt

img = plt.imread('color.jpg')
plt.imshow(img);
plt.show();
print('Size of the Image:',img.shape);
print('At [0,0] the RGB components are:',img[0,0,:]);
print('At [99,0] the RGB components are:',img[99,0,:]);
print('At [0,199] the RGB components are:',img[0,199,:]);
print('At [99,199] the RGB components are:',img[99,199,:]);

Explanation:

Matplotlib functions are similar to the MATLAB syntax which will be quiet easy for people who are already familiar with MATLAB.
img.shape gives the size of the image. Ie. 100 x 200 x 3

img[0,0,:] indicates the (0,0) position in the image and ‘:’ fetches all the three components from that particular position.

NOTE:
Syntax to clear the console: clear
Syntax to clear the variables: reset





like button Like "IMAGE PROCESSING" page

3 comments:

Upender said... Reply to comment

Thanks for this informative post to help people who wants become masters in python training in hyderabad

Unknown said... Reply to comment

Nice blog this information is unique information i haven't seen ever by seeing this blog i came know lots of new things.
python training in Hyderabad the best career

Unknown said... Reply to comment

Great

Enjoyed Reading? Share Your Views

Previous Post Next Post Home
Google ping Hypersmash.com