Using a Webcam
While the Kinect or the Axis camera provides the ability to capture images that can be used for target detection, a webcam (esp. a HD one) can provide some desirable features. For example, a webcam can be much smaller than the Kinect or the Axis and thus mounting it in a strategic place (such as on the end of launching mechanism) can make the math behind the targeting system a lot easier. While using a webcam does require some form of a host, an embedded system (such as the Raspberry PI) can be used to relay the image back to the driver station. Perhaps the best feature of using a webcam is in its ability to zoom in and make the target much larger given a specific image size. For example, the Kinect can use a maximum image size of 1280x1024 but you still have to process that entire image. The previous Axis camera could only go up to 640x480 so you are limited to just that resolution. A HD webcam can exceed these resolutions BUT you would want to keep the image size to 640x480 and use the digital zoom to access the same details at a further distance. This means that the image you capture at 15ft can be as large and as detailed as what you capture at 30ft assuming you have zoomed in.
Note that care must be taken not to assume that a digital zoom will always produce more detail. In many webcams that stop at 640x480 you can still "zoom" in but this is simulated by simply scaling the image within software. In cameras that can produce very high resolutions, this simulated zoom only starts once you have exceeded the possible hardware resolution.
Combining this high resolution with a high powered LED light around the webcam can offer a very competitive solution to the Kinect device.
Accessing a webcam is a native function to RoboRealm. Ensure that the Camera button is pressed in the main RoboRealm GUI and select which camera you want to view by selecting the camera from Options Button->Video Tab->Camera dropdown. You can then set additional properties using the format button, source button, etc. depending on the webcam you are using.
As mentioned before one of the strong capabilities of HD webcams is the ability for them to zoom in from a distance and still retain good quality images. To demonstrate how this can work, access the following robofile (RoboRealm configuration file) and load it into RoboRealm.
- Load and Run the following robofile in RoboRealm.
- Double click on the Camera Properties module and ensure that your HD camera is selected.
- Also ensure that the 640x480 image size is selected.
- Then hold up a green object in front of the camera. If the object does not appear within the image or too many objects appear you may need to edit the RGB Filter module and increase/decrease the hue (color amount) that is being detected.
- If you do not have any green objects. you can also edit the RGB Filter module and switch it to another color using the checkboxes.
- Once detected you can move the object towards and away from the webcam. Note the sudden jump as the image zooms in and out?
The way this works is by increasing or decreasing the camera zoom based on the detected size of the object. If the object appears too large the webcam will zoom out, if it is too small it will zoom in. Test to see how far you can move away before the object becomes too small. Now imagine that the camera did not zoom. How far would you be able to move away in that case?