University of Utah School of Computing
EAE 2420:
Introduction to Computer Science II
Homework 2
Assigned: Friday, Sept 5, 2014
Due: Monday, Sept 15, 2014, at 3pm.

Homework 2

Part I: Write an edge detector

Write a program that reads an image file, detects edges in the image and outputs a new image where pixels that are part of an edge are black, other pixels are white. A simple way to tell if a pixel is part of an edge is to compute
grad = abs(im(x+1,y)-im(x-1,y)) + abs(im(x,y+1)-im(x,y-1))

and compare it to a threshold. Sum grad over all the color channels.

Hint: see java.awt.Image, javax.imageio.ImageIO, and java.awt.Color.


Here is an input image.


And the output (using a threshold of 300).

Part II: Map gradient to greyscale

Instead of making a binary decision as in part I, compute the grad values and map them to a greyscale image.


Output (note that I set each pixel to the sqrt of the scaled values to lighten the image).

Part III: Have some fun

Play around with your program to try and create interesting images. Maybe enhance edges. Or combine the edge detection and greyscale values.

Part IV: Written Homework

What to hand in

Create a web page for the assignment. Add a description of your program and some input and output images. Use the CADE online handin system to handin your source code. Please zip and handin your entire project directory. Include in this directory/zipfile an "info.txt" file with your name, your email, your CADE username, and the web address of your web page. If you work in a team only one of you need to submit the source code, but both need to make web pages and the info.txt file should include both your information.

Grading

Each homework assignment will receive a grade out of 100 points. This week, the available points will be broken down like so:
  • 40 points: Edge Detector
  • 10 points: Comments describing the class, each method as well as the interesting pieces of the code itself
  • 10 points: Elegence of programming
  • 10 points: Fun images
  • 10 points: Picture and web page
  • 20 points: Written Homework