![]() ![]() |
| |||||||||
| Hotspots: Slides and Code TA Corner Comments? Announcements FAQ Static Webspace | ||||||||||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| I know that there's an error on the line that reads if lum 10: There's something missing. Can you find it? Kelly Lyons |
| Try typing > for a greater-than sign and $amp;lt; for a less-than sign. (See FAQ) Mark Guzdial |
| I'm not sure what you're getting at here. Write out the code of what you're explaining and I could better answer your question. But in general, try it in JES, and if it works in JES, then it works. Kelly Lyons |
| From the book, the lecture slides, and from class. It's just a way of doing a grayscale that is more appropriate to how we actually see than a simple average becuase humans perceive some colors as brighter than others. Kelly Lyons |
| The input is incorrect. Reread the question. Kelly Lyons |
| Please refer to the FAQ on how to edit the swiki to fix this problem. You can also find the information under the help menu. It is in fact not weird at all. Some characters are special and mean things, like an asterisk means create new page, so if you type one, it won't show up on the page unless you tell the swiki to ignore it's specal meaning. The same idea goes for the less than sign Kelly Lyons |
| But how you you know what the luminance is? You never define it. Also, the function is not supposed to take a picture as input. Kelly Lyons |
| No, becuase then it would include all values, becuase 5 is less than or equal to 50 and 55 is greater than or equal to 10 so both will work even though they are not supposed to work. And should be used in these functions Kelly Lyons |
| The above function is wrong since your input is supposed to consist of a red, green and blue value, and not a picture. Therefore you can assume that everything is integers becuase pixels cannot be decimal numbers. Also, you could call the greyScaleNew function, but since your function does not take in a picture and the greyScaleNew function does, it would not work. Kelly Lyons |
def checkLuminance(r,g,b):
newr = r * 0.299
newg = g * 0.587
newb = b * 0.114
lum = newr+newg+newb
if lum < 10:
print 'That is going to be awfully dark'
if lum >= 10 and lum <=50:
print 'A little dark...'
if lum > 50 and lum < 200:
print 'Looks like a good range'
if lum >= 200 and lum < 250:
print 'Getting kinda bright'
if lum >= 250:
print 'thats going to be nearly white'