Download presentation
Presentation is loading. Please wait.
Published byRyan Pickering Modified over 9 years ago
1
Chapter 14 Landsat 7 image of the retreating Malaspina Glacier, Alaska
2
Earth science is a very visual discipline Graphs Maps Field Photos Satellite images Because of this, all Earth scientists should have: Basic knowledge about graphics file types Pros/cons of different graphics file types Siccar Point: The first recognized angular unconformity by James Hutton Image: Chris Rowan @ Highly Allochthonous Blog Photomicrograph of peridotite (mantle rock) Sediment Core Landsat image of Death Valley, CA Cathodoluminescence image of granite
3
Which is better? Depends on use For graphs/plots: typically vector ( unless data set is HUGE ) For photos: raster Which is better? Depends on use For graphs/plots: typically vector ( unless data set is HUGE ) For photos: raster
6
MATLAB provides functions that read raster images Each pixel’s value (color) is stored as a number in matrix MATLAB also has an image processing toolbox with TONS of image processing options. In this class, we will only use the image functions that are part of the standard MATLAB libraries imread, image, imagesc, colormap, Novarupta Volcano, Aleutian Islands, Alaska Purples/Reds: Volcanic ash from 1912 Eruption Blues: Snow/Ice Mississippi River meanders & oxbows near Memphis, TN Yukon River delta, Alaska Landsat false-color image examples…
7
Before we start processing images, we need to talk about how computers represent colors as numbers Three common color models RGB: An additive model works like light CMYK: A subtractive model works like ink HSV: A cone-shaped model useful for shading colors
8
For variables of class uint8 (and 8-bit images) 0-255 are the possible integer values (same for the uint8 class!) 0 is minimum for any RGB color 255 is max for any RGB color Red (R)Green (G) Blue (B)To define any color, you must specify the Red (R), Green (G), and Blue (B) values Wait, color can be a vector! Grayscale images only need one value (0=black, 255=white) [ 0 0 0 ][ 255 255 255 ][ 75 75 75 ][ 200 200 200][ 255 0 0][ 100 0 0][ 0 255 0] [ 0 100 0 ][ 0 0 255 ][ 0 0 100 ][ 255 255 0][ 0 255 255][ 255 0 255][ 237 125 49]
9
Just to annoy us, MATLAB requires colormap RGB values to be values between 0 and 1 for variables of class double 0 is minimum for any RGB color 1 is max for any RGB color Red (R)Green (G) Blue (B)To define any color, you must specify the Red (R), Green (G), and Blue (B) values To convert from the 0-255 system, just divide by 255! Or cast as uint8 Grayscale images really only need one value (0=black, 1=white) [ 0 0 0 ][ 1 1 1 ][ 0.29 0.29 0.29 ][ 0.78 0.78 0.78][ 1 0 0][ 0.39 0 0][ 0 1 0] [ 0 0.39 0 ][ 0 0 1 ][ 0 0 0.39 ][ 1 1 0][ 0 1 1][ 1 0 1][ 0.93 0.49 0.19]
10
MATLAB can represent color in images in two basic ways 1)True Color or RGB The three color components are stored in a m x n x 3 matrix. I.e. a 3D matrix. R-valuesG-valuesB-values (:, :, 1) R-values; (:, :, 2) G-values; (:, :, 3) B-values 2)Indexed to a Colormap Colors are stored as a single integer value that corresponds to a row in a colormap matrix. Colormap stores the RGB values Image Matrix Colormap Matrix 4 Pixel Image
11
‘image’ plots a matrix as an image Don’t forget to specify the colormap If not, you get the default 64 color ‘jet’ colormap
12
MATLAB provides several built-in colormaps The command colormap is rather useful It can set the current colormap Can be a built-in map or a custom n x 3 matrix Built-in colormaps can be easily scaled E.g. “jet(256)” returns a 256 x 3 matrix that follows the color scheme of the built-in “jet” colormap.
13
If ‘image’ is passed a 3D matrix It is assumed to be a true color image R-values 1 st level R-values G-values 2 nd level G-values B-values 3 rd level B-values If ‘image’ is passed a 2D matrix It is assumed to be an colormap indexed image
14
If you exceed the color map values, you get either the min or max color
15
Why does MATLAB offer two ways to store image colors? 1)Flexibility. It is always good to give users options 2)Grayscale vs Color Images These images are typically read in MATLAB in different ways Grayscale: Indexed Color Color image: True Color or RGB image
17
‘imread’ can read in most standard grayscale raster image types.jpg.gif.png, etc… Stores image as a rectangular matrix Each entry represents one pixel’s grayscale value 0-255 (black to white) Let’s read this image into MATLAB The image is 814 x 531 pixels Matrix will be 531 x 814 Try to automate detection of the dendrites Cropped grayscale image of dendrites Increased contrast (using Photoshop)
18
If ‘image’ is given a 2D matrix, it assumes the image is indexed color
20
‘imread’ can read in most standard RGB raster image types.jpg.gif.png, etc… Stores image as a 3D matrix Each entry represents one pixel’s R, G, or B value 0-255 (min/max) 1 st z-slice = Red values 1 st z-slice = Red values 2 nd z-slice = Green values 2 nd z-slice = Green values 3 rd z-slice = Blue values 3 rd z-slice = Blue values Let’s read this image into MATLAB The image is 1000 x 1001 pixels Matrix will be 1001 x 1000 x 3 Try to automate detection of the water Landsat image of Yukon River delta Google Earth Image (aerial photo)
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.