Assignment 1 (DIP) - Dipayan Rana
Assignment 1 (DIP) - Dipayan Rana
Assignment 1 (DIP) - Dipayan Rana
A matrix is a two-dimensional array of numbers arranged in rows and columns. In the context
of image processing, a matrix is used to represent an image by assigning each element of the
matrix to a pixel value of the image. Each pixel's value can represent different information
depending on the type of image:
Grayscale Image: Each element in the matrix represents a single intensity value (0-
255), where 0 is black and 255 is white.
Color Image: Represented using three matrices (one for each color channel: Red,
Green, Blue). Each pixel is represented by a triplet of values, one for each color
channel.
[
[255, 0, 0],
[0, 255, 0],
[0, 0, 255]
]
And a 3x3 RGB color image can be represented as:
[
[[255, 0, 0], [0, 255, 0], [0, 0, 255]],
[[255, 255, 0], [255, 0, 255], [0, 255, 255]],
[[255, 255, 255], [128, 128, 128], [0, 0, 0]]
]
2. Write a simple Python script to read an image from a file and display it
using a library like OpenCV or matplotlib.
Here is a simple Python script using OpenCV and matplotlib to read and display an image:
import cv2
import matplotlib.pyplot as plt
A pixel (short for "picture element") is the smallest unit of a digital image or graphic that can
be displayed and represented on a digital display device. Pixels are the building blocks of any
digital image. Each pixel in a digital image represents a single point of color or intensity.
In a grayscale image, each pixel has a single value representing the intensity (brightness) of
the pixel. In a color image, each pixel typically consists of three values representing the
intensity of the red, green, and blue components.
The resolution of a digital image is determined by the number of pixels it contains, defined
by its width and height in pixels (e.g., 1920x1080).
4. Describe a problem you solved using programming. What approach did you
take?
One problem I solved using programming was automating the process of extracting text from
a large number of scanned documents. The approach I took involved the following steps:
This approach streamlined the document digitization process, saving significant time and
effort compared to manual text extraction.
5. Have you used any image processing software such as Adobe Photoshop,
GIMP, or similar tools?
Yes, I have used Adobe Photoshop and GIMP for various image processing tasks, such as
editing photos, creating graphics, and performing basic image manipulations like cropping,
resizing, and colour correction. These tools are powerful for manual image processing and
graphic design tasks.
6. Are you familiar with any programming libraries for image processing,
such as OpenCV, PIL, or scikit-image?
Yes, I am familiar with several programming libraries for image processing, including:
OpenCV: A powerful library for computer vision and image processing. It provides a
wide range of functions for image manipulation, feature detection, object recognition,
and more.
PIL/Pillow: The Python Imaging Library (PIL) and its fork Pillow are used for
opening, manipulating, and saving many different image file formats.
scikit-image: A collection of algorithms for image processing, built on top of SciPy
and NumPy. It is designed for scientific and educational purposes.
These libraries are widely used in various applications, from simple image manipulation to
complex computer vision tasks.