AP Computer Science Principles DAT-1 Faculty Lecture on Data Representation

Advanced Placement
26 Apr 202129:06

Summary

TLDRProfessor Paul Tiemman from Rochester Institute of Technology explains how data is internally represented in computers, focusing on binary and decimal number systems. He covers converting binary to decimal and vice versa, emphasizing positional numbering systems and powers of two. The presentation also explores the RGB color model and delves into steganography, demonstrating how to hide messages within digital images by manipulating pixel bits. Tiemman shows that even with significant bit reduction, images can still convey their original content, highlighting the power of digital manipulation and the importance of skepticism when interpreting digital media.

Takeaways

  • πŸ˜€ Professor Paul Tiemman from Rochester Institute of Technology introduces the concept of data representation in computers, focusing on binary and decimal systems.
  • πŸ”‘ The positional numbering system is explained, emphasizing that each digit in a binary number represents a power of 2, which is key to converting binary to decimal.
  • πŸ“Š A methodical approach to converting binary to decimal is demonstrated using a chart to identify and sum the relevant powers of 2.
  • πŸ” An important check is highlighted for binary to decimal conversion: if the binary number ends in 0, the decimal result must be even, ensuring conversion accuracy.
  • πŸ”„ The reverse process of converting decimal to binary is explained, using a similar chart method but starting with powers of 2 greater than the decimal number.
  • πŸ’‘ The significance of the least significant bit (LSB) in determining the parity (odd or even) of a decimal number when converting from binary is discussed.
  • πŸ–ΌοΈ The concept of image representation in computers using pixels and the RGB color model is introduced, showing how colors are created by combining red, green, and blue intensities.
  • 🎨 The potential for steganography in digital images is explored, demonstrating how messages can be hidden by manipulating pixel data without noticeably altering the image.
  • πŸ“š A practical example of steganography is given, where the entire text of 'Alice in Wonderland' is encoded within the least significant bits of a digital image's pixels.
  • πŸ€“ The presentation concludes with a binary joke, emphasizing the importance of understanding binary for computer scientists and highlighting the manipulability of digital data.

Q & A

  • What is the main topic of Paul Tiemman's presentation?

    -The main topic of Paul Tiemman's presentation is how data, including numbers, images, and text, is represented internally in a computer using binary numbers.

  • How does positional numbering system work in the context of binary numbers?

    -In a positional numbering system, each position in a number represents a particular power of the base of the number. In binary, each bit represents a different power of 2, starting from 2^0 on the right and increasing as you move left.

  • What is the process for converting a binary number to a decimal number?

    -To convert a binary number to a decimal, you determine which powers of 2 are represented by the 1s in the binary number and sum those powers. For example, the binary number 1 1 0 0 1 0 1 0 1 0 is converted to decimal by summing 512 + 256 + 32 + 8 + 2, which equals 810.

  • How can you check if a binary number represents an even or odd decimal number?

    -If a binary number represents an odd decimal number, the least significant bit (rightmost bit) must be 1. If it's 0, the number is even. This is because all powers of 2, except 2^0, are even.

  • What is the method for converting a decimal number to a binary number?

    -To convert a decimal number to binary, you determine which powers of 2 can be subtracted from the number until you reach zero, marking a 1 for each power of 2 used. For example, to convert 453 to binary, you would start with the highest power of 2 less than 453 (which is 256), mark a 1, subtract 256 from 453, and continue this process for the remaining number.

  • How many unique values can be represented with an 8-bit number?

    -With an 8-bit number, you can represent 256 unique values, calculated by raising 2 to the power of the number of bits (2^8).

  • What is the RGB color model and how is it used in computing?

    -The RGB color model is an additive color model where red (R), green (G), and blue (B) intensities are combined to create various colors. In computing, images are represented by pixels, each with an RGB value, allowing for a wide range of colors to be displayed.

  • What is steganography and how can it be applied to digital images?

    -Steganography is the practice of hiding a message within another message or object. In the context of digital images, it involves modifying some of the bits in an image's pixels to encode a hidden message without significantly altering the image's appearance.

  • How does the presenter demonstrate the encoding of a message in a digital image?

    -The presenter demonstrates encoding a message by using the least significant bit of the red channel in each pixel to store bits of an ASCII character. The entire text of 'Alice in Wonderland' is encoded in the pixels of an image, with only about half of the pixels being changed, making the alteration nearly imperceptible.

  • What is the significance of the joke 'There are 10 types of people in the world' mentioned in the presentation?

    -The joke 'There are 10 types of people in the world: those who understand binary, and those who don't' is a play on the fact that binary is a base-2 number system, which only has two digits, 0 and 1. It humorously implies that there are only two kinds of people: those who can think in binary and those who cannot.

Outlines

00:00

πŸ’‘ Introduction to Data Representation

Professor Paul Tiemman introduces the topic of data representation in computers, specifically focusing on the conversion between binary and decimal systems. He emphasizes the importance of understanding positional numbering systems, where each position in a number represents a power of the base. In binary, each bit represents a power of 2, and conversion to decimal involves summing the relevant powers of 2. A chart is used to illustrate this process, showing how to determine which powers of 2 to add together based on the binary digits. The professor also discusses a simple check for binary to decimal conversion, noting that the least significant bit must be 1 for odd numbers and 0 for even numbers.

05:03

πŸ”’ Decimal to Binary Conversion

The script continues with the process of converting decimal numbers to binary. A table is used to determine which powers of 2 are needed to sum up to the decimal number. The professor explains that powers of 2 greater than the decimal number are not included. The conversion process involves subtracting each power of 2 that can be included in the sum from the decimal number, moving right to left across the table. The example given is converting the decimal number 453 to binary, resulting in 111000101. The professor also discusses the range of numbers that can be represented with a given number of bits, explaining that 2 to the power of the number of bits gives the total number of unique values that can be represented.

10:04

πŸ–ΌοΈ Digital Image Representation

The third paragraph delves into how images are represented in a computer, using the RGB color model where colors are created by combining red, green, and blue intensities. The professor explains that images are divided into pixels, each with a unique color determined by RGB values. The example of Grumpy Cat is used to illustrate how images are broken down into pixels. The concept of steganography is introduced as a way to hide messages within images or other objects. The paragraph concludes with a discussion on the potential for hiding messages within digital images by manipulating bits, suggesting that not all bits are necessary for image representation and some can be used to encode hidden messages.

15:06

πŸ”„ Exploring Bit Manipulation in Images

This section explores the impact of bit manipulation on image quality. The professor demonstrates how turning off the least significant bits in the color channels of an image can reduce the number of colors represented without significantly altering the image's appearance. By turning off bits in the image of a samurai, the professor shows that even with fewer colors, the image remains recognizable. This experiment leads to a discussion about the feasibility of steganography in images, where messages can be hidden by modifying certain bits without noticeably changing the image.

20:08

πŸ“œ Encoding a Message in an Image

The professor describes a method for encoding a message into an image using ASCII values. By using the least significant bit of the red channel in each pixel, an 8-bit ASCII character can be stored across eight pixels. The example given is encoding the text 'Alice in Wonderland' into an image of Hobbiton. The professor explains that only about half of the pixels need to be changed to embed the message, making it difficult to detect the alteration. The paragraph concludes with a reminder that images on a computer can be easily manipulated and may not always represent reality, and ends with a binary-related joke to emphasize the importance of understanding binary in computer science.

Mindmap

Keywords

πŸ’‘Binary Number

A binary number is a base-2 numeral system that uses only two symbols, 0 and 1, to represent numerical values. In the context of the video, binary numbers are the fundamental way data is represented inside a computer. The script explains how to convert binary numbers to decimal and vice versa, which is essential for understanding how computers process and store data. For example, the script demonstrates converting the binary number '1 1 0 0 1 0 1 0 1 0' to the decimal number 810.

πŸ’‘Decimal Number

A decimal number is a base-10 numeral system that uses the ten digits from 0 to 9 to represent values. The video script discusses converting decimal numbers to binary, which is a common operation in computer science. This is important for understanding how numerical data is encoded in a format that computers can process. The script provides a method to convert the decimal number 453 into its binary equivalent.

πŸ’‘Positional Numbering System

A positional numbering system is a system where each position in a number represents a different power of the base. The video emphasizes that binary is a positional system where each digit (bit) represents a power of 2. This concept is crucial for understanding how to convert between binary and decimal systems, as each bit's value is determined by its position and whether it is a 0 or 1.

πŸ’‘Bit

A bit is the basic unit of information in computing and digital communications, representing a logical state with one of two possible values, 0 or 1. The script uses the term 'bit' to describe the individual elements of a binary number, and it is through the manipulation of bits that data representation and processing in computers occur.

πŸ’‘RGB Model

The RGB model is an additive color model in which red, green, and blue light are added together in various ways to reproduce a broad array of colors. The video script explains that images in a computer are represented using the RGB model, where each pixel's color is determined by the intensity of red, green, and blue components. This model is essential for understanding digital image representation and manipulation.

πŸ’‘Pixel

A pixel, short for 'picture element,' is the smallest addressable element in a display device; it is the basic unit of a digital image. The script describes how an image is divided into pixels, each with a specific color value, to form the complete picture. This concept is key to understanding how images are stored and processed within a computer.

πŸ’‘Steganography

Steganography is the practice of concealing a message, image, or file within another message, image, or file. The video script introduces steganography in the context of hiding messages within digital images by manipulating pixel data. This technique is used to demonstrate the potential for data manipulation and the importance of being aware of what digital media may contain beyond its surface appearance.

πŸ’‘ASCII

ASCII (American Standard Code for Information Interchange) is a character encoding standard for electronic communication, which represents text in computers and telecommunications equipment. The script mentions ASCII in the context of encoding text messages within images using the least significant bits of pixel color values. This illustrates how text can be hidden within images using steganography.

πŸ’‘Project Gutenberg

Project Gutenberg is mentioned in the script as a source for classic books in text form, which can be used for embedding text within images as part of a steganography demonstration. The script uses Project Gutenberg to obtain the text of 'Alice in Wonderland,' highlighting the vast amount of textual data that can be hidden within a single image.

πŸ’‘Manipulation of Digital Media

The script discusses the ease with which digital images can be manipulated to hide information or alter their appearance. This concept is important for understanding the potential for deception in digital media and the importance of critical evaluation of digital content. The video uses the example of embedding a text message within an image to demonstrate the manipulation of digital media.

Highlights

Introduction to data representation in computers, focusing on binary and decimal systems.

Explanation of positional numbering systems and their application in binary.

Conversion of binary numbers to decimal by summing powers of two.

Use of a chart to visualize the conversion process from binary to decimal.

Crossing out powers of two where binary bits are zero for easier conversion.

Self-check method for binary to decimal conversion using the least significant bit.

Conversion of decimal numbers to binary by finding the necessary powers of two.

Creating a table to determine which bits are needed for the decimal to binary conversion.

Determining the range of numbers representable by a given number of bits.

Understanding that 0 is a value and its importance in binary counting.

The concept of steganography and its application in hiding messages.

Hiding a message within a digital image by manipulating pixel bits.

The impact of reducing color depth on image quality and visibility of changes.

Encoding a message using ASCII and the least significant bit of pixel color channels.

The potential to store large texts within images using steganography.

Embedding the entire text of 'Alice in Wonderland' into a digital image.

The importance of critical thinking when interpreting digital images.

Final thoughts on the versatility of binary data manipulation and a parting joke.

Transcripts

play00:00

hi my name is paul tiemann and i'm a

play00:02

professor at the rochester institute

play00:03

technology in rochester new york

play00:06

and what i want to do today is talk to

play00:08

you about how

play00:09

data is represented internally in a

play00:11

computer

play00:12

some of this will probably be a review

play00:14

which i think is probably a good thing

play00:16

and

play00:16

hopefully some of it will be new and

play00:18

you'll learn something interesting along

play00:20

the way

play00:21

so the first thing i thought i would do

play00:23

is just kind of start with some simple

play00:25

stuff that i'm sure you've seen before

play00:27

but i want to make sure we're all on the

play00:29

same page before we get

play00:30

too far into this and what i want to

play00:33

just do is go over

play00:35

converting binary numbers to decimal and

play00:38

decimal numbers to binary so let's

play00:40

take looking at a binary number to

play00:43

decimal first

play00:44

okay as you probably learned in class

play00:48

we use numbering systems that are

play00:50

referred to as positional numbering

play00:52

systems

play00:53

and the reason we call them positional

play00:55

numbering systems is because each

play00:57

position in the number represents

play01:00

a particular power of the base of the

play01:03

number that we're representing here so

play01:06

in binary each one of the binary digits

play01:09

or bits

play01:10

represents a different power of 2. so

play01:14

what we need to do if we want to convert

play01:15

a binary number

play01:17

from binary to decimal what we basically

play01:20

need to do is figure out what powers of

play01:22

2 we need to add together

play01:24

and adding those powers together will

play01:26

tell us what the number is

play01:28

now the way i typically do this is i'll

play01:30

draw myself a little chart

play01:32

and i'll put the binary number in the

play01:34

chart so you'll see here in the top row

play01:37

i've got the number that i want to

play01:38

convert and in the bottom it's blank at

play01:41

the moment

play01:41

and now what i'll do is i'll just simply

play01:43

fill in

play01:44

the powers of two that each one of those

play01:46

bits represents

play01:48

okay so starting over at the right hand

play01:50

side we start with one

play01:53

you're always going to start with one

play01:54

regardless of the base you're working in

play01:56

because any number raised to zero is

play01:58

going to be

play01:58

one and then since i'm working in binary

play02:02

as i work my way from right to left what

play02:04

i just simply do is multiply by two

play02:07

so you see it's one two four eight

play02:09

sixteen so on up to five hundred and

play02:11

twelve

play02:12

okay so that's the start now the nice

play02:15

thing about converting

play02:17

a binary number to decimal is when we

play02:19

look

play02:20

at the binary digits there's only two

play02:23

possibilities there's either gonna be a

play02:25

one or a zero

play02:26

and the nice thing is if the bit is a

play02:28

zero it means that the power is not in

play02:31

the sum

play02:32

so what i will also do in my little

play02:33

chart typically is i will just simply

play02:35

cross out

play02:37

any of the values where the bits are

play02:39

zero okay

play02:40

and in this particular case that leaves

play02:42

the powers of 2 512

play02:45

256 32 8 and 2 and what i do is i add

play02:49

those together

play02:50

and i get 810 so i know that the

play02:53

binary number 1 1 0 0 1

play02:56

0 1 0 1 0 is equivalent to the decimal

play03:00

number 810

play03:02

now another thing that i always like to

play03:04

do is kind of have a way of checking

play03:05

myself to make sure that i did things

play03:07

right

play03:08

and there's a simple little check that

play03:09

you can do in

play03:11

these binary conversions just to kind of

play03:13

make sure that things are

play03:15

you know at least you got something

play03:16

close to the right answer

play03:18

and what that has to do with is

play03:20

basically that power of two to the zero

play03:22

okay uh if you take a look at all the

play03:25

powers of two with the exception of two

play03:27

to the zero which is one they're all

play03:28

even

play03:30

which means if i am representing an odd

play03:33

number in binary that

play03:36

bottom bit or the least significant bit

play03:39

has to be set to a one

play03:41

so i can look at that binary number one

play03:44

one zero zero one zero one zero

play03:46

one zero without even converting it

play03:48

because it ends in zero i know it's an

play03:50

even number

play03:51

and so what i always do is kind of a

play03:53

self check is i make it double check

play03:55

and i say to myself since my binary

play03:57

number ends in zero

play03:59

the decimal value that i get as a result

play04:01

of the conversion must be even as well

play04:03

okay if it's not if i get an odd decimal

play04:05

value then i know i did something wrong

play04:07

i'm going to go back and check my work

play04:09

okay so that's converting binary to

play04:11

decimal and i find that really simple to

play04:13

do

play04:14

okay now let's take the flip side you're

play04:17

given a number in decimal and you have

play04:19

to convert that to binary

play04:20

all right again i'm going to start it

play04:23

out basically the same way i'm going to

play04:25

do my little table

play04:26

and i want to figure out what powers are

play04:29

going to be

play04:30

powers of two i need to add together

play04:33

here to get 453

play04:36

so what i've done you'll see in this

play04:37

case is i filled the powers in the

play04:39

bottom row

play04:40

and i've left the top row blank because

play04:42

i need to figure out

play04:44

whether the corresponding bit for each

play04:46

one of those columns is either a zero or

play04:48

a one

play04:49

the other thing that i want you to kind

play04:50

of notice and hopefully

play04:52

you spotted it right off the top of your

play04:54

head 453

play04:56

is an odd number so i know whatever

play04:59

answer i get here that least significant

play05:02

bit where

play05:03

we have two to the zero it has to be a

play05:05

one and if it's not i did something

play05:07

wrong when i did the conversion

play05:09

now another question that you might want

play05:11

to ask yourself is

play05:12

how do i know how many powers of 2

play05:16

how many columns i'm going to put in

play05:17

this table all right

play05:19

remember what i'm trying to do here is i

play05:21

want to figure out the powers of 2 that

play05:23

i need to add together

play05:24

to get the number 453

play05:28

if i have a power of 2 that's greater

play05:30

than 453 like 512

play05:34

512 can't possibly be one of the numbers

play05:38

that i need to add together to get 453

play05:41

so what i'll do when i'm generating my

play05:42

table is i'll happily double my numbers

play05:45

until i hit the first power of two

play05:48

that's greater than the number that i'm

play05:49

trying to convert

play05:50

so that's why i stopped at 512 here

play05:54

okay and the next thing i'll do is i'll

play05:56

pop a zero in that column just to remind

play05:58

myself

play06:00

that power is not going to be in this

play06:01

number all right

play06:03

so now the question is how do i do the

play06:05

conversion well the way i use the table

play06:07

and the way that i do the conversion

play06:09

here

play06:09

is i'll work my way in this particular

play06:12

case from left to right

play06:14

and for each power i'll ask the question

play06:17

can i subtract that power from the

play06:19

number i'm trying to convert

play06:21

so i have 256 256 is less than 453

play06:26

so i know that the power 256 has to be

play06:29

in the binary number

play06:31

that's going to be the equivalent 453

play06:34

so what i'm going to do is i'm going to

play06:35

put a 1 above 256 as a reminder that

play06:38

that's going to be

play06:39

in the resulting binary number and then

play06:42

the other thing i'm going to do is i'm

play06:43

going to take 453 i'm going to subtract

play06:46

256 from it

play06:48

because i've accounted for that number

play06:50

already that leaves me with 197.

play06:53

and so now as i work my way down the

play06:55

table and i consider the next column

play06:57

i'm going to be looking at 197 and not

play07:00

453

play07:01

okay and as i work my way across i look

play07:04

at 128 128 is less than 197

play07:08

so i'll put a 1 up there and as i did

play07:09

before i'll compute what the difference

play07:11

is

play07:12

working my way down the line i see that

play07:15

64 is less than 69

play07:17

so again i'll put a one up there okay

play07:19

and now i only have five left

play07:22

the next column is the column that

play07:24

represents 32

play07:25

well that can't be in it it's too big

play07:28

16 can't be in it because it's too big

play07:31

eight can't be in it because it's too

play07:33

big

play07:34

that gets me down to four well four is

play07:36

going to be in there

play07:37

so i'll take uh put a one above the four

play07:39

as you're reminded that that's it that

play07:41

bit is turned on in this particular

play07:43

binary representation

play07:45

i'll subtract four from five i have a

play07:47

one left

play07:48

um two is bigger than one so there'll be

play07:50

a zero there

play07:52

and lo and behold i have one left so i'm

play07:54

gonna put a one above

play07:55

and i've accounted for all the numbers

play07:57

and so

play07:58

reading the binary number off the table

play08:01

i can see that 453 decimal

play08:04

is equivalent to 1 1 1 0

play08:07

0 0 1 0 1 in binary

play08:10

and again what i want you to notice is

play08:13

we spotted upfront ahead of time

play08:15

that 453 is an odd number so is

play08:18

one one one zero zero zero one zero one

play08:22

because it ends in a one okay so there's

play08:25

a little bit of confidence that we got

play08:27

it right

play08:28

now the other thing that i want to uh

play08:30

again

play08:31

just go over real quick and again i

play08:33

think this is a review but this is going

play08:35

to be very pertinent to what i'm going

play08:36

to show you in a minute

play08:38

is i want to ask the question if i

play08:41

have a certain number of bits that i'm

play08:43

going to use to represent a number

play08:45

what's the range of numbers that i can

play08:47

represent in that number of bits

play08:49

okay and what i did here just so that we

play08:51

have a kind of a

play08:52

concrete point is how many unique values

play08:56

can i represent in an

play08:57

8-bit number but you should be able to

play09:00

answer this question really for

play09:02

binary numbers that have an orbit you

play09:04

know any number of bits

play09:06

okay so how can we figure this out well

play09:08

a lot of times what i like to do

play09:10

is i like to kind of try to walk very

play09:14

slowly to get to the solution so

play09:16

what i'll ask myself first here is well

play09:20

what if i only have one bit how many

play09:22

unique values can i represent

play09:24

using one bit well with one bit

play09:27

i can either represent zero or i can

play09:29

represent one

play09:31

and what that means is i have two values

play09:34

okay what if i jump up to two bits now

play09:37

well if i jump up to two bits

play09:40

you can see i now have four values

play09:43

all right and if you take a look at that

play09:46

table you'll

play09:47

kind of notice a pattern if you look in

play09:49

the left the right hand

play09:50

column you're going to notice it goes 0

play09:53

1

play09:53

0 1 which is exactly the one bit

play09:57

pattern but it's duplicated twice and

play09:59

then if you look at the column on the

play10:01

left hand side you're going to see that

play10:04

i put a zero

play10:05

in front of the first repetition from

play10:07

that

play10:08

two bit from that one bit table and then

play10:10

one in front of and that's how you get

play10:11

four

play10:12

right what about three bits

play10:15

okay well here's three bits and again

play10:18

with three bits you can see that it's

play10:19

going to be eight unique values and

play10:21

again

play10:22

the same pattern applies so doing this

play10:25

it sort of looks like

play10:27

we could say well it looks like if you

play10:29

take

play10:30

two raise it to the number of bits that

play10:33

you have

play10:34

that's going to give you the number of

play10:35

values at least that applies to these

play10:38

three cases here

play10:39

so let's try that out okay let's try it

play10:43

for four bits

play10:45

according to that postulation we made on

play10:48

the previous slide

play10:50

this should be we should be able to

play10:51

represent 16 values using four bits

play10:54

all right well with four bits the

play10:57

largest number that i can represent

play10:59

in binary is one one one one and if you

play11:02

do a quick conversion in your head

play11:04

you'll realize that that's

play11:06

15 decimal okay so what that means is in

play11:09

four bits

play11:10

i can count one two three

play11:14

up to 15 using four bits but you might

play11:17

look at that and say but

play11:18

that's only 15 values and it seems to

play11:20

break the rule that you came up with

play11:22

on the previous slide but we left out

play11:24

something really important

play11:26

and this is something that comes up over

play11:28

and over and over again in computing

play11:31

you've got to remember that 0 is also a

play11:34

value that we can represent

play11:36

so when we look at counting i actually

play11:39

start counting at

play11:40

0. and if i start counting at zero and

play11:43

if i go up to 15

play11:46

while the maximum value that i can

play11:47

represent is

play11:49

15 there are actually 16 unique values

play11:52

there

play11:53

so it does work so in general what we

play11:56

can say

play11:57

is you take the number of bits you raise

play12:00

two to that

play12:00

so using eight bits to answer the

play12:02

question we had on that very first slide

play12:05

uh using eight bits i can represent a

play12:07

total of 256 different values

play12:10

for n bits i can represent two to the n

play12:13

different values

play12:15

okay so like i said that should just be

play12:17

a review i think it's something that

play12:18

you've probably seen before

play12:20

um you may have done it a little bit

play12:22

differently but sometimes looking at

play12:24

something in

play12:25

different perspectives gives you a

play12:27

little bit more insight into it

play12:29

okay the big thing i want you to

play12:32

remember from this

play12:33

presentation is that if something is in

play12:36

the computer

play12:36

it's nothing but this and i don't care

play12:39

what it is i don't care if it's numbers

play12:41

that we just looked at

play12:42

images videos this presentation you're

play12:45

looking at is inside a computer

play12:48

it's nothing but bits all right just the

play12:50

crazy stream

play12:52

of zeros and ones that's everything

play12:54

that's inside that universe of the

play12:56

computer

play12:57

now at first you might think that

play12:59

there's rather limiting

play13:00

but it's actually kind of empowering

play13:03

because

play13:04

if we have things that are represented

play13:05

in bits and they're in the computer

play13:08

something that a computer is really good

play13:09

at is manipulating bits

play13:11

so once it's in digital form once it's

play13:14

in the computer

play13:15

once it's represented as a stream of

play13:17

zeros and ones

play13:18

it can be very easily manipulated by a

play13:22

program

play13:23

and that's basically what i want to talk

play13:25

about next

play13:27

so before i get into that again a quick

play13:29

review

play13:30

i i'm going to do some image stuff here

play13:32

and i want to remind you

play13:34

how images work inside a computer the

play13:37

first thing we need to do is delve a

play13:38

little bit because

play13:39

color science and there's a variety of

play13:42

different models that color scientists

play13:44

use to

play13:44

to understand and represent and model

play13:47

colors

play13:48

one that is commonly used in computing

play13:51

is a model that's called rgb where r

play13:54

stands for red g

play13:56

stands for green and b stands for blue

play13:58

and it's an

play13:59

additive color model where you create

play14:02

colors

play14:03

by adding together different intensities

play14:06

of those three

play14:07

basic colors and that little diagram

play14:10

that i have on the right there

play14:11

that it's it basically looks like a venn

play14:14

diagram

play14:15

is showing you very simply if i don't

play14:17

vary

play14:18

the the intensity of the rgb components

play14:22

you can see that using those three

play14:23

different colors it's actually

play14:25

possible to represent a total of seven

play14:28

different colors you can see

play14:30

the red the green and the blue and then

play14:33

you can see the yellow

play14:35

uh the purple and whatever color that is

play14:39

with the

play14:39

odd g and the b plus white in the middle

play14:42

okay

play14:43

and i guess theoretically you could say

play14:45

there's an eighth color in there

play14:47

which is good for computers because we

play14:49

love powers of two

play14:51

the black is also a color that's

play14:52

represented there as well

play14:54

okay so how do we represent images

play14:57

inside a computer

play14:58

well this is a picture of my very first

play15:01

cat his name is grumpy cat

play15:03

and grumpy cat was called grumpy cactus

play15:06

he was a little bit strange he would

play15:07

always want to get petted

play15:09

but as soon as you petted him he would

play15:10

bite you and it wasn't like a

play15:13

love bite it was like i'm drawing blood

play15:16

so that's why we called him grumpy so

play15:19

this is

play15:19

obviously a picture of grumpy he's

play15:21

obviously in the computer

play15:23

at him but the images and the question

play15:26

is well

play15:27

how do we represent this as a stream of

play15:29

bits

play15:30

well commonly a very common way of

play15:32

representing an image is we'll take an

play15:34

image and we'll divide it up into a

play15:36

number of different cells

play15:37

all right so what i've done here is i've

play15:39

laid a grid over the picture of grumpy

play15:42

all right basically this is being done

play15:45

at a much

play15:45

finer scale in this image in fact the

play15:48

scale of these squares is so small

play15:51

that your eyes can't discern them all

play15:54

right and that's

play15:55

kind of the magic here each one of those

play15:57

individual cells is referred to as a

play15:59

pixel

play16:00

and each pixel has one unique color

play16:03

associated with it

play16:05

and that color is based on

play16:08

an r a g and a b value all right

play16:11

now it's a little bit hard to see the

play16:14

granularity here so what i did is i took

play16:17

just grumpy's eye and i blew it up

play16:20

at 800 percent and now you can actually

play16:23

start to see the pixels

play16:25

that make up his eye okay and if you

play16:28

look carefully

play16:29

you'll see that each one of those pixels

play16:31

has

play16:32

its own color associated with it all

play16:35

right and that's

play16:36

basically how images are represented

play16:38

inside a computer

play16:39

and again i expect it's a bit of a

play16:41

review

play16:43

one thing that i want to just note is

play16:45

that

play16:46

there are many different schemes that

play16:48

you can use to do the rgb

play16:50

or the rgb model namely one of the

play16:53

things that you can differ is the number

play16:55

of bits

play16:56

what i'm going to do here is assume that

play16:57

we're using eight bits for each of those

play17:00

color channels

play17:01

um so we have eight bits for red eight

play17:03

bits for green and eight bits for blue

play17:05

and using eight bits for those three

play17:08

colors we can represent more than

play17:10

16 million different colors okay

play17:14

all right now what i wanted to

play17:18

do is talk about um

play17:21

a technique called steganography and

play17:24

steganography it sounds really

play17:26

complicated

play17:27

but it's something that's been around

play17:28

forever and it's the practice of hiding

play17:31

a message within another message or

play17:34

within another physical object

play17:36

okay and if you take a look at that

play17:38

second sentence there

play17:39

laura's spending echoed assorted

play17:41

priorities for accurate skateboard use

play17:45

you might kind of look at that and say

play17:46

that's a little bit of a weird sentence

play17:48

but i guess then it makes sense

play17:50

but what i've actually done is i've

play17:52

embedded a message inside of that

play17:55

and until i tell you how to decode that

play17:57

message you don't know what it is

play17:59

but i will tell you if you look at the

play18:02

second

play18:02

letter in each of the words in that

play18:04

sentence

play18:05

it will give you a hidden message so if

play18:08

i

play18:08

what i did here is i just bolded them

play18:11

and maybe you can see it now

play18:13

and it's still a little bit noisy but if

play18:15

i just pull those out

play18:16

you'll see that the message is apcs

play18:18

rocks

play18:19

that's steganography it's been around

play18:21

forever

play18:22

and there's lots of classic examples of

play18:25

it um if this is something of interest

play18:27

you i strongly encourage you at some

play18:29

point

play18:30

google steganography sometime and find

play18:32

out about it

play18:33

so why am i bringing this up well what

play18:35

i'm wondering is

play18:37

can we hide a message inside of a

play18:39

digital picture

play18:42

the answer is going to be yes and so the

play18:44

question is

play18:45

how can i go about doing that all right

play18:48

well

play18:49

if i want to hide a message inside a

play18:51

digital picture

play18:52

what i'm going to have to do is modify

play18:55

some of the bits in that

play18:56

picture to encode the message all right

play18:59

kind of like what i did in the previous

play19:00

sentence it was a pain to come up with

play19:03

i had to come up with words that had the

play19:04

right second letter in it

play19:06

all right and i need to kind of do the

play19:08

same thing here i need

play19:10

to change some of the bits in the

play19:11

picture

play19:13

now i've already mentioned that in an

play19:16

8-bit

play19:16

rgb image we can in one pixel i can

play19:20

represent 16 million different colors

play19:23

so a question might be is

play19:26

do we really need all 24 of those bits

play19:32

at what point is a kind of overkill

play19:37

either our eyes can't tell the

play19:38

difference you know can our eyes

play19:41

finally determine the difference between

play19:44

more than 16 million different colors i

play19:47

know mine certainly cannot

play19:49

and another question is well what about

play19:50

the resolution of the device

play19:52

that i'm displaying the image on a

play19:55

typical computer or a cell phone

play19:58

the resolution is probably not going to

play20:00

be that good anyway

play20:01

so even though we have 16 million

play20:04

different

play20:04

color possibilities the display itself

play20:07

may not

play20:08

actually be able to show them so the

play20:10

question that i kind of want to ask

play20:12

is if i take a picture and if i start

play20:15

mucking around with some of the bits in

play20:17

the picture

play20:18

at what point do i notice it so this is

play20:21

a picture of me

play20:22

uh when i was in new zealand and i

play20:25

thought i'd stop

play20:26

at um this happens to be a samurai at

play20:28

the same wise genji's house

play20:30

from the hobbit i'm checking to see if

play20:32

anybody's home

play20:34

all right and this is the original

play20:35

picture that i took with my cell phone

play20:38

uh the basic model that you're seeing

play20:40

here is exactly what i described

play20:42

all right there's uh 24 bits here that

play20:45

are being used for each pixel

play20:48

and what i did here is i wrote a program

play20:52

that took this picture and went through

play20:55

all the pixel values and turned off

play20:58

the least significant bit so what i did

play21:02

here and that's what i'm trying to say

play21:03

at the top

play21:04

is the x the first seven bits in every

play21:08

one of those color channels i left them

play21:10

alone

play21:10

but i turned the last one off so now

play21:14

instead of using 24

play21:16

bits to represent the color i've cut it

play21:18

down to 21 bits

play21:20

and using 21 bits i can still represent

play21:23

a little bit more than 2 million colors

play21:25

and i'm going to flip back and forth

play21:27

here for a minute

play21:28

but it's pretty hard to tell that i did

play21:31

anything to that picture

play21:33

well what about turning off another bit

play21:36

all right so here i've turned off the

play21:38

last two bits

play21:39

and so now i'm down to 18 bits i have

play21:42

a possibility of 262 different colors

play21:46

now

play21:46

all right but again i think as i go back

play21:49

and forth

play21:51

you're going to see at least i don't i

play21:53

don't

play21:54

notice much of the difference here i've

play21:56

turned off

play21:57

the last three bits so now i'm down to

play22:00

32 000 colors

play22:02

all right and let's go one step further

play22:05

let's go to four

play22:06

and now i've turned off the bottom four

play22:09

bits

play22:09

so now you have 496 different colors

play22:12

that i use

play22:13

and i think you can finally at least i

play22:16

can see it for sure

play22:17

you can start to see some differences in

play22:20

the picture

play22:21

and the easiest place to spot them is

play22:23

look at the shadows on the hobbit door

play22:26

if you look you the the shadow almost

play22:30

seems pixelated at this point

play22:32

and it makes sense if you think about it

play22:35

because i have

play22:36

fewer shades of that door color to work

play22:39

with

play22:40

and so it's going to be harder to for

play22:43

the image to make a smooth

play22:44

transition from the dark color

play22:47

to the light color from the shadow to

play22:49

the light

play22:50

okay and i think i went one step further

play22:53

to kind of push it out one

play22:55

little bit more here i've turned off all

play22:58

the bottom five bits and now you can see

play23:01

is the

play23:01

the effect is really noticeable at this

play23:03

point all right

play23:05

i find it absolutely kind of remarkable

play23:08

that even after turning off five bits

play23:11

in each one of the colored channels in

play23:14

each one of the pixels in this picture

play23:16

you can still see the image it's it it's

play23:19

really kind of remarkable and it shows

play23:21

you

play23:22

how much extra information is actually

play23:24

encoded in those pictures

play23:26

okay so let's get back to steganography

play23:28

now so what can i do

play23:30

well what i want to do is we're computer

play23:33

people

play23:34

so what i want to do is i want to encode

play23:36

my message but i'm going to do it using

play23:38

ascii

play23:39

so here's an ascii table standard ascii

play23:41

table you've probably seen something

play23:43

like this before

play23:44

i remember that ascii is just the

play23:46

character mapping and what it does is it

play23:48

maps

play23:49

characters to numbers so if i want to

play23:51

represent for example a capital a

play23:54

in the computer i do that with a decimal

play23:57

number 65

play23:58

or if i were going to look at in binary

play24:00

it would be 0 1

play24:01

0 0 0 0

play24:05

so what i'm going to do is the way that

play24:07

i'm going to encode my message

play24:10

is i'm going to take just the least

play24:12

significant bit

play24:14

of the red channel of every single

play24:17

pixel to store one bit of an eight bit

play24:20

ascii character

play24:21

so what i'm going to do is i'm going to

play24:23

take that 8-bit representation of the

play24:25

ascii character

play24:27

and i'm going to store it in eight

play24:29

different pixels

play24:31

the most significantly in the first

play24:33

pixel the next bit will be after that

play24:35

and so on down the line

play24:36

okay um the hobbiton picture

play24:40

is rough it's not roughly it is 13 1383

play24:44

pixels high by 1945

play24:46

wide that means there's more than two

play24:49

and a half million pixels in that image

play24:51

which means if i'm going to use eight of

play24:54

these for each ascii character

play24:56

i can store 350 000

play25:00

characters in that message using this

play25:02

scheme that's just using the red channel

play25:05

i could also use the blue and the greek

play25:07

channel if i wanted to

play25:10

so what am i going to stick in there we

play25:12

you can literally stick any text in

play25:14

there that you want but what i thought i

play25:16

would do is pick

play25:17

something that you might recognize and

play25:20

something that has some heft to it and

play25:22

what i did is i searched around

play25:24

online and there's a website called

play25:27

project gutenberg

play25:28

and project gutenberg's been around for

play25:30

a long long time and what

play25:31

they actually do is they they were the

play25:35

first people that i'm aware of that had

play25:37

ebooks in a way

play25:38

what they've done is they've taken many

play25:41

classic

play25:42

books and they've converted them to text

play25:44

form

play25:45

so if you ever want to get the text from

play25:47

a you know a book

play25:49

it's got to be a classic book usually

play25:51

you'll find it on project gutenberg

play25:53

so i went to project gutenberg and i got

play25:55

the entire text of the story alex and

play25:58

alice in wonderland turns out there's

play26:00

166

play26:02

657 characters in that text

play26:06

it'll easily fit in my picture so how am

play26:09

i going to encode it this is just a

play26:11

picture of what i was trying to describe

play26:12

before

play26:13

i'm showing you the first eight um

play26:17

our red values in my hobbiton picture

play26:21

and in the first eight what i want to do

play26:24

is store the a

play26:25

which we saw was zero one zero zero

play26:29

zero zero zero zero one all right and

play26:32

you can see what i've done

play26:33

i'm going to put that most significant

play26:35

bit at the first rgb

play26:37

then the second bit and the next one and

play26:40

so on down the line and what i've done

play26:41

here is i've just shown you

play26:43

the a and the l and if you look at the

play26:46

right hand column

play26:48

that's the modified value that i'm going

play26:51

to write out for

play26:52

that r value and you're going to see

play26:55

that not all of these get

play26:56

changed and that makes sense because

play27:00

it's going to be the case that only

play27:01

about 50 of the time

play27:03

i'm going to need to actually change one

play27:05

of these bits which means it's going to

play27:07

be even

play27:07

harder for you to observe a change in

play27:11

the image

play27:12

from embedding this message inside of it

play27:15

and so

play27:15

you know long story short this picture

play27:19

that you see here

play27:20

looks a lot like the very first picture

play27:22

that i showed you

play27:24

um but you'll just have to take my word

play27:27

for it

play27:28

that what i've done here is this met

play27:30

this particular picture

play27:32

actually has the entire story alice in

play27:35

wonderland

play27:36

encoded in the pixels in the picture in

play27:39

the case you're curious

play27:41

um i needed about um

play27:45

when i take a look at the changes out of

play27:48

all the changes that i made i only

play27:51

changed about

play27:52

half of the pixels in the picture and

play27:54

again

play27:55

that just points out the fact it's a

play27:57

little bit harder to

play27:59

for your eyes to see so really the

play28:02

takeaway that i want you to see here

play28:04

is that a once we have things in a

play28:07

binary form in the computer we can do

play28:08

some pretty cool things with it

play28:10

and b and this is really an important

play28:13

thing that

play28:14

i'm sure you will discuss at some point

play28:16

in your csp class

play28:18

when you see an image on a computer it

play28:20

may not necessarily be real

play28:23

it is very easy to manipulate pictures

play28:26

make them look like something totally

play28:29

different from what they actually are

play28:31

okay and then the last thing i thought i

play28:34

would leave you with

play28:35

is a joke well sort of a joke but

play28:38

this is a nerdy kind of a joke there are

play28:42

one zero types of people in this world

play28:44

those who understand binary

play28:46

and those who don't so now that you're

play28:48

becoming a computer scientist

play28:50

you can now appreciate what the shirt

play28:53

means

play28:54

okay so with that i hope you've enjoyed

play28:57

this

play28:57

presentation i had fun putting it

play29:00

together

play29:01

and i hope you learned something good

play29:02

from it have a great day thanks bye

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
Binary ConversionData RepresentationSteganographyRGB ModelImage ManipulationASCII EncodingProject GutenbergDigital ForensicsComputer ScienceAlice in Wonderland