Вы находитесь на странице: 1из 27

INTRODUCTION TO IMAGE

FUNDAMENTALS

Under the Guidance of Presented by


Dr. V. Vijaya Kumar 1. Ms. B. Ujwala
Dean of CSE & IT Asst. Professor, AGI
AGI 2. Mr. K. Raghavendra Rao
Asst. Professor, AGI
Contents
1. What is a digital image?
2. Image Representation
3. Types of Digital Images
4. Sample program to display an Image
5. Image Formats
WHAT IS A DIGITAL IMAGE?
 An image is a two-dimensional function f(x,y), where x
and y are the spatial coordinates and the value of f at
any point x, y is proportionate to “brightness” ( or gray
levels) of the image
 A digital image is a numeric representation of a two-
dimensional image
 Digital images are made of picture elements called pixels

 Pixels are organized in a matrix M x N

 The size of an image is determined by the dimensions of


this matrix
 Image width is the number of columns in the matrix

 Image height is the number of rows in the matrix


WHAT IS A DIGITAL IMAGE? CONT…
 Each pixel has its own intensity value, or brightness.
 If all pixels have same value, image will have uniform
shade. 
 To refer to a specific pixel within the matrix , use
coordinates x, y
 Pixel is a color point of digital image.
IMAGE AS A MATRIX
A M×N digital image is often represented as a matrix as
Consider the following image (2724x2336 pixels) to be 2D function
or a matrix with rows and columns

Pixel intensity
value
f(1,1) =
103

Pixel
location

In 8-bit representation
Pixel intensity values
rows column change between 0
s (Black) and 255 (White)
f(645:650,1323:132
8) =
83 82 82 82 82 82
82 82 82 81 81 81
82 82 81 81 80 80
82 82 81 80 80 79
80 79 78 77 77 77
80 79 78 78 77 77

f(2724,2336)
= 88
QUALITY OF AN IMAGE
Basically, an image is of good quality if
 It is not noisy
 It is not blurred.
 It has high resolution.
 It has good contrast.
SAMPLE IMAGES
TYPES OF DIGITAL IMAGES
The images types we will consider are:
1) Gray-scale

2) Color(RGB)

3) Binary
Gray Image Color Image

Binary Image
GRAY-SCALE IMAGES
 Grayscale images are monochrome(one-color)
images, means they have only one color. Grayscale
images do not contain any information about color.
 The number of bits used for pixel determines the
number of different grey levels available.
 A typical grayscale image contains 8 bits/pixel data,
which has 256 different grey levels.
Gray-scale images Cont..

Gray scale values


10 10 16 28
 9 6 26 37
 
15 25 13 22
 
32 15 87 39
12
COLOR(RGB) IMAGES
 Color images are three band monochrome images
in which, each band contains a different color. The
actual information stored in the digital image data
is gray level information in each spectral band
 The images are represented as Red, Green and
Blue (RGB images). And each color image has 24
bits/pixel means 8 bits for each of the three color
band(RGB)
Color(RGB) images Cont..
Color image or RGB image:
each pixel contains a vector
representing red, green and
blue components.

RGB components
10 10 16 28
 9 656 70 26
56  43
3756  78
 32 99 54 96  67 
70
15 256013902296   67
  21  54 47  42 14
32 15 87 39
  85 85 43  92
54  65 65 39 
32 65 87 99
BINARY IMAGES
 It is the simplest type of image. It takes only two
values i.e, Black and White or 0 and 1. The binary
image consists of a 1-bit image and it takes only 1
binary digit to represent a pixel.
 Binary images are mostly used for general shape or
outline.
 Binary images are generated using threshold operation.
When a pixel is above the threshold value, then it is
turned white('1') and which are below the threshold
value then they are turned black('0')
Binary Images Cont…

Binary image or black and white image


Each pixel contains one bit :
1 represent white
0 represents black

Binary data
0 0 0 0
0 0 0 0
 
1 1 1 1
16
 
1 1 1 1
IMAGE DISPLAY USING OPENCV-
PYTHON
Example:

import cv2
import numpy

img1=cv2.imread('image.jpg')

cv2.imshow('Image1',img1)

cv2.waitKey(0)
cv2.destroyAllWindows()
OpenCV-Python is a library of Python bindings designed to solve computer vision
problems.

Methods:

 cv2.imread(path, flag) --loads an image from the specified path. If the image cannot
be read then this method returns an empty matrix.
path: A string representing the path of the image to be read.
flag: It specifies the way in which image should be read.

cv2.IMREAD_COLOR: It specifies to load a color image. Any transparency of


image will be neglected. It is the default flag. Alternatively, we can pass integer
value 1 for this flag.

cv2.IMREAD_GRAYSCALE: It specifies to load an image in grayscale mode.


Alternatively, we can pass integer value 0 for this flag.

cv2.IMREAD_UNCHANGED: It specifies to load an image as such including alpha


channel. Alternatively, we can pass integer value -1 for this flag.
cv2.imshow() method is used to display an image in a
window. The window automatically fits to the image
size.
cv2.imshow(window_name, image)
Parameters:
window_name: A string representing the name of the
window in which image to be displayed.
image: It is the image that is to be displayed.
cv2.waitKey([delay])
The function waitKey() waits for a key event infinitely
(when ) or for delay milliseconds, when it is positive.
Parameters:
delay – Delay in milliseconds. 0 is the special value
that means “forever”.

cv2.destroyAllWindows() is used to close the window


and de-allocate any associated memory usage.
IMAGE FORMATS
 Image Format describes how data related to the image is
stored.
 Data can be stored in compressed, Uncompressed or vector
format.
 Each format of the image have a different advantage and
disadvantage.
IMAGE FORMATS CONT…
1. TIFF(.tif, .tiff)
2. JPEG (.jpg, .jpeg)
3. GIF (.gif)
4. PNG (.png)
5. Bitmap (.bmp)
6. EPS (.eps)
7. RAW Image Files (.raw, .cr2, .nef, .orf, .sr2)
IMAGE FORMATS CONT…
1. TIFF(.tif, .tiff)-Tagged Image File Format , this format
store image data without compression.
 High-quality image but size of image is large
 Good for professional printing.
2. JPEG (.jpg, .jpeg) - Joint Photographic Experts Group,
this format store image data with compression. Due to
compression, some data is lost but that loss is very less.
 It is a very common format
 Good for digital cameras, nonprofessional prints,
E-Mail, Power point etc., making it ideal for web
use
IMAGE FORMATS CONT…
3. GIF (.gif) - GIF or Graphics Interchange Format files are used
for web graphics. They can be animated and are limited to only
256 colors.
 GIF files are typically small in size and are portable.

4. PNG (.png)-PNG or Portable Network Graphics files are a


lossless image format. It was designed to replace gif format.
 PNG which support 16 million colors.

5. Bitmap (.bmp) - Bit Map Image file is developed by Microsoft


for windows. It is same as TIFF due lossless, no compression
property. Due to BMP being a proprietary format, it is generally
recommended to use TIFF files.
IMAGE FORMATS CONT…
6. EPS(.eps)-Encapsulated PostScript file is a common
vector file type. EPS files can be opened in applications
such as Adobe Illustrator or CorelDRAW.

7. RAW Image Files (.raw, .cr2, .nef, .orf, .sr2)


These Files are created by a camera or scanner. Many
digital SLR cameras can shoot in RAW, whether it be a
.raw, .cr2, or .nef. Thes images are the equivalent of a
digital negative, meaning that they hold a lot of image
information. These images need to be processed in an
editor such as Adobe Photoshop or Light room. It saves
metadata and is used for photography.
THANK YOU

Вам также может понравиться