Wednesday, January 25, 2012

Grades

Dratted grades are due by Thursday at 4pm. I guess on the CentreTerm clock that is a week away, but it is darned short on the real clock. So I will be grading quickly, and feedback will come later. Apologies, but I can;t take time now to send all the feedback...

Monday, January 23, 2012

Presentations day 1

Good job on presentations -- some nice results shared, some interesting ideas brought up.

Sunday, January 22, 2012

A note on grading (yuck)

"yuck" because grading always involves reducing things to numbers - "false quantification" for my money. In general I want to respond to things like your posts on "What Colour are your bits" with words that do not carry an numeric meaning. But then have to assign some number... inverse problem "what quantity are your words?"

I've finally looked at everyone's response to What Colour are your Bits? I was curious to see how you responded. (more below.) I will move on to (planned) paper #2, projects, and presentations. I am going to just assign credit (10 points) if you have a blog post on "non-obviousness" and Silvers patent. My only goal there was to have you thinking about Silvers & Phototmosaics as you worked on the paper.

Thoughts having read your responses to What Colour are your Bits, some being general, some specific to this piece. (Some of these are positives I saw, some negatives. Negatives only get mentioned if I saw them repeatedly, and in the spirit of trying to help you understand expectations; it is an FYS after all.)

  • Read the assignments and remember what you read. The assignment was 40 points. It had two parts: your own response, which I assigned 30 points, and making comments on the posts of two classmates (which I assigned 5 points each, looking only for existence, not quality.) Several of you made no comments. Making comments is part of being in the class, and not making comments throws away points. Look at it either way you want, you get to the same conclusion; you should have made comments.
  • Two of you did something that warns the hearts of faculty members everywhere (and I assigned a couple points extra credit for it, which does not always happen). One person clearly indicated having read the author's link on the Monolith web site. Another found a follow up piece by the same author. (That student has a link on the blog post - if you read your classmate's blog psts you saw it.) Following up, following through, aside from giving you a better experience it indicates to us that you are engaged and independent.
  • Some of you found the piece "long". Our of curiosity I pasted the text into word and set it to 12 point Times Roman. 7 pages, 4420 words. If you think that is long, well, get ready to expand your horizons!
  • Some of you found the piece confusing and said so. Candor ir OK, but "I just did not get it" is not enough. If you don't get it start by reading it again. If you still don't get it then talk to someone. Plenty of your classmates "got it" well enough. If you're not sure if it is OK to discuss a reading with a classmate then ask the faculty member (either if it is OK to discuss or to discuss it with you.) Anything less usually comes across as lazy and disinterested.
  • Sometimes you read something and you think the author is ... an idiot. If you are responding to ideas then that can be fine. If you find the author's writing off-putting that is typically a non-sequitur relative to what you've been asked to do. The exceptions are when you can point out specifically how the writing leads to an important ambiguity for example, or if evaluating the writing is part of the assignment.
  • Summarizing your understanding of what the author said is a good idea. Lots of you did that. What was the piece really, at heart, about. Even if we disagree I can understand the level on which you read the piece and that helps me respond to you. (For my money this piece was about parallel mismatches, one representation mismatch between bits and what they do (and do not) represent, and the other a communications mismatch between groups who understand the first mismatch and groups who do not. "Colour" was a metaphor for abstract properties not represented in bits, and "lawyers" and "computer scientists", while literal on one level, were metaphors for larger groups.)
  • Summarizing your understanding of what the author said is not enough. Go past taht and provide some analysis and/or response to that.
Comments?

Thursday, January 19, 2012

Larger mosaics

Our mosaic effort is more proof of concept  than anything else. Although I do think you can get good results with a single tile image and grayscale, mosaics have to be large enough to see detail in the tiles. Even a 2K pixel image is too small, though it is what we can manage with our screen size. That said, I wanted to do something larger, so I took this 3264x2448 pixel image of my daughter:


and doubled each dimension to make a 5176x3520 grayscale:


Assume that if you wanted to print the image then you would want 300 dots per inch. At these dimensions the image would print 5176/300 --> 17.25 inches x 3520/300 --> 11.7 inches, assuming square pixels.

I grabbed this ( 214x290) as a tile (almost 1x1 at 300 dpi):


and then had some trouble.

The trouble was that JES reported a error from Java running our of heap space. The short explanation is that each program you run is allocated a certain amount of memory it can use. That memory is mostly in an area called the "heap", which allows the program to repurpose the memory. It is possible to tell your computer to give Java (more heap space, but the commands are specific to Java versions and and require administrative access.) Instead I decided to follow this plan:

  1. Break the large target image into 4 quadrants (each as large as the original image)
  2. Make a mosaic of each.
  3. Stitch the mosaics back into one final mosaic.
The advantage with regard to memory is that I'm never making a mosaic larger than the original image, and only one at a time, until I decide to stitch. But "stitching" just uses placeInCanvas().

In the end I got this, with the tiles only 38x61 (about 1/8 x 1/5 inches at 300 dpi). 


Here is the top left quadrant ready to be tiled:



Here is the top left tiled:


The dark line at the right edge is because the tile did not divide the quadrant evenly, so I cropped this down to what it should have been (dropping an entire column of tiles):



Here is the code. The top level function is called Lucy() -- it's a custom script for this problem, but easily adapted to other images.


def lucy():
  tileFile = pickAFile()
  tile = makePicture(tileFile)
  targetFile = pickAFile()
  
  gsFamily( tile, 'Tiles', 1 )
  tile = None
  split( makePicture( targetFile ) )
  for pic in [ 'tl.jpg', 'tr.jpg', 'bl.jpg', 'br.jpg' ]:
    f, target = grabPic( pic )
    gm = grayMap( target, 38, 61 )
    pm = doTiling( 'Tiles',gm, 38, 61 )
    writePictureTo( pm, 'pm'+pic )
  
  
def split( target ):
  w = getWidth(target)
  h = getHeight(target)
  lx1 = 0
  lx2 = w/2 + 1
  rx1 = lx2+1
  rx2 = w
  ty1 = 0
  ty2 = h/2 + 1
  by1 = ty2+1
  by2 = h
  tl = crop( target, lx1, ty1, lx2, ty2 )
  tr = crop( target, rx1, ty1, rx2, ty2)
  bl = crop( target, lx1, by1, lx2, by2)
  br = crop( target, rx1, by1, rx2, by2) 
  writePictureTo( tl, 'tl.jpg' )
  writePictureTo( tr, 'tr.jpg' )
  writePictureTo( bl, 'bl.jpg' )
  writePictureTo( br, 'br.jpg' )
  
  


  
def knit():
  f,p = grabPic('tlcrop.jpg')
  w = getWidth(p)
  h = getHeight(p)
  c = makeCanvas( 2*w, 2*h )
  placeInCanvas(p,c,0,0)
  f,p = grabPic('trcrop.jpg')
  placeInCanvas(p,c,w,0)
  f,p = grabPic( 'blcrop.jpg')
  placeInCanvas(p,c,0,h)
  f,p = grabPic( 'brcrop.jpg')
  placeInCanvas( p,c,w,h)
  writePictureTo(c,'pmknitted.jpg')
  return c

Saturday, January 14, 2012

Updated assignments all over FYS 134, plans & revised plans needed

On moodle I have posted the second paper assignment and a second unplanned assignment that is a warm-up for that paper. The paper is due Saturday, the unplanned assignment Tuesday.

As of this moment 4/12 have project plans, originally due yesterday, extended to about an hour from now, posted. Not all of those are good enough. (See comments.) Because we moved to the blog format for journals, and hence for plans, I'm cutting (some of) you a lot of slack and extending plan due date till tomorrow. This may impede my ability to assess plans in a timely manner but I'm sure we'll be OK. Not to blog ugly, but if the plan is not posted with a timestamp before 5pm tomorrow you've earned a zero on the plan.

Thursday, January 12, 2012

writePictureTo fails, how to fix it

The Symptom is this: you use the native JES writePictureTo or you use our wrapper copyPic so save picture p as file pic.jpg. If you look in your Media Folder then you wil see pic.jpg. If you look closer you will see the file is empty.  This is a known JES problem as documented in the mediacomp repository (where JES lives).

The Problem for us is that all of your account names have a first.last format.

Here is the best Solution I can offer for working on school machines. You only need to do this if you are having the problem. (And on your own machine you can solve this more easily.)


  • Find the setMediaFolder( '...') line in your labcode.py file. Change it to mPath='...'  where the ... is just the path to your media folder. It should be at the top of the file.
  • Open Computer and navigate to C:\USers\Public. Right click and create a new folder JOTMP, where JO is replaced by your own initials.
  • Back in your labcode.py file add the line:  setMediaFolder("C:\\Users\\Public\\JOTMP\\") -- again replacing JO with your own initials. (This should be just below the mpath=.. line
  • Add the line    import os    to your file just below the setMediaFolder line
  • Add the following function just below import os
def doSave(pic, name ):
  writePictureTo(pic,name)
  s = getMediaPath() + name
  try:
    os.rename( s, mPath + name) 
  except Exception, e:
    print e
  • Any time you want to write picture p to file pic.jpg issue the command:  doSave( p, 'pic.jpg')
  • Note, the try/except lines are only there for debugging purposes. The following should work, but if you have an error the message will not be as helpful:
def doSave(pic, name ):
  writePictureTo(pic,name)
  s = getMediaPath() + name
  os.rename( s, mPath + name) 
 


The Down Side is that your media folder is no longer set where you really want it, so file dialogs (pickAFile() will be a bit of a pain.)

How it works: If we can code (and we can) then we can control the machine. JES cannot handle dots in path names. So we write the file into a place we can write that does not have a dot. Public works. However, we do not want to leve our stuff there -- anyone can erase it, see it etc. And we would be polluting the pubic space. So we create a space that looks like ours -- it has our initials -- and we write the file there. But we do not trust ourselves to remember to always copy over to our media folder, so we use jython to move the file for us. If you can program (you can) then you can make the machine do what you want it to.

Tuesday, January 10, 2012

Tell me what this is

Look at these images. The original is the first. The images that follow are all the result of processing by the same (parameterized filter) run on the original image. Tell me: what would you call this filter? How do you think it works? (Reply by posting a comment.)