Some days ago I whined about my problems with C++ and my webcam. After I figured out how to get the raw pixel-data with high speed I started with the interesting things.
I started with a datatype for the color. Since I am able to copy all bytes I recieve from the webcam into a struct of B,G,R (yes, reverse order) I can now use my 3Byte datatype for more tricky operations. I overloaded most of the operators. This is not possible in Flash (AS1,AS2,AS3) which is a shame. Maybe you want to compare RGB(255,0,255) with 0xff00ff. You have to write your own functions etc. in Flash and it is so boring and of course not a very sexy solution. Another example is the data conversion.
Imagine you have a RGB class with 3 components that are from the type uint (AS3) or Number (AS1,AS2). In functions like lineStyle() you need the integer representation 0xRRGGBB. Therefore you have to write a function that puts your r, g and b bytes into this format. The code is simply (r << 16) | (g << 8) | b BUT you have to write lineStyle( color.toInt(), ... ); everytime and it slows the code down.
I am so excited about all the features that C++ offers that I overloaded most of all operators and type casts. ;-) Something like BlendMode.ADD is done by rgb0 + rgb1 etc. This makes coding much more easier.
After I played around with the datatypes and operators I started with filters. Filters are very important for my solution to solve the problem of the object recognition. First of all I do not want to track moving objects. So I need the outline of a not moving object. The hard thing is to remove all the noise (e.g. the background). It is hard to decide wich parts of the picture belong to the object and an outline in the background.
But I started only four days ago with working on this project. There are lots of things that have to be done. What I want to do is to create a polygon of the outline and then use the polygon to check it with a neuronal network. I will try to build the polygon from the outline that I get using different filters.
What you see on the left in the 2nd picture is a combination of blendmodes, convolution filter and binary filter. The third picture is my evil tricky part ;-) It is the outline of objects in motion with different weights. This will be used to get the extract of the picture where the object has been placed. It could also be used for motion vectors (maybe).
So what will be next? I have to buy something that allows me to use USB2.0. My camera is doing 1 FPS. This was also a problem when I did some experiments in Actionscript3. The next steps in developement are creating an extract from the whole picture, calculating a polygon of the outline and then finally using the neuronal network.
This week was a very successful one for me. I found a professor at the
