0% found this document useful (0 votes)
16 views50 pages

23 24chapter 1 Image Representation

Uploaded by

raisulrifat25
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views50 pages

23 24chapter 1 Image Representation

Uploaded by

raisulrifat25
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 50

Image Representation

Course Code: CSC 3224 Course Title: Computer Graphics

Dept. of Computer Science


Faculty of Science and Technology

Lecturer No: 03 Week No: 2 Semester:


Lecturer:
Outline

1. Pixel
2. Graphics Image
3. Color Model (RGB, CMY)
4. Direct Coding
5. Lookup Table
6. Display Monitor
7. Printing
8. Image Files
9. Dithering
10. Error Diffusion
11. Image Files
12. Books
13. References
Pixel

• A pixel is one of the many tiny dots that make up the


representation of a picture in a computer's memory.
• Pixels in an image can be reproduced at any size without the
appearance of visible dots or squares
• The intensity of each pixel is variable; in color systems, each
pixel has typically three or four dimensions of variability such
as red, green and blue, or cyan, magenta, yellow and black
Pixel
Computer Graphics Image

 Computer graphics can be created as either raster or vector


images

Raster Image
Vector Image
Raster Image

 Raster graphics are bitmaps.

• A bitmap is a grid of individual pixels that collectively compose


an image.
• Raster graphics render images as a collection of countless tiny
squares.
• Each square, or pixel, is coded in a specific shade. Individually,
these pixels are worthless
• Together, they’re worth a thousand words
Raster Image

 Using of Raster Image

Raster graphics are best used for non-line art images; specifically
digitized photographs, scanned artwork or detailed graphics

Non-line art images are best represented in raster form because


these typically include subtle chromatic gradations, undefined lines
and shapes, and complex composition
Drawbacks of Raster Image

• Resolution in raster graphics is measured in dpi, or dots per inch.


The higher the dpi, the better the resolution

• Raster files are significantly larger than comparable vector files,


high resolution raster files are significantly larger than low
resolution raster file

• Overall, as compared to vector graphics, raster graphics are less


economical, slower to display and print, less versatile and more
unwieldy to work with
Example of Raster Image

 Common raster formats include TIFF, JPEG, GIF, PCX and


BMP files
Vector Image

 Unlike pixel-based raster images, vector graphics are


based on mathematical formulas that define geometric
primitives such as polygons, lines, curves, circles and
rectangles
Use of Vector Image

 Because vector graphics are composed of true geometric


primitives, they are best used to represent more
structured images, like line art graphics with flat, uniform
colors.
 Most created images meet these specifications, including
logos, letterhead, and fonts.
Advantages of Vector Image

 vector-based graphics are more malleable than raster


images
 they are much more versatile, flexible and easy to use
 The most obvious advantage of vector images over
raster graphics is that vector images are quickly and
perfectly scalable
 There is no upper or lower limit for sizing vector images
Advantages of Vector Image

 unlike raster graphics, vector images are not resolution-


dependent
 Vector images have no fixed intrinsic resolution, rather
they display at the resolution capability of whatever
output device (monitor, printer) is rendering them
 because vector graphics need not memorize the contents
of millions of tiny pixels, these files tend to be considerably
smaller than their raster counterparts.
Vector Images

 Overall, vector graphics are more efficient and versatile.


 Common vector formats include AI, EPS, CGM, WMF and
PICT (Mac).
Color Model

 A color model is a system for creating a full range of colors


from a small set of primary colors.

 There are two types of colour models: additive and


subtractive.
Additive and Subtractive
Model

 Additive color models use light to display color

while subtractive color models use printing inks.

 Colors perceived in additive models are the result of


transmitted light.

Colors perceived in subtractive models are the result of


reflected light.
RGB and CMYK
RGB
 RGB uses additive color mixing, because it describes what kind
of light needs to be emitted to produce a given color.

 Light is added together to create form from out of the darkness.

 RGB stores individual values for red, green and blue.

 (r,g,b)=>(0,0,0) black, (1,1,1) white [ranges 0 to 1]


RGB
RGB Value

 A color's RGB value indicates its red, green, and blue intensity.

 Each intensity value is on a scale of 0 to 255


RGB Color Palette

3-bit RGB
Systems with a 3-bit RGB palette use 1 bit for each of the red,
green and blue color components. That is, each component is
either "on" or "off" with no intermediate states. This results in an
8-color ((21)3 = 23 = 8) palette

6-bit RGB
Systems with a 6-bit RGB palette use 2 bits for each of the red,
green, and blue color components. This results in a (22)3 = 43 = 64-
color palette
Color Palette

In computer graphics, a color palette is a finite set of colors.


Palettes can be optimized to improve image accuracy in the
presence of software or hardware constraints.
CMYK
CMYK
CMY

 CMY uses subtractive color mixing used in the printing process, because it
describes what kind of inks need to be applied so the light reflected from the
substrate and through the inks produces a given color.

 One starts with a white substrate (canvas, page, etc.), and uses ink to
subtract color from white to create an image.

 CMYk stores ink values for cyan, magenta, yellow, Key(Black).

 cmyk(c%, m%, y%)=>(0%,0%,0%) white. [ranges from 0 to 100%]


RGB to CMY

 C = 1 –( color.R / 255.0);

 M = 1 – (color.G / 255.0);

 Y = 1 – (color.B / 255.0);
RGB to CMY

 R = (1 - C) * 255.0,

 G = (1 - M) * 255.0,

 B = (1 - Y) * 255.0
RGB -> CMY -> RGB

More info

http://colormine.org/convert/rgb-to-cmy

Sample Code:

https://github.com/THEjoezack/ColorMine/blob/
master/ColorMine/ColorSpaces/Conversions/
CmyConverter.cs
Direct Coding

• Basically images are the collections of several pixels


with colors. In computer graphics, direct coding is an
algorithm that provides some amount of storage
space for each pixel so that the pixel is coded with a
color.
Direct Coding

 Storage space for each pixel to code the color


 Use 3 bytes per pixel (1 for R, 1 for G and 1 for B)
[Industry standard]
 256 different intensity level for each color
Direct Coding

More info of direct coding:

https://www.chegg.com/homework-help/definitions/
direct-coding-3
Lookup Table

In computer graphics, lookup tables are used to


store the starting addresses of each line and the
values corresponding to the placement of pixels
within a byte.
Steps to plot a point using lookup table

1. Locate the starting address corresponding to the line


on which the point is to appear.

2. Locate the address of the byte in which the point will


be represented.
Lookup Table

 Pixel values do not code colors directly


 Refer to a table of color values
 A table with 256 colors with RGB values
Display Monitor (CRT)
Printing

 Halftone

 Go through chapter 2 (schaum’s outline) for details.


Halftone

Halftone is the technique that simulates continuous


tone imagery through the use of dots.
Dots can be varied either
• in size
• in shape or
• in spacing
Halftone generates a gradient like effect.
Halftone Image

 A halftone, or halftone image, is an image comprised


of discrete dots rather than continuous tones. When
viewed from a distance, the dots blur together,
creating the illusion of continuous lines and shapes.

 By halftoning an image (converting it from a bitmap to

a halftone), it can be printed using less resources


How Halftone work

Halftone process, in printing, a technique


of breaking up an image into a series of
dots so as to reproduce the full tone range
of a photograph or tone art work.
Example
Contd.
Contd.
Dithering
 A technique called dithering can be used to approximate halftones without
reducing spatial resolution.
 The dither matrix is treated very much like a floor tile that can be repeatedly
positioned one copy next to another to cover the entire floor, i.e., the image.
 A pixel at (x,y) is intensified if the intensity level of the image at that position is
greater than the corresponding value in the dither matrix. Mathematically, if
Dn stands for an n x n dither matrix, the element Dn(i,j) that corresponds to
pixel position (x,y) can be found by i = x mod n and y = y mod n.
 for image areas that have constant intensity, the results of dithering are
exactly the same as the results of halftone approximation. Reproduction
differences between these two methods occur only when intensity varies.
Dithering
Error Diffusion

 Another technique for continuous-tone reproduction without


sacrificing spatial resolution is called the Floyd-Steinberg error
diffusion.
 Here a pixel is printed using the closest intensity the device can
deliver. The error term, i.e., the difference between the exact
pixel value and the approximated value in the reproduction, is
then propagated to several yet-to-be-processed neighboring
pixels for compensation.
Error Diffusion

 let S be the source image that is processed in a left-to-right and


top-to-bottom pixel order, S(x,y) be the pixel value at location
{x,y), and e be S(x,y) minus the approximated value. We update
the value of the pixel's four neighbors (one to its right and three
in the next scan line) as follows:
Error Diffusion
 Where parameters a through d often take values 7/16, 3/16, 5/16, and 1/16 respectively. These
modifications are for the purpose of using the neighboring pixels to offset the reproduction error at
the current pixel location. They are not permanent changes made to the original image.
 Consider, for example, the reproduction of a gray scale image (0: black, 255: white) on a bilevel
device (level 0: black, level 1: white), if a pixel whose current value is 96 has just been mapped to
level 0, we have e = 96 for this pixel location. The value of the pixel to its right is now increased by
96 x (7/16) = 42 in order to determine the appropriate reproduction level.
 This increment tends to cause such neighboring pixel to be reproduced at a higher intensity level,
partially compensating the discrepancy brought on by mapping value 96 to level 0 (which is lower
than the actual pixel value) at the current location. The other three neighboring pixels (one below
and to the left, one immediately below, and one below and to the right) receive 18, 30, and 6 as
their share of the reproduction error at the current location, respectively. Results produced by this
error diffusion algorithm are generally satisfactory, with occasional introduction of slight echoing of
certain image parts. Improved performance can sometimes be obtained by alternating scanning
direction between left-to-right and right-to-left (minor modifications need to be made to the above
formulas)
Image Files
 A digital image is often encoded in the form of a
binary file for the purpose of storage and
transmission. Among the numerous encoding
formats are BMP (Windows Bitmap), JPEG (Joint
Photographic Experts Group File Interchange
Format), and TIFF (Tagged Image File Format).
Although these formats differ in technical details,
they share structural similarities.

 The file consists largely of two parts: header


and image data. In the beginning of the file
header a binary code or ASCII string identifies
the format being used, possibly along with the
version number. The width and height of the
image are given in numbers of pixels. Common
image types include black and white (1 bit per
pixel), 8-bit gray scale (256 levels along the
gray axis), 8-bit color (lookup table), and 24-bit
color. Image data format specifies the order in
which pixel values are stored in the image data
section.
Books

• Foley, van Dam, Feiner, Hughes, Computer Graphics:


principles and practice, Addison Wesley, Second Edition.

• Schaum's Outline of Theory & Problems of Computer


Graphics.

• Peter Shirley Steve Marschner , “Fundamental of


computer graphics”, Third Edition.
References

• http://colormine.org/convert/rgb-to-cmy
• www.howstuffworks.com
• www.wikipedia.com
• http://www.picturetopeople.org/image_effects/photo-halftone/examples/photo-to
-halftone-convertion-2.gif
• http://mocoloco.com/fresh2/upload/2011/12/halftone_calendar_by_casey_klebba
/halftone_calendar_casey_klebba_3b-thumb-468x468-35319.jpg
• https://www.chegg.com
• https://www.slideshare.net/mustafasalam167/color-model-29181025
• https://www.printcnx.com/resources-and-support/addiational-resources/raster-ima
ges-vs-vector-graphics/
• https://slideplayer.com/slide/5143930/

You might also like