Monday, November 12, 2012

C++ : Sketcher - Part One

New project!

"Given an image, design a program to draw out the image in sketch form similar to how a human would."

Workflow:
  1. Split "superpixels" of the image through edge detection and pattern recognition.
  2. Guess the subject of the image by finding the area with the highest density of "superpixels."
  3. Use machine learning techniques to sketch the image.
Split "superpixels" of the image through edge detection and pattern recognition.

Saxena, Sun, and Ng offers a super-basic rundown of this.  A guy from the IRC had the idea of running the pattern recognition engine alongside the first derivatives of the images instead of the raw image (via Prewitt or I guess perhaps Sobel too).

Imagine finding patterns in, i.e., a black/white checkerboard.  It'd be easier to detect the square pattern through an edge-detector (Roberts, Prewitt, Sobel) since you'd end with a grid of squares, with no distinguishing black or white, while with the raw image you'd have to convince your program that the color of the square is irrelevant.  Same goes for pattern recognition in a field of grass; the important factor isn't the color of the grass, it's the texture - the repetition of grass-shadow-grass-shadow all along the field.

I'm confident this part won't be too much of a problem.  That being said, I'll probably fail here anyways.

Guess the subject of the image by finding the area with the highest density of "superpixels."

The idea behind this is that areas with low density are either blurred (due to camera focus) or background (sky, etc.), and it'll all be grouped into one superpixel via Step 1.  Now, actually sifting the image for highest densities will be a pain.

The most straightforward way is to just split the image into arbitrary squares (say, 64x64) and the square with the highest number of superpixels wins.  Then, process smaller squares in the same fashion within the candidate square, until some threshold or another.  But this suffers from the fault that there's no stopping the subject from being split in half by the grid.  In fact, it's almost certain to happen.

Probably some way to do this via an undirected graph.

Use machine learning techniques to sketch the image.

Supervised learning and neural networks.  Other than that, no fcking clue.

...It'd be really nice to not have college apps/school.  That way I'd actually be able to work on this.

No comments:

Post a Comment