View Full Version : CV curve generation from image
datadebaser 04-13-2010, 05:07 AM short of fusing computer vision techniques with maya, I'm trying to generate a CV curve off of a simple black and white image with a single contour cutting across the image, essentially dividing black from white. Conceptually, it seems simple enough of a translation:
contour drawing --> CV curve of a designated level of vertex resolution.
I'm not sure how or if maya can perform basic image analysis, and was wondering if someone here might have some suggestions.
|
|
I'm not a programmer, but I nonetheless have a notion of how you could do this with Maya (MEL).
It basically involves loading the image into a texture, then sampling the image with the colorAtPoint command.
My proposed (theoretical) approach would look something like this:
Divide the image into a virtual grid (for example 16x16 pixels for a square image), indexing each square with increasing IDs from left to right and top to bottom. Sample each grid area with the command mentioned above. If the result contains only one color (i.e. black or white), discard that grid area. If multiple colors are returned, then this grid area represents at least some part of the 'contour'. Store this grid area's index.
After you've analyzed the whole image, you can optionally do a second pass (this time only on the previously stored areas) with a finer grid resolution.
Now all you sort the stored grid areas so they are really indexed in increasing rows and columns from left to right/top to bottom.
The sampling happens in UV space, so for the next step you'll want to translate that into world space (e.g. U = X and V = Y) with an appropriate multiplier so the resulting curve isn't limited to the size of 1 unit (as UV space basically is).
Create a curve object and insert a CV for every grid area that was stored earlier, using the grid areas ID for X (column ID) and Y (row ID) values in worldspace.
Depending on how fine the resolution of your grid was, this should give you a curve that more or less resemble the 'contour', or dividing line, in your image.
Think that would work?
CGTalk Moderation
04-13-2010, 06:15 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.