Support for various different Cameras.
The commercial cameras I am aware of, and whose data sheet I have read, largely work in the same basic manner but have various 'camera specific' options. The cameras I have looked at are Blackfin, AVRcam and CMUcam. Let me know if you are aware of others that are in general use.
For example: they are all driven via a UART (normally at 115,200 baud) and have a concept of a colour bin or colour map. One such entry contains a minimum and maximum colour - ie a colour range. Once these have been sent to the camera then it can then provide 'blob' detection - returning a list of screen rectangles whose contents match these ranges of colours. So if my application wants to hunt for a 'red ball', a 'green ball' and a 'blue ball' then I can initialise three colour bins: one for each coloured ball. I can then receive a list of screen rectangles where these colours can be seen.
Why bother - why not just do the calculations in WebbotLib? Well even at a small camera resolution of say 176 by 144 then it can take 4 seconds to transmit a single image from the camera even at 115,200 baud. So requesting an image frame dump from the camera should only be done either as a last resort or if you are working from a PC say and you want to see a picture of what the camera can see. Obviously transmitting the information about a rectangle (ie top/left and bottom/right corners) is very quick and is independent of the size of the rectangle.
So that covers the basics of what the cameras support. So what about all the other stuff?
This is where it tends to get specific from one camera to the next. For example: some cameras will also provide some of the following:-
- Return the colour of a pixel at X,Y
- Return the average colour for the whole screen
- Return the number of pixels in a user-specified rectangle which match a given colour bin
- Change the camera resolution
- Change between RGB and YUV colours - most cameras only work in one colour space (see Color in this manual - it has routines to allow you to convert from one to the other).
So as a library designer my goal is to provide you with a consistent programming interface that can be used regardless of the actual camera you are using. In the same way as my servo drivers don't change depending on the Make/Model of servo you've got plugged in - then it would also be good if you could swap one camera for another. As with all devices then you can add as many cameras as you need.
Most cameras allow you to re-program their software and so you 'could' write your own WebbotLib functions for a given camera - but this is beyond the scope of the average person and unless you are willing to publish, support and maintain your code then it doesn't benefit the community.
In the meantime: I have tried to keep the supported calls to a minimum. Why? With some of the non-basic calls then some cameras support it directly whereas others don't and so I have to spend ages downloading a screen image and do the calculations myself. So for each camera I have commented which functions will 'run slow'.
Project Designer supports the following devices
- AVRcam Camera
- Support for the AVRcam camera.
- Blackfin Camera
- Support for the Blackfin camera from Surveyor Corporation http://www.surveyor.com/blackfin/