Monday, December 19, 2011

User Selection

So I finally got user selection working, of a sense.
Brings up a copy of the image at actual size and reads in three selection points. 
However, it does not apply these 3 selection points, but instead only puts the base red on the face. 
Wonderfully enough, it does show the image when called from within maya, although does not automatically exit from the image after hitting enter (as it does when you call it from the command line). As it still lacks any visual feedback this doesn't make it very intuitive. 
It also remains to be seen if it's reading in the selection points properly as it does not print out the positions.

[EDIT]
So issue. The cv window does not show the entire image, only what fits on the rectangular screen. However, the bottom corner still reads as the max height and width of the image. And as the window is supposed to autosize to the image I have no definite ratio to convert the coordinates...

[EDIT 10:45pm]
Got resizing working! Now I have a definite ratio to work with.

[EDIT 10:50pm]
generated by user selection! (not from within maya though, let's check that from maya too!)
note: delighted that the cv display works when called from within maya
however, if you write to a text file from the c++ code that does not work called from maya
(not necessary for this project so that's okay, but just a note)

References:
http://nashruddin.com/eyetracking-track-user-eye.html
http://linuxconfig.org/resize-an-image-with-opencv-cvresize-function

Today's show:
[19 Dec 2011] 3rd Rock from the Sun (Season 1)

Monday, December 12, 2011

Beta Review

Things slowed a little after Beta review as I rushed to catch up on my other school work, but now it's back on track and a race to get everything done by the deadline.
Some finagling with Visual Studio has allowed me to wrap my c++ code in a python module that will run in the windows environment. I now have an option in my maya script that allows you to "exhaust" the texture. Just switches out the textures at this point (no progression), but small steps first.

Goals:
-progression of exhaustion in Maya
-user selection
   .determine if running through python, c++, openCV
   .determine radius based on selection
   note: I have a feeling this will take longer than I want it to, and I may have to decide between continuing this or    
    moving on to other pieces of the project
-Sweating
   .gradient face selection
   .duplication of faces, scaling
   .creation of surface emitter
   .object-particle instancing
   .parenting

[EDIT 13 Dec 2011]
Notes from Beta (comments from Norm and Joe):
-specular based on ambient occlusion (more sweat builds up in creases of the body)
-face drained of color

Sunday, November 27, 2011

Demo Prep

Still don't have the swig code running from cmd or any python code called in a windows environment, so for now I'll just have to call it from cygwin.
-options for creation of many files that have the flush growing (basefile input), or a single image file (basefile input, radius)

Within Maya, open python command line
import shader (will only run once per session, after that Maya stores the code)
to run again reload(shader)
-choose appropriate files (default used if none chosen)
-adjust displacement if desired

Saturday, November 26, 2011

Fun with SWIG

Spent a long while trying to figure out user input from a mouse click. Looked into C++, openCV, and python options, none were working out very well so I've decided to leave that for now. I'll get the system working with text or argument input first.

I've been working and testing the code by just compiling the C++ code, time to make sure I can still swig it into python code. Still worked great just running from the mintty window, but then I tried creating a python file that would call the wrapped code. This proved more difficult that anticipated. In the wrapper commands I was somehow not creating the necessary file for the wrapped code to be treated as an importable module. Lots of googling and reading later I discovered distutils, a python setup file that takes care of all of the necessary flags, files, etc. It builds the file necessary to make an importable module and cuts down on my compilation code as well :
swig -c++ -python example.i
python setup.py build_ext --inplace

sorry no pictures this post :(

[EDIT: 27 Nov 2011]
Well I got a system in maya working that generates a wonderful SSS shader based on user selected images.
Went to build in the flushing generation and even though I got the import working yesterday apparently it only works in a Unix environment. Trying to run through a windows environment I'm back with the same "No module named _example" error...

References:
http://www.swig.org/Doc1.3/Python.html#Python_nn9 (31.2.2 - 31.2.6)


Python GUI References:
http://download.autodesk.com/us/maya/2010help/CommandsPython/textField.html
http://www.rtrowbridge.com/blog/2010/02/maya-python-ui-example/
http://download.autodesk.com/us/maya/2011help/CommandsPython/fileBrowserDialog.html
Good Code to Have: http://mail.python.org/pipermail/python-list/2010-August/1252307.html

Mouse Click Input References:
http://dasl.mem.drexel.edu/~noahKuntz/openCVTut3.html
http://www710.univ-lyon1.fr/~bouakaz/OpenCV-0.9.5/docs/ref/OpenCVRef_Highgui.htm#decl_cvSetMouseCallback
http://www.ida.liu.se/~ETE257/timetable/LecturePythonPygame2.html
GetCursorPos()
http://www.daniweb.com/software-development/cpp/threads/123456
http://www.cplusplus.com/forum/windows/21620/

Wednesday, November 16, 2011

Image Editing (Flush Growth)

No, it is not centered on his face. While testing I merely set the circle's center at pixel 1000,1000 
My next task will be to work on user selection, which will help determine the circle's center point.

[EDIT 18 Nov]

it might be a bit hard to notice at first, but this video shows the red growing in an "O" form, leaving the middle of the circle un-reddened. These un-reddened inner circles will be placed at the user selection points (both eyes and the mouth), so that these areas are not reddened, as can be observed. 

Tuesday, November 1, 2011

Image Editing (pt 2)

With help from Joe Kider, we got swig and openCV up working together nicely.
I'm working on writing the code in C++ using openCV, then using swig to wrap it in python.
Look I can make a red circle!
Now to add falloff..

[EDIT: 9 Nov 2011]
OMG
blended with the texture map to give:
although it's blending the black as well, which is making the texture much darker..

[EDIT: 10 Nov 2011]
OOH YEAHH


and bloopers!