Stroke junction, what's your [error] function? #
Working on stroke extraction. First step is to build up the unsimplified stroke, which has a control point per pixel. This isn't quite that simple, since we want to handle intersecting and forking strokes too. I decided to use an extended "visited" image, where instead of storing a boolean per pixel, we have the total number of times a pixel can be visited (for crossings this can be more than one obviously). Since we're dealing with a thinned image, this is as simple as counting the number of dark to white transitions as the neighbors are walked clockwise, and dividing by two (rounding down). This works almost all the time, with the exception of cases such as:
101
111
101
Here the center "1" has only two such transitions, but it's still at a crossing. The Liu paper (it might be useful after all) attempts to deal with such points (and other similar patterns) by also counting neighbors, so this may be something that's worth looking into when tweaking this further. For the actual walking along a stroke's pixels, we keep track of the direction that we previously went in, and look in that direction first for the next step. This lets us continue through intersections with the same stroke rather than suddenly branch off.
Implemented my error metric. Right now it regularly samples the stroke (number of strokes is based on length), adding up the sum of square differences between the current pixel and the background (so I would in fact try to maximize the value of this function). My regular sampling right now is based on distances between control points, which works OK when all I'm doing is linear interpolation for the actual stroke, but may be error inducing if I switch to Catmull-Rom splines or another interpolation method.
I also got around to trying out my old Nikon CoolPix 990, and it doesn't seem to support the kICAMessageCameraCaptureNewImage
Image Capture framework message either (had also tried a Pentax Optio 550 and a Casio Exilim EX-S2). This article has a list of cameras that should support this functionality (the "Remote Monitor" feature is based on it), but I've yet to track one down.
Post a Comment