![]() |
Introduction to Computer Science II Homework 2 |
Assigned: Friday, Sept 5, 2014 Due: Monday, Sept 15, 2014, at 3pm. |
Homework 2Part I: Write an edge detectorWrite 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 computegrad = 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 greyscaleInstead 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 funPlay around with your program to try and create interesting images. Maybe enhance edges. Or combine the edge detection and greyscale values.Part IV: Written HomeworkWhat to hand inCreate 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.GradingEach homework assignment will receive a grade out of 100 points. This week, the available points will be broken down like so:
|