applications of linear algebra 3: colors and...

26
Applications of Linear Algebra 3: Colors and Images October 31, 2011 Applications of Linear Algebra 3: Colors and Images

Upload: others

Post on 21-May-2020

12 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

Applications of Linear Algebra 3:Colors and Images

October 31, 2011

Applications of Linear Algebra 3: Colors and Images

Page 2: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

RGB

A color can be stored quantitatively by assigning a valuebetween 0 and 255 for each of red (r), green (g), and blue (b).

A value of 0 equals the absence of that color and a value of255 equals the full coloring of that value.

For example, (0, 0, 0) is black, (255, 255, 255) is white, and(255, 0, 0) is “reddest” red.

Applications of Linear Algebra 3: Colors and Images

Page 3: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

RGB

A color can be stored quantitatively by assigning a valuebetween 0 and 255 for each of red (r), green (g), and blue (b).

A value of 0 equals the absence of that color and a value of255 equals the full coloring of that value.

For example, (0, 0, 0) is black, (255, 255, 255) is white, and(255, 0, 0) is “reddest” red.

Applications of Linear Algebra 3: Colors and Images

Page 4: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

RGB

A color can be stored quantitatively by assigning a valuebetween 0 and 255 for each of red (r), green (g), and blue (b).

A value of 0 equals the absence of that color and a value of255 equals the full coloring of that value.

For example, (0, 0, 0) is black, (255, 255, 255) is white, and(255, 0, 0) is “reddest” red.

Applications of Linear Algebra 3: Colors and Images

Page 5: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

RGB

A color can be stored quantitatively by assigning a valuebetween 0 and 255 for each of red (r), green (g), and blue (b).

A value of 0 equals the absence of that color and a value of255 equals the full coloring of that value.

For example, (0, 0, 0) is black, (255, 255, 255) is white, and(255, 0, 0) is “reddest” red.

Applications of Linear Algebra 3: Colors and Images

Page 6: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

RGB

A color can be stored quantitatively by assigning a valuebetween 0 and 255 for each of red (r), green (g), and blue (b).

A value of 0 equals the absence of that color and a value of255 equals the full coloring of that value.

For example, (0, 0, 0) is black, (255, 255, 255) is white, and(255, 0, 0) is “reddest” red.

Applications of Linear Algebra 3: Colors and Images

Page 7: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

A picture is a matrix

Any color can be described by a 3-vector, and any picture canbe thought of as being made up of m × n pixels each havingits own color.

So a picture can be stored in an m × n × 3 matrix, or anm × n matrix where each entry is a 3-vector (as opposed to anumber).

For example, consider the following 200 × 320 pixel image.

Applications of Linear Algebra 3: Colors and Images

Page 8: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

A picture is a matrix

Any color can be described by a 3-vector, and any picture canbe thought of as being made up of m × n pixels each havingits own color.

So a picture can be stored in an m × n × 3 matrix, or anm × n matrix where each entry is a 3-vector (as opposed to anumber).

For example, consider the following 200 × 320 pixel image.

Applications of Linear Algebra 3: Colors and Images

Page 9: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

A picture is a matrix

Any color can be described by a 3-vector, and any picture canbe thought of as being made up of m × n pixels each havingits own color.

So a picture can be stored in an m × n × 3 matrix, or anm × n matrix where each entry is a 3-vector (as opposed to anumber).

For example, consider the following 200 × 320 pixel image.

Applications of Linear Algebra 3: Colors and Images

Page 10: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

A picture is a matrix

Any color can be described by a 3-vector, and any picture canbe thought of as being made up of m × n pixels each havingits own color.

So a picture can be stored in an m × n × 3 matrix, or anm × n matrix where each entry is a 3-vector (as opposed to anumber).

For example, consider the following 200 × 320 pixel image.

Applications of Linear Algebra 3: Colors and Images

Page 11: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

A picture is a matrix

Any color can be described by a 3-vector, and any picture canbe thought of as being made up of m × n pixels each havingits own color.

So a picture can be stored in an m × n × 3 matrix, or anm × n matrix where each entry is a 3-vector (as opposed to anumber).

For example, consider the following 200 × 320 pixel image.

Applications of Linear Algebra 3: Colors and Images

Page 12: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

Transformations

What will happen if we apply a transformation to each one ofthe vectors in the 200 × 320 matrix?

For example, define a transformation

C =

0 0 10 1 01 0 0

.

How will C act on the picture? Apply the transformation to ageneric pixel ~x :

C~x =

0 0 10 1 01 0 0

rgb

=

bgr

.

Applications of Linear Algebra 3: Colors and Images

Page 13: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

Transformations

What will happen if we apply a transformation to each one ofthe vectors in the 200 × 320 matrix?

For example, define a transformation

C =

0 0 10 1 01 0 0

.

How will C act on the picture? Apply the transformation to ageneric pixel ~x :

C~x =

0 0 10 1 01 0 0

rgb

=

bgr

.

Applications of Linear Algebra 3: Colors and Images

Page 14: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

Transformations

What will happen if we apply a transformation to each one ofthe vectors in the 200 × 320 matrix?

For example, define a transformation

C =

0 0 10 1 01 0 0

.

How will C act on the picture? Apply the transformation to ageneric pixel ~x :

C~x =

0 0 10 1 01 0 0

rgb

=

bgr

.

Applications of Linear Algebra 3: Colors and Images

Page 15: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

Transformations

What will happen if we apply a transformation to each one ofthe vectors in the 200 × 320 matrix?

For example, define a transformation

C =

0 0 10 1 01 0 0

.

How will C act on the picture? Apply the transformation to ageneric pixel ~x :

C~x =

0 0 10 1 01 0 0

rgb

=

bgr

.

Applications of Linear Algebra 3: Colors and Images

Page 16: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

Thus becomes

Applications of Linear Algebra 3: Colors and Images

Page 17: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

Thus becomes

Applications of Linear Algebra 3: Colors and Images

Page 18: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

Thus becomes

Applications of Linear Algebra 3: Colors and Images

Page 19: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

Oops!

Can we undo this?Yes, in fact, with the same transformation.

Apply

0 0 10 1 01 0 0

to to obtain

Applications of Linear Algebra 3: Colors and Images

Page 20: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

Oops!

Can we undo this?

Yes, in fact, with the same transformation.

Apply

0 0 10 1 01 0 0

to to obtain

Applications of Linear Algebra 3: Colors and Images

Page 21: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

Oops!

Can we undo this?Yes, in fact, with the same transformation.

Apply

0 0 10 1 01 0 0

to to obtain

Applications of Linear Algebra 3: Colors and Images

Page 22: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

Oops!

Can we undo this?Yes, in fact, with the same transformation.

Apply

0 0 10 1 01 0 0

to to obtain

Applications of Linear Algebra 3: Colors and Images

Page 23: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

Now let C =

0 0 10 1 00 0 0

. Then C applied to the picture

yields

Can this be undone?

Applications of Linear Algebra 3: Colors and Images

Page 24: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

Now let C =

0 0 10 1 00 0 0

. Then C applied to the picture

yields

Can this be undone?

Applications of Linear Algebra 3: Colors and Images

Page 25: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

Now let C =

0 0 10 1 00 0 0

. Then C applied to the picture

yields

Can this be undone?

Applications of Linear Algebra 3: Colors and Images

Page 26: Applications of Linear Algebra 3: Colors and Imageswebpages.ursinus.edu/nscoville/LinearColors.pdf · Applications of Linear Algebra 3: Colors and Images. A picture is a matrix Any

Now let C =

0 0 10 1 00 0 0

. Then C applied to the picture

yields

Can this be undone?

Applications of Linear Algebra 3: Colors and Images