User:Nrp/Weekly updates/20080726

From OLPC
< User:Nrp‎ | Weekly updates
Revision as of 00:33, 23 July 2008 by Nrp (talk | contribs)
Jump to navigation Jump to search

Saturday

  • Wrote a function to create a mask of the collisions between two masks.
  • Wrote wrappers for all of the code that was sitting unused in bitmask.c, fill, clear, draw, erase, scale.
  • Fixed a potential flaw in invert and used the same code to make fill faster.

Sunday

  • Changed set_controls to use keywords.
  • Changed get_controls to make way for use of non-boolean controls.
  • Looked at v4l2 spec in preparation for a function to enumerate available controls.
  • Started writing code to get the second moments of a mask, to find its angle.
  • Started working on how to separate v4l2 specific code and allow for other interfaces.

Monday

  • Wrote Mask.angle(), which calculates the zeroth through second moments of a mask to find the approximate orientation of an object with respect to the x axis
  • Wrote Mask.count(), which uses the very fast bitcount() function in bitmask.c to get the total pixels set in the image.
  • Made Mask.centroid() stop returning total pixels set since count() exists. This is an API change that breaks some of the scripts I've written, but its better to do it sooner than never.
  • Fixed a bug in Mask.get_bounding_rects() that made it calculate the width of the rect incorrectly.

Tuesday

  • Made it possible to do an inverse threshold. As in, rather than changing the color of the pixels outside the threshold, change it for those within it. This makes it possible to, for example, do a kind of "green screen" and have a person appear over a virtual background.
  • Had another attempt at threading. It turns out I misunderstood how Python does threading, and the blocking I/O call in get_image() makes the threading slower. I'm going to try releasing GIL on just the blocking call, though this may involve changing much of how the function is structured.