Thursday, October 2, 2014

Computer Science Day 4 - Image Representation

It feels like it's been a while since my last computer science post! The fifth grade team at one of my sites is out at science camp this week, so I'm only doing lessons at one site, and our CS day was today.

We've moving into more advanced topics now! Images, pixels, compression techniques, oh my!

I began this session by correcting student's homework from last time. We reviewed counting in binary and how 0's and 1's could represent letters using a decoder key. This is where the kids seem to be really into binary: seeing how numbers can represent totally different things!

Today I pulled almost exclusively from CS Unplugged's Colour by Numbers: Image Representation lesson. I started the main concept development by displaying a super-zoomed-in JPG of the kids' school mascot. I taught students the word "pixel" (most of them knew it already - as soon as they saw the blocky pixels, they started shouting, "Ohh! That looks like Minecraft!"), and we looked at just how many pixels the projector could display. Students came up to the screen and examined up close to see hundreds of thousands, if not millions, of tiny squares arranged in a grid. I took some quick gut estimates of how many pixels the projector could display, then asked the class to imagine that the number of pixels tripled without the screen ever getting bigger. Many students were able to come to the conclusion that all the pixels would have to be smaller, and the resulting image would be sharper.

At this point, the kids were invested and demonstrating some excellent reasoning. I zoomed out of the picture until they recognized it and connected what just happened to their previous statement regarding image sharpness. Then, I brought it back to binary.

"How could this picture be turned into a bunch of 0's and 1's? What do you imagine that might be like?" I challenged students to come up with some sort of system on their own, then they were able to talk to a student next to them to share guesses. In both classes, students came upon the conclusion that just as 0's and 1's were used in a coding system to represent letters, so too could colors! Then, the computer needs to use some sort of coordinate system to know which pixel should be colored any given color.

Wow. The students came up with this on their own, and I was very impressed. Both classes have some sharp students in them, but these ideas swelled forth from many different kids. Since they pretty much stumbled upon how a graphics card words for raw data, we continued right along by looking at how compression could store the same image using less data.

I used CS Unplugged's OHP Master sheet to display the code for the letter 'a', and again challenged students to figure out the system before telling them how it worked. As before, both classes were able to struggle through and figure out how the system worked with practically no intervention from myself. The one stumbling point in one of the classes was on the line that begins with a black square, and how 0 matched up with it. We worked our way through identifying that the first number always tells you how many WHITE squares there are to begin with, so a line that begins with black starts with 0 whites. I think they were still a bit shaky on this, but students were able to persist and I saw many working correctly on their independent practice. We'll review that portion next time.

Once they figured out how the code worked, I drew a little picture in a grid and let the class work collaboratively to write the code for the picture. Some students worked very quickly, so I challenged them to find a way that uses FEWER instructions, but still results in the same picture. They again struggled, but as a class we discussed how we only need to code in what is DIFFERENT from the starting image (a blank canvas). That meant that lines that ended in white squares didn't require any code - they were no different from how they began.

This was a great entry point to discussing efficiency of code. We talked about how computers animate images, process geometry, and do all sorts of other things that really start to take a toll on their processing speed. The fewer, simpler directions we can give, the better.

Next, students began drawing images from codes on the CS Unplugged Kid Fax sheet. While they were working, I spot-checked students who were a bit careless and pointed struggling students in the right direction.

I also tacked on an extra homework assignment for next session - the "Make Your Own Picture" sheet from CS Unplugged. Taking care of this in between sessions means that next time, we'll trade codes and draw each other's picture, intro algorithms using's Graph Paper Programming, and be ready to start actually programming the session after!

I'm very happy with how things are going so far. A HUGE improvement over the talk-heavy first lesson, as students are working harder, thinking more, and producing work that can actually be evaluated.

I really can't wait to see what these kids come up with for their final programs...
Post a Comment