Images and MATLAB.

Slides:



Advertisements
Similar presentations
Laboratory of Image Processing Pier Luigi Mazzeo
Advertisements

Image Display MATLAB functions for displaying image Bit Planes
Image Data Representations and Standards
MATLAB Image Processing Toolbox. Introduction  Collection of functions (MATLAB files) that supports a wide range of image processing operations  Documentation.
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.
多媒體安全 Macros Examples Gamma.txt 報告學生:碩專 2A 王朝鵬 ( ) 指導教授:黃文楨 博士.
ImageJ Macro Language FileDemo.txt範例
1 第一章 Word 的基本觀念 內容概要: Word 的特色 啟動與離開 Word 的方法 滑鼠游標與外型的介紹 基本操作 Word 視窗法則 使用 Word 遭遇問題時, 應如何利用軟體特 性而獲得輔助解說.
邏輯設計 題目:3_8解碼器 姓名:李國豪 學號:B09322001.
具備人臉追蹤與辨識功能的一個 智慧型數位監視系統 系統架構 在巡邏模式中 ,攝影機會左右來回巡視,並 利用動態膚色偵測得知是否有移動膚色物體, 若有移動的膚色物體則進入到追蹤模式,反之 則繼續巡視。
Matlab Assignment Due Assignment 兩個 matlab 程式 : Eigenface : Eigenvector 和 eigenvalue 的應用. Fractal : Affine transform( rotation, translation,
Digital Signal Processing with Examples in M ATLAB ® Chap 1 Introduction Ming-Hong Shih, Aug 25, 2003.
1-6 動畫的文件屬性 舞台是動畫實際播放的畫面, 所以舞台的大 小與長寬比例對將來動畫的呈現有很大的 影響。 Flash 預設的舞台尺寸是 550 Pixels × 400 Pixels, 背景為白色, 如果要更改舞台大小與 背景色, 請執行『修改 / 文件』命令, 開啟文 件屬性 (Document.
從此處輸入帳號密碼登入到管理頁面. 點選進到檔案管理 點選「上傳檔案」上傳資料 點選瀏覽選擇電腦裡的檔案 可選擇公開或不公開 為平台上的資料夾 此處為檔案分類,可顯示在展示頁面上,若要參加 MY EG 競賽,做品一律上傳到 “ 98 MY EG Contest ” 點選此處確定上傳檔案.
1 第七章 植基於可調整式量化表及離散餘 弦轉換之浮水印技術. 2 Outlines 介紹 介紹 灰階浮水印藏入 灰階浮水印藏入 灰階浮水印取回 灰階浮水印取回 實驗結果 實驗結果.
845: Gas Station Numbers ★★★ 題組: Problem Set Archive with Online Judge 題號: 845: Gas Station Numbers. 解題者:張維珊 解題日期: 2006 年 2 月 題意: 將輸入的數字,經過重新排列組合或旋轉數字,得到比原先的數字大,
Chapter 10 m-way 搜尋樹與B-Tree
Images and MATLAB Source of images: Science&subcategory=Digital Image Processing&isbn=
Probability Distribution 機率分配 汪群超 12/12. 目的:產生具均等分配的數值 (Data) ,並以 『直方圖』的功能計算出數值在不同範圍內出現 的頻率,及繪製數值的分配圖,以反應出該 機率分配的特性。
1 認識數位影像 什麼是數位影像 數位影像依其處存方式可分為兩大類 : 1. 向量影像( vector-based image ):影像圖案由一個 個物件所組成,每個物件可由一數學式表達 2. 點陣式影像( bit-mapped image ):影像圖案由像素 一個個排列而成.
INTRODUCTION TO MATLAB SHAWNNTOU. What Is MATLAB? MATLAB® is a high-performance language for technical computing. MATLAB® is a high-performance language.
: Problem E Antimatter Ray Clearcutting ★★★★☆ 題組: Problem Set Archive with Online Judge 題號: 11008: Problem E Antimatter Ray Clearcutting 解題者:林王智瑞.
Graphics in the web Digital Media: Communication and Design
Histogram 直方圖 Statistics of the pixel gray-levels of an image h(r k )=n k : histogram gray level no. of occurrence.
-Artificial Neural Network- Matlab操作介紹 -以類神經網路BPN Model為例
資料結構實習-六.
Microsoft Excel.
6 彩色影像處理 6.1 色彩基礎 6.2 色彩模式 6.3 假彩色影像處理 6.4 全彩色影像處理基本原理 6.5 色彩轉換
Images and Programming
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:
Introduction to MATLAB
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.
M ATLAB L ECTURE 1 Basic Concepts of Digital Image Processing.
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.
Image Processing:Fundementals Lecture: Introduction –An image is digitized to convert it to a form which can be stored in a computer's memory or.
Digital Image Processing Lecture 6: Image Geometry
Data Management 連賢明 政大財政. 2 統計軟體  一般通用 STATA SAS  個體計量 LIMDEP  高階軟體 MATLAB GAUSS.
Digital Image Processing Lecture 2: Image Types & Matlab January 13, 2004 Prof. Charlene Tsai.
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.
Image Enhancement in the Spatial Domain (MATLAB)
1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng.
計概實習 Week 8 Graphic & Image Tools. Image 美是主觀的 最好的相片? Lena
Digital Image Processing Lecture4: Fundamentals. Digital Image Representation An image can be defined as a two- dimensional function, f(x,y), where x.
Digital Image Processing Lecture 2: Image Types & Matlab
Motivation 1.2. Why is Computer Vision Difficult? 1.3. Image Representation and Image Analysis 1.4. Summary Chapter 1 - Introduction.
Image Processing Ch2: Digital image Fundamentals Prepared by: Tahani Khatib.
1 IPTABLES and NAT on Fedora Core 6 Speaker : Rex Wu Date :
Outline Introduction to MATLAB Image Processing with MATLAB
Digital Image Processing Introduction to MATLAB. Background on MATLAB (Definition) MATLAB is a high-performance language for technical computing. The.
Visual Cryptography for Gray-Level Images by Dithering Techniques
Computer Science 121 Scientific Computing Winter 2014 Chapter 14 Images.
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
Digital Image Processing
Image Representation Last update st March Heejune Ahn, SeoulTech.
Introduction to MATLAB Ehsan Adeli M. Iran University of Science and Technology, E-Learing Center, Fall 2008 (1387)
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.
Image Processing 1 Digital Image Processing Teacher Assistant: Elhanan Elboher course personal
數位影像處理 Digital Image Processing 吳育龍老師. Read image data Screen Resolution : 1024 X
Computer Application in Engineering Design
Image and Audio File Formats
Lab of Multimedia System
Saving Images from Fireworks
Digital Image Fundamentals
Digital Image Processing
Fundamentals of Image Processing Digital Image Representation
Presentation transcript:

Images and MATLAB

Matlab Advantages Every variable in Matlab is a multidimensional matrix. Highly modular. No memory allocation is necessary. Matlab enables its own garbage collection. Simple interface for complex mathematical concepts. Even 1D variables. In terms of matrix dimensions, and in terms of new functions Memory issues should be regarded when dealing with large data sets. Highly intuitive – most functions work for all dimension objects in the same manner.

Image Types Intensity images scaled to represent intensities (uint8 – [0,255], double [0,1]) Binary images logical array of 0s and 1s Indexed images Look up table [x, map] RGB images truecolor, array of (m*n*3) In case of logical arrays if the image is converted to logical any non zero element is converted to 1. When working in intensity image it is important to convert to double when performing numerical operations like / 2 first types – grayscale 2 last types – color images Map (3*number of colors), efficient representation Checking the image type : isind, isbw, isgray, isrgb Converting image types: rgb2ind, rgb2gray, gray2ind, ind2gray,….

Data Classes Numeric computations (8 first types) are done using double precision Uint8 – when reading data from storage device (8 bit images) Logical – output of logical operations (for example – mask threshing) Conversion – same as casting Converting between types : B = data_class_name(A) for example: B = double(A)

Conversions When converting between data classes and types it is important to keep the value range for each data class >> img = double(img)/255; >> img = im2double(img); Mat2gray – convert to full grayscale range [0 to 1] Im2double - for other data classes Im2bw – produce a binary image according to a threshold

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 …

Displaying an image(cont.) Spatial domain

Matlab Basics Digital image representation : 2D function f(x,y) -> finite discrete quantities Coordinate Conventions img(r,c) r – rows (height) c – cols (width) The first pixel: img(1,1) Image is a 2D function in each location there is value representing the gray level of the image. Color image are formed by combination of 2D images. For example in the RGB color space each pixel has Red Green and Blue values. Image is a discrete both in space (sampling) and in gray level values (quantization) Matlab starts from (1,1) in comparison to other computer languages

Matlab 內建影像 C:\MATLAB7\toolbox\images\imdemos 皆為Matlab Help中範例的原始影像。 使用時只需直接在指令中輸入檔名,即可使用。 適用於觀察影像處理結果

Different Image Types Indexed images Intensity (grayscale) images Binary images RGB (true-color) images

Reading an image imread() 功用:將影像載入並存成array格式備用 用法:[I,map] = imread(filename); I = imread(filename); ex: I = imread('pout.tif'); I為指向影像的變數 不指定變數,則為ans

Displaying an image imshow() 功用:開啟一個視窗顯示影像 用法: imshow(I) imshow(I,map) Figure, imshow() 功用:開啟一個新視窗顯示影像 用法: figure,imshow(I)

Displaying an image(cont.) imshow(I, [low, high]) imshow(I, [ ]) 功用:displays I as a grayscale intensity image, specifying the data range for I. The minimum value in I is displayed as black, and the maximum value is displayed as white. pixval : 功能:cursor on image to show pixel values 用法: imshow(I),pixval

Displaying an image(cont.) colorbar 功能:To display an image with a colorbar that indicates the range of intensity values. 用法: imshow(I), colorbar   ex: I = imread('pout.tif'); imshow(I) , colorbar

Writing an image imwrite() 功能:將影像寫入成檔案 用法: imwrite(I,filename,format) ex: imwrite(I,'pout.jpg','JPEG');

Image information Image size: size() ex: I= imread('saturn.png'); size(I) [M,N] = size(I) M=影像I的高 N=影像I的寬

Image information whos 功用:display information about an image . ex: whos I Imfinfo( filename ) 功用: display information about image file . ex: info = imfinfo('saturn.png')

Digital Image processing 影像二元化 g = im2bw(I, T); 功用:Convert intensity image I to binary image g using threshold T, where T must be in range [0, 1]. ex: I= imread('pout.tif'); g = im2bw(I, 0.4); imshow(g); colorbar

Digital Image processing(cont.) 彩色轉灰階 Rgb2gray() 功用:將RBG彩色影像轉換成gray-level影像。ex: I2= imread ('onion.png'); figure,imshow(I2); colorbar g2 = rgb2gray(I2); figure,imshow(g2); colorbar

Digital Image processing(cont.) 反相 imcomplement( ) 功用:The negative of an image. ex: I2= imread ('onion.png'); figure,imshow(I2); colorbar J2 = imcomplement(g2); figure, imshow(J2); colorbar

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

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

RGB (true color) images 全彩影像 Matlab example: w3=imread('peppers.png'); figure, imshow(w3), pixval on size(w3) w3(100,200,2) w3(100,200,1:3) w3(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: wI=imread('trees.tif'); figure, imshow(w), pixval on What’s wrong?

Indices Color Map

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

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]

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('pout.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('pout.tif'); imwrite(w, 'pout.jpg','jpg'); General form imwrite(X, map, ‘filename’, ‘format’);

Zooming and Shrinking Digital Images Create a new pixel location. Assign a gray-level to those new locations Nearest neighbor interpolation Pixel replication: a checkboard effect Bilinear interpolation using four nearest neighbors v(x’, y’)=ax’+by’+cx’y’+d where a, b, c, and d are determined from the gray-level of the four neighbors. Shrinking: Direct shrinking causes aliasing Expansion then Shrinking: blurring the image before shrinking it and reduce aliasing.

Sampling Methods of Inverse Mapping If transformed pixel ‘X’ locates among P1, P2, P3 and P4 Nearest neighbor method: I(‘X’) = I(P3 ) where I(p) is the intensity value of pixel p Bi-linear interpolation: I(‘X’) = (1-a)(1-b)I( P1 ) + a(1-b)I(P2 ) + (1-a)bI(P3 ) + abI(P4 ) where a, b are the fractional parts of ‘X’ Bi-cubic interpolation: based on cubic splines P1 P2 P3 P4

Nearest neighbor interpolation The closest neighbor is chosen , by rounding the “new” indexes to original image’s coordinates .

Digital Image processing(cont.) 變更影像大小 imresize(I,scale,method); 功用:To change the size of an image. interpolation Method: -'nearest‘ :Nearest-neighbor interpolation -'bilinear‘ :Bilinear (the default) -'bicubic‘ :Bicubic interpolation

Digital Image processing(cont.) 變更影像大小 imresize(I,scale,method); 功用:To change the size of an image. interpolation Method: -'nearest‘ :Nearest-neighbor interpolation -'bilinear‘ :Bilinear (the default) -'bicubic‘ :Bicubic interpolation

Digital Image processing(cont.) ex: I3 = imread('circuit.tif'); J3 = imresize(I3,1.25); figure, imshow(I3) figure, imshow(J3) J4= imresize(I3,[100 150], 'bilinear'); figure, imshow(J4)

Digital Image processing(cont.) 旋轉影像 imrotate(I, angle); 功用:To rotate an image. ex: I = imread('pout.tif'); J5 = imrotate(I,35); figure, imshow(J5)

Contents Histogram Histogram transformation Histogram equalization Contrast streching Applications

Histogram The (intensity or brightness) histogram shows how many times a particular grey level (intensity) appears in an image. For example, 0 - black, 255 – white 1 2 4 5 histogram image

Histogram equalization (HE)                                 Histogram equalization (HE) transforms the intensity values so that the histogram of the output image approximately matches the flat (uniform) histogram

Histogram equalization II.                                 Histogram equalization II. As for the discrete case the following formula applies: k = 0,1,2,...,L-1 L: number of grey levels in image (e.g., 255) nj: number of times j-th grey level appears in image n: total number of pixels in the image ·(L-1) ?

Histogram equalization III                                

histogram p=imread('pout.tif'); imshow(p), figure, imhist(p), axis tight

Histogram equalization ph=histeq(p); imshow(ph), figure, imhist(ph), axis tight

Histogram equalization (cont.) [ph, t]=histeq(p); plot(t), title('transform function'); Exercise#1. Apply histogram equalization to tire image