Image Processing — Basics for Beginners (Code + Concept ) : Part 1
The majority of articles focus on concepts of image processing. In addition here we do small exercises to demonstrate the concepts. I am using Jupyter Notebook to write codes.
I will start out by briefly:
- Introducing OpenCV
- Introducing Python
- Introducing Jupyter Notebook
- How to setup Jupyter Notebook
- Exercises with answers
Okay! Let’s take a quick look at the basic concepts before starting the practices
Introduction to OpenCV
OpenCV — Open Source Computer Vision Library.
It is an open-source computer vision and machine learning software library. The library has more than 2500 optimized algorithms. These algorithms use to detect and recognize faces, identify objects, classify human actions in videos, track camera movements, track moving objects, extract 3D models of objects, etc.
Introduction to Python
Python is an open-source programming language. It allows you to run applications and plugins from a wide variety of 3rd party sources (or even applications you develop yourself) on your server. It is cross-platform, and you can run it on a number of different operating systems, including Windows VPS Server.
Introduction to Jupyter Notebook
The Jupyter Notebook is an open-source web application. It allows you to create and share documents that contain live code, equations, visualizations and narrative text. Use to data cleaning and transformation, numerical simulation, statistical modelling, data visualization, machine learning, etc.
How to setup Jupyter Notebook
Step 1: Installing Python in Windows
Step 2: Confirm that Python is installed
The simplest way to test for a Python installation on your Windows server is to open a command prompt and type python and press Enter. If Python is installed correctly, you can see an output similar to what is shown below.
Step 3: Installing Pip in Windows
Once you have confirmed that Python is installed correctly, we can proceed with installing Pip.
- Download get-pip.py to a folder on your computer.
- Open a command prompt and navigate to the folder containing the get-pip.py installer.
- Run the following command: python get-pip.py
Step 4: Verify Installation and Check the Pip Version
We can now verify that Pip was installed correctly by opening a command prompt and entering the following command. pip -V
Step 5: Installing OpenCV library using pip command
After the installation of the Python and pip, we can directly install the OpenCV library and start using them. To install the library, we need to enter the given command in the terminal.
pip install opencv-python
Step 6: Installing matplotlib library using pip command
Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python. To install the matplotlib, we need to enter the given command in the terminal.
pip install matplotlib
Step 7: Installing Jupyter notebook using pip command
To install the Jupyter notebook using Python’s package manager, pip, we need to enter the given command in the terminal.
python -m pip install jupyter
Step 8: Run Jupyter notebook on Windows
To run the notebook, run the following command in the terminal.
python -m notebook
In this article, you will write small programs about :
- Read images from/in the storage device.
- Convert colour image to grayscale
- Convert Color Image to Unchanged
- Save the image to another location
- Access pixel values of an image
- Get Gray Scale Image single value
- Access pixel values of the image and modify them — Color image
- Access Pixel & Modify Grayscale image
- Access image properties.
- Indicates SIZE and DATA-TYPE of the image
- Covert colour from grayscale to binary (Black & white) — Thresholding
Okay, enough of the talk, let’s get to work!
1. Read images from/in the storage device.
2. Convert colour image to grayscale
Option 1 :
Option 2 :
3. Convert Color Image to Unchanged
4. Save the image to another location
Output : Image successfully saved? True
5. Access pixel values of an image
6. Get Gray Scale Image single value
7. Access pixel values of the image and modify them — Color image
8. Access Pixel & Modify Gray scale image
9. Access image properties
Shape indicates the size (255x255, 3 colour channel)
10. Indicates SIZE and DATA-TYPE of the image
11. Covert colour from grayscale to binary (Black & white) — Thresholding
Here I’ve attached image files for your convenience
This article is part of a series I’m practising image processing fundamentals. Be sure to follow me if you’d like to keep track!
Next article about: How to convert images from one colour-space to another.
Happy Coding !🤓
See you guys in the next article! ❤️ ✌