Dec 9 2009

Blender and OpenCV

Hi!

I managed to have some good working interaction between OpenCV and Blender to do face tracking, using a simple webcam, in order to control a camera in the BGE. :D

For those who don’t know what is OpenCV, they will find the answers here. OpenCV is a really powerful library for real-time image processing, so I strongly recommend you people interested in that to have a look at it!

Anyway how does it work this system I developed? There are basically two components:

  • The face tracker
  • The real-time BGE camera tracking

The face tracker gets frames from the webcam and for each frame checks if there are faces in the image using the pattern file “haarcascade_frontalface_alt.xml”, where the shape is defined by a set of coordinates (a lot as you can see yourself if you open the file!) which defines face’s pattern. Beware that multiple faces can be detected, but if you are using my example they won’t work, you must use just one face. Once the bounding box of the face is found, its center and area is calculated. CenterX and CenterY are used to control the camera position on the X and Z axis, while the area is the Y, so the bigger the closer the camera gets to the center of the scene (a cube). In the .blend file the area is not used because I’m still doing some experiments to get the best usage of that value, but you can try it yourself, just play with it. :D

The face tracking works really well in almost every light condition, but I recommend to have a plain light and a good color difference between you and the background. I haven’t made yet any screen recording to show you how it works, if somebody wants to do that in the meanwhile and send me the link of the video, I’ll put it in this post. :D

Note: this example works on Linux/OSX/Windows platforms as long as the webcam is supported by OpenCV. Mine wasn’t so I had to use VideoCapture module for windows. If you are going to run it in OSX/Linux, change the part of code regarding the webcam device initialization and image capture using the OpenCV methods instead of VideoCapture ones and you are ready to go! Basically you just need a PIL image format value that can be passed computed by OpenCV.

You can find both sources and a win32 build that doesn’t need anything installed on your machine, just run it! The python script needs OpenCV installed. Once you install it you will find in the folder a Python26 subfolder with libs and DLLs. Copy them in your Python folder and that’s all, those are the python wrappers for OpenCV.

- Download BlendCV win32 binary

- Download BlendCV sources

Akta


Dec 4 2009

Bathroom project

Hi Blender guys!

I just decided to release under CC license the bathroom I made in Blender for a project I called “Bathroom project” (obvious name, isn’t it? :D )

Appliances and objects in the bathroom include textures and materials, so it’s ready to be used in your own works!

You can use everything is in the .blend file for both commercial and non commercial use, enjoy it!4

Download the .blend file


Dec 1 2009

Blender++ 1.2 released!

Hi!

I’m proud to announce you that Blender++ v. 1.2, the batch renderer for Blender, has been released today! :D

Blender++ 1.2

Blender++ 1.2

If you don’t know what is Blender++, please check it out here!

What is new in Blender++ 1.2:

- Queue support: now you can submit queues to Blender++ in a special .que file format. Check it in the Blender++ folder to see how is it done!

- Command line: you can now use Blender++ without opening the GUI at all! This means that if you can remotely access to your machine (i.e. with Putty) you can just start your renders using the following sintax:

  • queue render: brend95.exe queue_file q 1 t app_folder
  • single frame render: brend95.exe blend_file f frame_number t app_folder
  • animation render: brend95.exe blend_file a start_frame end_frame t app_folder

Where t is number of threads you want to use (remember that Blender uses from 1 to 8 maximum threads) and app_folder is the path to the blender.exe file. Moreover if you are using the OSX or Linux version just change brend95.exe with “python brend95.py”

- Baked data support: fluids and soft-bodies/cloth baked data is rendered as long as it’s pre-baked in Blender before launching Blender++.

- Threads support: you can decide how many threads Blender will use to render your blend file or queue (max. 8)

- Bug fixes

If you find some bug please report it to me and I’ll be happy to help you out providing a patch :D

You can download Blender++ 1.2 from sourceforge.

Akta