Image Representation and Processing

Similar documents
You Know More Than You Think ;) 3/6/18 Matni, CS8, Wi18 1

Digital Images. Digital Images. Digital Images fall into two main categories

Color is the factory default setting. The printer driver is capable of overriding this setting. Adjust the color output on the printed page.

18 1 Printing Techniques. 1.1 Basic Printing Techniques

What is an image? Images and Displays. Representative display technologies. An image is:

PENGENALAN TEKNIK TELEKOMUNIKASI CLO

Adobe Photoshop PS2, Part 3

4/9/2015. Simple Graphics and Image Processing. Simple Graphics. Overview of Turtle Graphics (continued) Overview of Turtle Graphics

Photoshop Domain 2: Identifying Design Elements When Preparing Images

Dr. Shahanawaj Ahamad. Dr. S.Ahamad, SWE-423, Unit-06

Printing Technology. Lecture 14 October 8, 2015 Imaging in the Electronic Age Donald P. Greenberg

Sistemas de Representação Digital em Design

Logo guidelines National Physician Suicide Awareness Day

Image Perception & 2D Images

WORKING WITH COLOR Monitor Placement Place the monitor at roughly right angles to a window. Place the monitor at least several feet from any window

Digital Images. CCST9015 Oct 13, 2010 Hayden Kwok-Hay So

This Color Quality guide helps users understand how operations available on the printer can be used to adjust and customize color output.

Creating Digital Artwork

Digital Imaging & Photoshop

Chapter 2 Fundamentals of Digital Imaging

Digital Images. Back to top-level. Digital Images. Back to top-level Representing Images. Dr. Hayden Kwok-Hay So ENGG st semester, 2010

Chapter 11. Preparing a Document for Prepress and Printing Delmar, Cengage Learning

Basics of Colors in Graphics Denbigh Starkey

Computer Graphics: Graphics Output Primitives Primitives Attributes

PHOTOSHOP. pixel based image editing software (pixel=picture element) several small dots or pixels make up an image.

4/23/12. Improving Your Digital Photographs + ABOUT ME. + CHANGES in PHOTOGRAPHY. CAMERA and DARKROOM Pro? Cons? DIGITAL PHOTOS Pro? Con?

Corporate Identity Quick Reference Guide

Digital Files File Format Storage Color Temperature

Raster (Bitmap) Graphic File Formats & Standards

SAQA. How to Submit an Online Entry. Art by Mary Kay Fosnacht

RGB COLORS. Connecting with Computer Science cs.ubc.ca/~hoos/cpsc101

Table of Contents. Importing ICC Profiles...2. Exporting ICC Profiles...2. Creating an ICC Profile...2. Understanding Ink limits...

A Handy Guide to Image Resolutions in Print Design

Photoshop 01. Introduction to Computer Graphics UIC / AA/ AD / AD 205 / F05/ Sauter.../documents/photoshop_01.pdf

Colors in Images & Video

The relationship between Image Resolution and Print Size

Terms and Definitions. Scanning

Lecture 9: Digital Images

ITP 140 Mobile App Technologies. Colors Images Icons

Images and Displays. Lecture Steve Marschner 1

MATLAB Image Processing Toolbox

Chapter 4. Incorporating Color Techniques

Sampling Rate = Resolution Quantization Level = Color Depth = Bit Depth = Number of Colors

EFI Fiery Printer Profiler The impact of the black separation settings. Oliver Schorn, Senior Color Management & Research Engineer

6. Graphics MULTIMEDIA & GRAPHICS 10/12/2016 CHAPTER. Graphics covers wide range of pictorial representations. Uses for computer graphics include:

CS 547 Digital Imaging Lecture 2

Stamp Colors. Towards a Stamp-Oriented Color Guide: Objectifying Classification by Color. John M. Cibulskis, Ph.D. November 18-19, 2015

IMAGE SIZING AND RESOLUTION. MyGraphicsLab: Adobe Photoshop CS6 ACA Certification Preparation for Visual Communication

Modifying pictures with loops

DSP First Lab 06: Digital Images: A/D and D/A

Pixilation and Resolution name:

THE PARTNERSHIP FOR THE EAST ASIAN-AUSTRALIASIAN FLYWAY LOGO

Printers, Printing and Scanning October 2018

Lecture #2: Digital Images

Digital Imaging - Photoshop

Making a Printable Business Card Using Pixelmator

design guide for print

ENGG1015 Digital Images

Screening Basics Technology Report

Objective Explain design concepts used to create digital graphics.

Fundamentals of Multimedia

Printing Devices. Lecture 10. Older Printing Devices. Ink Jet Printer. Thermal-Bubble Ink Jet Printer. Plotter. Dot Matrix Printer

Ghent Workgroup PDF Specification

Digital Imaging and Image Editing

Image optimization guide

University Of Lübeck ISNM Presented by: Omar A. Hanoun

Digital Halftoning. Sasan Gooran. PhD Course May 2013

CS 445 HW#2 Solutions

LECTURE 07 COLORS IN IMAGES & VIDEO

Images and Displays. CS4620 Lecture 15

Digital Darkroom P 207

Adobe RGB (1998) vs. ProPhoto RGB

FUNDAMENTALS OF MULTIMEDIA

GT-782 Printer Driver ver

Outline: Getting the Best Scans

Q A bitmap file contains the binary on the left below. 1 is white and 0 is black. Colour in each of the squares. What is the letter that is reve

CS 200 Assignment 3 Pixel Graphics Due Tuesday September 27th 2016, 9:00 am. Readings and Resources

Section 7: Using the Epilog Print Driver

Preparing Images For Print

Factors Governing Print Quality in Color Prints

Technology and digital images

THE 3 BIGGEST MISTAKES TO AVOID WHEN USING GRAPHIC IMAGES IN PRINT

Digital Imaging Rochester Institute of Technology

4 Images and Graphics

Exercise NMCGJ: Image Processing

Coreldraw Crash Course

CD: (compact disc) A 4 3/4" disc used to store audio or visual images in digital form. This format is usually associated with audio information.

Alpha channels are basically saved selections. They do not affect how your image will be printed.

printing An designer s guide to newsprint printing

Introduction to Color Theory

Computers and Imaging

NoeCha DOT1. Highest Resolution UV-LED Inkjet Flatbed

printing A guide to newsprint printing

GUIDELINES & INFORMATION

LECTURE 02 IMAGE AND GRAPHICS

Digital Image Processing Lec.(3) 4 th class

Session 1. by Shahid Farid

Ranked Dither for Robust Color Printing

Quick Start Guide to Printing on the EPSON 9800

Image Optimization for Print and Web

Transcription:

Image Representation and Processing cs4: Computer Science Bootcamp Çetin Kaya Koç cetinkoc@ucsb.edu Çetin Kaya Koç http://koclab.org Summer 2018 1 / 22

Pixel A pixel, a picture element, is the smallest addressable element in an addressable display device It is smallest controllable piece of a picture represented on the screen The address of a pixel corresponds to its physical coordinates LCD pixels are manufactured in a two-dimensional grid, and are often represented using dots or squares Each pixel is a sample of an original image More samples provide more accurate representations of the original Çetin Kaya Koç http://koclab.org Summer 2018 2 / 22

Pixel In color image systems, a color is typically represented by three or four component intensities such as rgb (red, green, blue) or cmyb (cyan, magenta, yellow, black) Pixels can be used as a unit of measure such as: 2400 pixels per inch or 640 pixels per line The measures dots per inch (dpi) and pixels per inch (ppi) are sometimes used interchangeably dpi is a measure of a printer s density of dot (e.g., ink droplet) placement For example, a high-quality photographic image may be printed with 600 ppi on a 1200 dpi inkjet printer. Çetin Kaya Koç http://koclab.org Summer 2018 3 / 22

Image Size A typical representation of an image involves two parameter sets: Image size and the color intensities of each pixel Image size is the number of columns and rows in a rectangular image, such that each pixel is addressed by providing a column number and row number Çetin Kaya Koç http://koclab.org Summer 2018 4 / 22

RGB Colors On the other hand, each pixel will have 3 color intensities, according to the rgb (red, green, blue) model or 4 color intensities according to the cmyk (cyan, magenta, yellow, black) model The color intensity is an integer between 0 and a maximum number N 0 implies that color is nonexistent, while N implies it is the brightest The higher the value of N, the richer the color combinations For example N can be 255, so that each color intensity can be a number between 0 and 255, fitting into a single byte In the RGB model, we will have 3 bytes for each pixel, and therefore, 2 8 2 8 2 8 = 2 24 = 16, 777, 216 different colors Çetin Kaya Koç http://koclab.org Summer 2018 5 / 22

RGB Colors A pixel will have 3 color densities: red, green, blue, such that each value is an integer between 0 and 255, for example, (r, g, b) = (175, 89, 67) = (AF, 59, 3E) Pixels are also represented using 6-digit hex: AF593E In fact, this color has a name: Medium Brown (Crayola Brown) The basic colors, such as red, green, blue, brown, yellow, etc. are obtained by properly mixing the 3 colors: red, green, and blue An RGB color chart is found here: https://www.rapidtables.com/web/color/rgb_color.html Çetin Kaya Koç http://koclab.org Summer 2018 6 / 22

RGB Matrix Consider an image of size 500x300 (500 columns, 300 rows) A particular pixel is addressed as (201,101) such that 201 is the column number and 101 is the row number 0 201 499 0 101 299 Çetin Kaya Koç http://koclab.org Summer 2018 7 / 22

Image Matrix Therefore, we can consider an image as an n m matrix of integer entries such that each integer is 24 bits (between 0 and 16,777,215) Any operations we need to perform with or over this image will be using this matrix and its entries Some operations are as simple as displaying the image on a given display device (LCD, plasma, etc.) However, some other operations are significantly more challenging Çetin Kaya Koç http://koclab.org Summer 2018 8 / 22

Image Processing What operations can we do with an image? Color to grayscale conversion (to print on a printer) Changing its size (to fit into a window or a page) Edge detection (to detect movement over multiple images) Detect particular objects in image (recognition) Decide if two images are same or similar (similarity)... Çetin Kaya Koç http://koclab.org Summer 2018 9 / 22

Image Processing using Python Python has a module called cimage.py which has basic image processing functions Here is a list of basic cimage.py functions: import os os.chdir("/users/koc/desktop/abc") import cimage mywin = cimage.imagewin("leo",500,500) im = cimage.fileimage("leo.gif") im.draw(mywin) p = im.getpixel(100,100) r = p.getred() g = p.getgreen() b = p.getblue() q = cimage.pixel(175,89,67) im.setpixel(100,100,q) Çetin Kaya Koç http://koclab.org Summer 2018 10 / 22

Converting a Color Image to Grayscale Gray RGB color code has equal red, green and blue values: r = g = b We can read each pixel in the image, obtain the r, g, b values, take their average: avg = (r + g + b)/3 and write back this average value in place of r, g, b values Çetin Kaya Koç http://koclab.org Summer 2018 11 / 22

Converting a Color Image to Grayscale im = cimage.fileimage("image1.gif") n = im.getwidth() m = im.getheight() for i in range(n): for j in range(m): p = im.getpixel(i,j) r = p.getred() g = p.getgreen() b = p.getblue() avg = (r+g+b)//3 q = cimage.pixel(avg, avg, avg) im.setpixel(i,j,q) im.save("image2.gif") im.draw(mywin) Çetin Kaya Koç http://koclab.org Summer 2018 12 / 22

Halving an Image Consider an image of size n m Halving procedure will produce an image of size (n/2) (m/2) The division by 2 needs to be an integer division, e.g., 101/2 = 50, since the column and row sizes can only be integers In Python we accomplish integer division by newn = n//2 newm = m//2 Çetin Kaya Koç http://koclab.org Summer 2018 13 / 22

Halving an Image Assume that we have a small image of size 8 6 Thus we have 8 columns and 6 rows, all together 48 pixels The figure below depict the column and row indices (i, j) of pixels Furthermore, we also know that each pixel has 3 color intensities: red, green, blue values, each of which is between 0 and 255 (0,0) (1,0) (2,0) (3,0) (4,0) (5,0) (6,0) (7,0) (0,1) (1,1) (2,1) (3,1) (4,1) (5,1) (6,1) (7,1) (0,2) (1,2) (2,2) (3,2) (4,2) (5,2) (6,2) (7,2) (0,3) (1,3) (2,3) (3,3) (4,3) (5,3) (6,3) (7,3) (0,4) (1,4) (2,4) (3,4) (4,4) (5,4) (6,4) (7,4) (0,5) (1,5) (2,5) (3,5) (4,5) (5,5) (6,5) (7,5) Çetin Kaya Koç http://koclab.org Summer 2018 14 / 22

Halving an Image Halving an image may be accomplished by taking a neighborhood of 2 2 = 4 pixels, and throwing away 3 of them and keeping one (i, j) (i + 1, j) (i, j + 1) (i + 1, j + 1) For example, we can keep (i, j), the top-left pixel, throwing away the other three We need to do this by starting from the pixel with index (0, 0), and move to the right and to the bottom in the pixel matrix (0, 0) (1, 0) (0, 1) (1, 1) Keep (0,0) and throw away (1,0), (0,1), and (1,1) Çetin Kaya Koç http://koclab.org Summer 2018 15 / 22

Halving an Image (0,0) (1,0) (2,0) (3,0) (4,0) (5,0) (6,0) (7,0) (0,1) (1,1) (2,1) (3,1) (4,1) (5,1) (6,1) (7,1) (0,2) (1,2) (2,2) (3,2) (4,2) (5,2) (6,2) (7,2) (0,3) (1,3) (2,3) (3,3) (4,3) (5,3) (6,3) (7,3) (0,4) (1,4) (2,4) (3,4) (4,4) (5,4) (6,4) (7,4) (0,5) (1,5) (2,5) (3,5) (4,5) (5,5) (6,5) (7,5) (0,0) (2,0) (4,0) (6,0) (0,2) (2,2) (4,2) (6,2) (0,4) (2,4) (4,4) (6,4) (0,0) (1,0) (2,0) (3,0) (0,1) (1,1) (2,1) (3,1) (0,2) (1,2) (2,2) (3,2) Çetin Kaya Koç http://koclab.org Summer 2018 16 / 22

Halving an Image An inspection of the pixel indices show that we have the rule: If i and j are even integers, then keep pixel (i, j) and assign it to pixel (i/2, j/2) in the new image, and throw away pixels (i + 1, j), (i, j + 1), (i + 1, j + 1) This gives us an algorithm for halving an image: 1. Start with pixel (i, j) = (0, 0) 2. Assign pixel (i, j) to pixel (i/2, j/2) in the new image 3. i = i + 2 and j = j + 2, and go to Step 2 if i < n and j < m Çetin Kaya Koç http://koclab.org Summer 2018 17 / 22

Halving an Image im1 = cimage.fileimage("image1.gif") n = im1.getwidth() m = im1.getheight() im2 = cimage.emptyimage(n//2,m//2) for i in range(0,n,2): for j in range(0,m,2): p = im1.getpixel(i,j) im2.setpixel(i//2,j//2,p) im2.save("image2.gif") im2.draw(mywin) Çetin Kaya Koç http://koclab.org Summer 2018 18 / 22

Doubling an Image Consider an image of size n m Doubling procedure will produce an image of size (2n) (2m) Assume that we have a small image of size 4 3 Thus we have 4 columns and 3 rows, all together 12 pixels The figure below depict the column and row indices (i, j) of pixels (0,0) (1,0) (2,0) (3,0) (0,1) (1,1) (2,1) (3,1) (0,2) (1,2) (2,2) (3,2) Çetin Kaya Koç http://koclab.org Summer 2018 19 / 22

Doubling an Image Doubling an image first requires an empty of size (2n) (2m) We then pick a pixel from the original image, and place it in the new image such that every neighborhood of 2 2 pixels get the same original pixel populated in 4 locations For example, if we pick pixel (0,0) from the original image, we make four copies of it, and place it in the new image in locations (0,0), (1,0), (0,1) and (1,1) Çetin Kaya Koç http://koclab.org Summer 2018 20 / 22

Doubling an Image (0,0) (1,0) (2,0) (3,0) (0,1) (1,1) (2,1) (3,1) (0,2) (1,2) (2,2) (3,2) (0,0) (0,0) (1,0) (1,0) (2,0) (2,0) (3,0) (3,0) (0,0) (0,0) (1,0) (1,0) (2,0) (2,0) (3,0) (3,0) (0,1) (0,1) (1,1) (1,1) (2,1) (2,1) (3,1) (3,1) (0,1) (0,1) (1,1) (1,1) (2,1) (2,1) (3,1) (3,1) (0,2) (0,2) (1,2) (1,2) (2,2) (2,2) (3,2) (3,2) (0,2) (0,2) (1,2) (1,2) (2,2) (2,2) (3,2) (3,2) Çetin Kaya Koç http://koclab.org Summer 2018 21 / 22

Doubling an Image im1 = FileImage("image1.gif") n = im1.getwidth() m = im1.getheight() im2 = EmptyImage(2*n,2*m) for i in range(n): for j in range(m): p = im1.getpixel(i,j) im2.setpixel(2*i,2*j,p) im2.setpixel(2*i,2*j+1,p) im2.setpixel(2*i+1,2*j,p) im2.setpixel(2*i+1,2*j+1,p) im2.save("image2.gif") im2.draw(mywin) Çetin Kaya Koç http://koclab.org Summer 2018 22 / 22