30
Numbers in Images GCNU 1025 Numbers Save the Day

Numbers in Images GCNU 1025 Numbers Save the Day

Embed Size (px)

Citation preview

Page 1: Numbers in Images GCNU 1025 Numbers Save the Day

Numbers in Images

GCNU 1025Numbers Save the Day

Page 2: Numbers in Images GCNU 1025 Numbers Save the Day

Announcement

• In-class Assignment #3 on Nov 21 (Friday)• Coverage: Chapter 3 “Numbers on the Internet”• 10% of final score• Books, notes, other materials and discussions all allowed• Help from instructor and teaching assistant• Assignments submitted after class subject to penalty

Page 3: Numbers in Images GCNU 1025 Numbers Save the Day

Image storage in computers

• Pixel: small coloured point (smallest component of image)• Colour represented by number: one digital value for each pixel

• How many different possible colours are there?• How many bits are used to represent each colour?

Page 4: Numbers in Images GCNU 1025 Numbers Save the Day

Image storage in computers

• Pixel: small coloured point (smallest component of image)• Colour represented by number: one digital value for each pixel

• How many different possible colours are there?• Colour palette: a list of available colours

• How many bits are used to represent each colour?• Example: RGB models

• Encoding colour by mixing red (R), green (G) and blue (B)

Page 5: Numbers in Images GCNU 1025 Numbers Save the Day

Image storage in computers

• Pixel: small coloured point (smallest component of image)• Colour represented by number: one digital value for each pixel

• How many bits are used to represent each colour?• Example: RGB model (colour-depth: 8-bit)

• Red/Green (3 bits each): from 0 to 7• 0: least intense• 7: most intense

• Blue (2 bits): from 0 to 3• 0: least intense• 3: most intense

• Total: 256 colours

Page 6: Numbers in Images GCNU 1025 Numbers Save the Day

Image storage in computers

• Pixel: small coloured point (smallest component of image)• Colour represented by number: one digital value for each pixel

• How many bits are used to represent each colour?• Example: RGB model (colour-depth: 24-bit)

• Red/Green/Blue (8 bits each): from 0 to 255• 0: least intense• 255: most intense

• Total: more than 10M colours

Page 7: Numbers in Images GCNU 1025 Numbers Save the Day

Image storage in computers

• Pixel: small coloured point (smallest component of image)• Colour represented by number: one digital value for each pixel

• How many bits are used to represent each colour?• Example: RGB model (colour-depth: 24-bit)

• Red/Green/Blue (8 bits each): from 0 to 255• 0: least intense• 255: most intense

• Total: more than 10M colours

Page 8: Numbers in Images GCNU 1025 Numbers Save the Day

Image storage in computers

• Pixel: small coloured point (smallest component of image)• Colour represented by number: one digital value for each pixel

• How many bits are used to represent each colour?• Example: RGB model (colour-depth: 24-bit)

• Red/Green/Blue (8 bits each): from 0 to 255• 0: least intense• 255: most intense

• Total: more than 10M colours

Page 9: Numbers in Images GCNU 1025 Numbers Save the Day

Resolution and file size

• Resolution: number of pixels in image• Expressed as dimension ()

• Example:

• Display resolution: number of pixels on the screen• Expression as dimension ()

• Example:

Page 10: Numbers in Images GCNU 1025 Numbers Save the Day

Resolution and file size

• Resolution: number of pixels in image• Expressed as dimension ()

• Example: • Higher resolution:

• More details can be shown• Larger file size (given same colour-depth)

Page 11: Numbers in Images GCNU 1025 Numbers Save the Day

Image file format

• File format: method of storage• Image compression: lossless/lossy

Page 12: Numbers in Images GCNU 1025 Numbers Save the Day

Image file format

• File format: method of storage• Image compression: lossless/lossy

Page 13: Numbers in Images GCNU 1025 Numbers Save the Day

Image processing

• Image formed by a rectangle of pixels• Matrix: table with rows and columns of numbers• Image represented by matrix • Example: matrix representing an image

• Resolution of image: • Size of matrix:

Page 14: Numbers in Images GCNU 1025 Numbers Save the Day

Image processing

• Manipulation of image (image processing): operation on matrix representing the image• 3-bit grey scale examples (0-7) used in this course

• Major types of actions:• Reduction of image• Rotation of image• Cropping of image• Darkening/brightening of image• Inversion of image• Blurring of image• Enlargement of image• Morphing of images• Addition/removal of objects in image

Page 15: Numbers in Images GCNU 1025 Numbers Save the Day

Image processing

• Reduction of image by half

Page 16: Numbers in Images GCNU 1025 Numbers Save the Day

Image processing

• Reduction of image by half• Average taken for each partition• Example: (resolution) reduced to (resolution)

Page 17: Numbers in Images GCNU 1025 Numbers Save the Day

Image processing

• Reduction of image by half• Average taken for each partition• Example: (resolution) reduced to (resolution)

Page 18: Numbers in Images GCNU 1025 Numbers Save the Day

Image processing

• Rotation by 90 degrees• Simple rotation of matrix

Page 19: Numbers in Images GCNU 1025 Numbers Save the Day

Image processing

• Cropping of image• Deletion of corresponding part of matrix

Page 20: Numbers in Images GCNU 1025 Numbers Save the Day

Image processing

• Darkening of image• Multiplication by weight factor (smaller than 1)

Page 21: Numbers in Images GCNU 1025 Numbers Save the Day

Image processing

• Darkening of image• Multiplication by weight factor (smaller than 1)• Example: darkening by a factor of 0.8

• Rounding off needed

Page 22: Numbers in Images GCNU 1025 Numbers Save the Day

Image processing

• Brightening of image• Multiplication by weight factor (bigger than 1) wouldn't work as some

entries might exceed 7• Alternative method: assign new value to an entry for some factor smaller

than 1• Example: Brightening with a factor of 0.8

• Replacement of each entry by • Rounding off needed• Smaller factor used instead of 0.8 for brighter image

Page 23: Numbers in Images GCNU 1025 Numbers Save the Day

Image processing

• Inversion of image• Replacement of each entry by 𝑥

Page 24: Numbers in Images GCNU 1025 Numbers Save the Day

Image processing

• Blurring of image• Averaging neighbourhood of each entry

Page 25: Numbers in Images GCNU 1025 Numbers Save the Day

Image processing

• Enlargement of image• Step 1: determine size of new matrix • Step 2: duplicate existing entries• Step 3: blurring • Example: doubling linear size

• Step 1: (matrix size) enlarged to (matrix size)• Step 2: duplication

Page 26: Numbers in Images GCNU 1025 Numbers Save the Day

Image processing

• Enlargement of image• Step 1: determine size of new matrix • Step 2: duplicate existing entries• Step 3: blurring • Example: doubling linear size

• Step 3: blurring

Page 27: Numbers in Images GCNU 1025 Numbers Save the Day

Image processing

• Morphing of images• Matching the corresponding entries of the matrices and adjusting the

weighting• Example: morphing of lion and tiger

• Matching eyes of lion with eyes of tiger• Adjustment of weighting

Page 28: Numbers in Images GCNU 1025 Numbers Save the Day

Image processing

• Addition of objects• Application of “if…then” statements to add background• Example: replacing white background

Page 29: Numbers in Images GCNU 1025 Numbers Save the Day

Image processing

• Removal of objects• Series of photos needed to provide background information• Median averaging: elimination of abnormal pixels by taking median value

of corresponding pixels in the images

Page 30: Numbers in Images GCNU 1025 Numbers Save the Day

Numbers in Images

-End-