First, a cv4logo object has to be created, resulting in a new window with an image, which can be shown, and hidden, and it can display images from various sources, for example from the first available camera:
new "oleobject [comname cv4logo name cv] cv'show cv'hide cv'show cv'source "cam 0or it can contain a video:
cv'source "avi "hello.avior static image:
cv'source "file "tomas.jpgwhich can even be downloaded directly from the Internet (if connected):
cv'source "url "|http://www.bioinformatics.uwaterloo.ca/~tvinar/tomas.jpg|If the image is changing meanwhile, we can require that the window will reflect the changes:
cv'source "livefile "tomas.jpgor:
cv'source "liveurl "| http://www.uakom.sk/kamera/jpeg/bbb.jpg|The update rate can be controlled as required:
cv'updaterate 10 ; 10-krát za sekunduThe component is able to detect faces (or other characteristic patterns according to learned description):
The tracking can be turned on or off, and the coordinates of the detected faces can be retrieved by:
cv'tracking "on cv'tracking "off print first parse cv'getfacesIn this way, we could for example control a robot by movements of our face:
cv4logo will track the face position, and according to the changes, we can send movement commands to the robot.
To change a recognition pattern, we can use the following command:
cv'trackingparameters "|haarcascades\haarcascade_upperbody.xml| ; or a different pattern-describing fileIf the image contains a scene with contrasting polygons, for example:
they can be detected using:
print cv'detectpoly "false ; where the detection is controlled by severeal parameters adjustable by: cv'detectpolyparam threshold sensitivity minperimeter maxperimeterwhere threshold determines the boundary between white and black, sensitivity determines the minimum length of side to be taken into account (relative to the size of the polygon), minperimeter and maxperimeter are allowed intervals for the dimensions of the detected polygons.
The image retrieved from usual cameras is often not regular, but distored, that is straight lines are forming curves. In order to use the image for more accurate information about the observed environment (for example for robot localisation, or detecting dimensions in a geometric task), the camera needs to be calibrated:
A set of commands controls the calibration and image clipping using standard algorithms. (see readme.txt for more details)
The current image can be stored to a file or memory, and retrieved and used later. A local image source (for example USB camera) can be made available to other computers on the same network. To turn the image server on, use:
cv'frameserver "onso that any user can connect to the same image, by specifying the IP address of the image server as its image source, for example:
cv'source "remote "192.168.145.146The users can send messages one to another in a client-server mode: Server:
make "servId cv'listen 12345 ; or some other port numberClient:
make "connId cv'connect "192.168.145.62 12345Server:
make "client1 cv'accept :servIdAnd on both sides:
cv'send connection_id message print cv'receive :connIdFor example:
cv'send :client1 "hello cv'send :connId "hiThere! print cv'receive :client1See the ReadMe.txt file for detailed description of Cv4Logo component.