Images and MATLAB Source of images: http://www.course.com/catalog/product.cfm?category=Computer Science&subcategory=Digital Image Processing&isbn=0-534-40011-6.

Slides:



Advertisements
Similar presentations
Raster Graphics 2.01 Investigate graphic image design.
Advertisements

Web Design Vocab 3 PNG, JPG, GIF, MP3, MPEG.
Raster graphics. Colour depth 01 1 bit pr pixel = 2 combinations (2 1 ): 2 bits pr pixel = 4 combinations (2 2 ): bits pr pixel = 16 combinations(2.
 Vector data- making polygons, outlines, like coastline.
Introduction to MATLAB and image processing. MATLAB and images The help in MATLAB is very good, use it! An image in MATLAB is treated as a matrix Every.
Images and MATLAB.
Nice Calm Scene. (You’ll need it.). Skills Getting files off of the camera or scanner Getting files off of the camera or scanner Archiving Archiving Choosing.
Graphics in the web Digital Media: Communication and Design
Data starts with width and height of image Then an array of pixel values (colors) The number of elements in this array is width times height Colors can.
Goals of Computer Vision To make useful decisions based on sensed images To construct 3D structure from 2D images.
WEB GRAPHICS. The Pixel Computer displays are comprised of rows and columns of pixels. Pixels are indivisible. Some common screen resolutions are:, 600.
Color Names All standards-compliant browsers should handle these color names These color names can be used with the CSS properties of color and background-color.
Images and Programming
Multimedia Specification Design and Production 2012 / Semester 1 / L4 Lecturer: Dr. Nikos Gazepidis
Module Code: CU0001NI Technical Information on Digital Images Week -2.
Image Storage Bitmapped Graphics – in which an image is represented as a collection of dots Vector Graphics – in which an image is represented as a set.
Measurements in Fluid Mechanics 058:180:001 (ME:5180:0001) Time & Location: 2:30P - 3:20P MWF 218 MLH Office Hours: 4:00P – 5:00P MWF 223B-5 HL Instructor:
SOFTWARE TYPES Word processing Page layout Paint Draw.
September 21, COMPUTER VISION WEB PAGE IS UP !! OR Simply go to computer science homepage.
Common file formats  Lesson Objective: Understanding common file formats and their differences.  Learning Outcome:  Describe the type of files which.
Digital Cameras And Digital Information. How a Camera works Light passes through the lens Shutter opens for an instant Film is exposed to light Film is.
Image Formats and Files Jung-Ming Wang
1 Imaging Techniques for Flow and Motion Measurement Lecture 2 Lichuan Gui University of Mississippi 2011 Digital Image & Image Processing.
Information Processes and Technology Multimedia: Graphics.
Digital Image Processing Lecture 2: Image Types & Matlab January 13, 2004 Prof. Charlene Tsai.
Image formats. Basic terminologies… Pixels: Pixels are the building blocks of every digital image. a pixel is a single point in a graphic image. Resolutions:
Computer Images Can store color info about each pixel, but makes file BIG Compression for Web 15.
CS112 Scientific Computation Department of Computer Science Wellesley College Numb3rs Number and image types.
© 2004 R. C. Gonzalez, R. E. Woods, and S. L. Eddins Digital Image Processing Using MATLAB ® Chapter 2 Fundamentals Chapter.
Types of Graphics  Vector Individual scalable objects defined by mathematical equations  Bitmap Pixels (tiny, single-colored square) in a grid Most.
1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng.
Bitmap Graphics. Bitmap Basics Bitmap Graphic Bitmap Graphic Paint Software Paint Software.
Multimedia Basics (1) Hongli Luo CEIT, IPFW. Topics r Image data type r Color Model : m RGB, CMY, CMYK, YUV, YIQ, YCbCr r Analog Video – NTSC, PAL r Digital.
Graphics & Images What File Format Do I Use?. Graphics & Images …..are visual images presented on some form of media (drawings, print, web, digital video)
Multimedia. What is a graphic?  A graphic can be a: Chart Drawing Painting Photograph Logo Navigation button Diagram.
Digital Image Processing Lecture 2: Image Types & Matlab
Image formats Characteristics © Adolf Knoll, National Library of the Czech Republic.
Mirjana Devetakovic, M.Sc. CAAD - Images Beograd, 2011.
Raster Graphics 2.01 Investigate graphic image design.
Graphics Concepts Presentation
Digital Image Editing Presented by John Hohn. File Formats JPEG – Joint Photographic Experts Group PNP – Portable Network Graphics GIF – Graphic Interchange.
8 Graphics Digital Media I. What is a graphic? A graphic can be a:  Chart  Drawing  Painting  Photograph  Logo  Navigation button  Diagram.
Digital Graphics for Computer Games Pixels Types of Digital Graphics (Raster and Vector) Compression.
Image File Formats By Dr. Rajeev Srivastava 1. Image File Formats Header and Image data. A typical image file format contains two fields namely Dr. Rajeev.
Lecture 27: Image Processing
Scanner Scanner Introduction: Scanner is an input device. It reads the graphical images or line art or text from the source and converts.
Graphics and Image Data Representations 1. Q1 How images are represented in a computer system? 2.
8th Lecture – Intro to Bitmap or Raster Images
Representation of image data
Computer Application in Engineering Design
Sampling, Quantization, Color Models & Indexed Color
Introduction to Graphics
Introduction to raster graphics
Image Formats.
Sci Vis I Exam Review Unit 6 File Formats.
2.01 Investigate graphic image design.
Graphics Basics Ellen Eyth.
Raster Images CPSC 1030.
"Digital Media Primer" Yue-Ling Wong, Copyright (c)2013 by Pearson Education, Inc. All rights reserved.
Saving Images from Fireworks
Outline Image formats and basic operations Image representation
2.01 Investigate graphic image design.
Fourth Year – Software Engineering
COMS 161 Introduction to Computing
GRAPHICAL DATA EXCHANGE FORMATS .jpg .gif .tif.
2.01 Investigate graphic image design.
Introduction to Image Analysis and Processing
"Digital Media Primer" Yue-Ling Wong, Copyright (c)2013 by Pearson Education, Inc. All rights reserved.
2.01 Investigate graphic image design.
Presentation transcript:

Images and MATLAB Source of images: http://www.course.com/catalog/product.cfm?category=Computer Science&subcategory=Digital Image Processing&isbn=0-534-40011-6

Grayscale images 灰階影像 Matlab example: w=imread(‘wombats.tif’); figure, imshow(w), pixval on figure: create a window to place graphic object imshow: display matrix Data type of w? 256x256 uint8 (unsigned integer 8 bits

Binary image 二元影像 Matlab example: Data type of w? w=imread(‘circles.tif’); figure, imshow(w), pixval on Data type of w? 256x256 logical Pixel value is 0 or 1

RGB (true color) images 全彩影像 Matlab example: w=imread(‘lily.tif’); figure, imshow(w), pixval on size(w) w(100,200,2) w(100,200,1:3) w(100,200,:)

RGB color model

Pixel depth Pixel depth: the number of bits used to represent each pixel in RGB space Full-color image: 24-bit RGB color image (R, G, B) = (8 bits, 8 bits, 8 bits)

Indexed color image 彩色索引影像 Matlab example: w=imread(‘emu.tif’); figure, imshow(w), pixval on What’s wrong?

Indexed color image 6 10 15 12 5 11 20 10 … 4 6 10 7 indices Color map 0.1211 0.1211 0.1416 0.1807 0.2549 0.1729 0.2197 0.3447 0.1807 0.1611 0.1768 0.1924 0.2432 0.2471 0.1924 0.2119 0.1963 0.2002 Color map … indices 6 10 15 12 5 11 20 10 4 6 10 7

Indexed color image Matlab example: [w,wmap]=imread(‘emu.tif’); imshow(w, wmap) How do we know it’s an indexed image?

Get information about image imfinfo(‘emu.tif’); Filename: 'emu.tif' FileModDate: '12-Jul-2004 11:40:00' FileSize: 119804 Format: 'tif' FormatVersion: [] Width: 331 Height: 384 BitDepth: 8 ColorType: 'indexed' ByteOrder: 'little-endian' NewSubfileType: 0 BitsPerSample: 8 Colormap: [256x3 double]

Data types and conversion uint8 image must be converted to double before any arithmetic operation w=imread(‘wombats.tif’); w=w+1; % fail w=double(w); % data type is also conversion func. w=w+1; % ok

Write image matrix to file Matlab code w=imread('wombats.tif'); imwrite(w, 'wombats.pgm', 'pgm'); General form imwrite(X, map, ‘filename’, ‘format’);

MATLAB supported image formats JPEG: Joint Photographics Experts Group TIFF: Tagged Image File Format GIF: Graphics Interchange Format BMP: Microsoft Bitmap Format PNG: Portable Network Graphics …

Image file formats Header information Body Size of the image Color map, compression method, etc. Body Compressed or uncompressed ASCII or binary

Hexadecimal dump function function dumphex(filename, n) % read 16*n bytes % ex. dumphex('picture.bmp', 4) fid=fopen(filename, 'r'); if fid==-1 error('File does not exist'); end; a=fread(fid, 16*n, 'uchar'); idx=find(a>=32 & a<=126); ah=dec2hex(a); b=repmat([' '], 16*n, 3); b2=repmat('.', 16, n); b2(idx)=char(a(idx)); b(:,1:2)=ah; [reshape(b',48,n)' repmat(' ',n,2) reshape(b2,16,n)']

Simple ASCII PGM w=imread('wombats.tif'); imwrite(w, 'wombats.pgm', 'pgm', 'encoding', 'ASCII'); header P2 256 256 255 67 64 65 65 63 54 51 48 49 48 45 55 60 52 53 58 52 52 58 61 62 58 52 51 68 65 52 51 54 49 51 55 54 61 54 60 61 57 58 58 61 69 72 71 60 55 61 55 52 46 48 49 58 56 43 42 40 43 48 51 51 54 57 58 52 52 54 50 …

BMP File header

JPEG file header

Write JPEG image file I=imread('bubbles.tif'); imwrite(I, 'bubbles50.jpg', 'quality', 50); Check compression ratio K=imfinfo('bubbles50.jpg'); ratio=(K.Width*K.Height*K.BitDepth/8)/K.FileSize; 單位為 Byte

Exercise Write JPEG file with different quality factor and compute its compression ratio