{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

homework6 - ComputerScience106:MATLAB HW6,part1due3/9...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Computer Science 106: MATLAB HW 6, part 1 due 3/9 Part 1 images A little preliminary. If you have a 2‐D array in Matlab, it is easy to swap rows and columns in or out of the matrix: Consider the array A and the vector X >> A = [1 3 4; 7 5 6; 1 8 1; 9 9 9] A = 1 3 4 7 5 6 1 8 1 9 9 9 >> X = A(2,:) X = 7 5 6 >> A(4,:) = X A = 1 3 4 7 5 6 1 8 1 7 5 6 A picture file is a (often compressed) file of values for each pixel in the image with a pixel value consisting of the amount of Red, the amount of Green and the amount of Blue light intensity for the pixel. Light intensities run from 0 to 255 (or 00 to ff in hexadecimal) for each component, so that 0,0,0 is black and 255,255,255 is bright white. Any color of the form a,a,a is a shade of gray. Now, in Matlab, you can read image files in a number of formats with the very simple command pic = imread(“trees.jpg”) The resulting variable pic will be a 3‐D array made up of a stack of three 2‐D arrays, layer 1 being a matrix of all of the red pixel values, layer 2 being all the green values, and layer 3 being all the blue values. Each of these layers has the dimensions of the image in pixels.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 2

homework6 - ComputerScience106:MATLAB HW6,part1due3/9...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online