Orbiter-Forum  

Go Back   Orbiter-Forum > Blogs > Izack
Register Blogs Orbinauts List Social Groups FAQ Projects Mark Forums Read

Rate this Entry

Underwhelming Python labs (compsci)

Posted 09-26-2011 at 07:06 PM by Izack
Updated 09-26-2011 at 07:08 PM by Izack

Today I had a 4-hour lab period in which I was expected to write a program that takes an image and makes it grayscale. We work in a watered-down Python environment running in Java (WHY?!).

Obviously it took about 5 minutes to boot the computer, setup the environment and write a paragraph, then submit it:

Code:
def grayScale(redWeight,greenWeight,blueWeight):
  pic=makePicture(pickAFile())
  show(pic)
  for p in getPixels(pic):
    r = getRed(p)*redWeight #0.299
    g = getGreen(p)*greenWeight #0.587
    b = getBlue(p)*blueWeight #0.114
    lum = r+g+b
    setColor(p,makeColor(lum,lum,lum))
  repaint(pic)
This was four steps beyond what was expected, and done in 1/48th of the alotted time. Hopefully the course won't stay so mundane throughout, or I'm in for a very dull semester.
Posted in Uncategorized
Views 1003 Comments 3
« Prev     Main     Next »
Total Comments 3

Comments

  1. Old Comment
    tl8's Avatar
    You are in for a dull semester.

    By the end you will be doing something very similar but 3 times longer
    Posted 09-26-2011 at 09:08 PM by tl8 tl8 is offline
  2. Old Comment
    Urwumpe's Avatar
    Ouch... if you feel underwhelmed, what about doing the output in OpenGL. :D
    Posted 09-26-2011 at 09:12 PM by Urwumpe Urwumpe is offline
  3. Old Comment
    Izack's Avatar
    Wonderful news, tl8. Looking forward to the free time.

    Challenge accepted. Eventually.
    Posted 09-28-2011 at 01:31 PM by Izack Izack is online now
 

All times are GMT. The time now is 10:50 PM.

Quick Links Need Help?


About Us | Rules & Guidelines | TOS Policy | Privacy Policy

Orbiter-Forum is hosted at Orbithangar.com
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright ©2007 - 2012, Orbiter-Forum.com. All rights reserved.