Courses‎ > ‎Introduction to Computer Science 1‎ > ‎Konstantinovich‎ > ‎ML1 9/2012‎ > ‎labs‎ > ‎

Lab 10 : Image Processing Program

posted Dec 18, 2012, 6:08 AM by Samuel Konstantinovich   [ updated Dec 18, 2012, 6:08 AM ]
Your goal: To make a image manipulation program

Reminder: A button should call a single function. If your button has more than 1 command in it, you did something wrong! 

Features of the Image Processing Program: 
note: you should choose your image, and adjust your patch size appropriately. No NSFW images, and you want at least a 50x50 screen size.

(each of the numbers 1-6 requires at least a button, some require an input field or slider)
(Warmup 1-3, to make sure you can load images and do basic operations)

1a. Load any file by name. You need a "load file" button, just like yesterday's demo.
1b. You must add a string 'input' box so you can type any file name to load. 

2. A grayscale button that removes color from the patches.

3. A reset button that reverts the patches to the last image loaded. Just like yesterday's demo.

(4-6 is more challenging)

4. A 'make darker' button, that calls a function that reduces the brightness of all patches as follows:
   Any color has its one's digit reduced by half. e.g. A pcolor of 46 becomes 43 (the 6 is cut in half), a pcolor of 95 becomes 92.5 (the 5 is cut in half)

5. A 'color reverse' button that inverts the darkness level of all patches as follows:
  1 becomes 9, 
  2 becomes 8, 
  1.5 becomes 8.5 etc. 
This can be accomplished by looking at the difference between a color's last digit and 5, then subtracting twice that result. 
E.G. 
If the color is 12, 2-5 is -3 , so you subtract twice that from 12. So 12 - 2*(-3) so it becomes 12+ 6 or 18.
If the color is 49, 9-5 is 4, so you subtract twice that from 49. You get 49 - 2 *  (4)   or 49-8 which is 41.
If the color is 0.1, (0.1 - 5) is -4.9 ,    0.5 - 2 * (-4.9) is   0.1 + 9.8, which is 9.9.

6. Create at least one more image filter that you come up with. Name It  "myFilter" , and make a button for it. 
Ideas: use sliders to adjust how much your button works, 
(note: I already gave sample code for some, so you cannot count those)

Comments