Camera-positioning

revisited 01/02/2002

The Robolab-designers introduced some very powerful multimedia-features in version 2.5. Among others those programs permit strong LEGO-camera functions and picture-analysis.

Robolab is not too friendly in help-files or tutorials, this is the only serious weakness of the software, especially for advanced users. So you have to experience by your own and learn by doing, trying. But this is not too bad for finally getting familiar with LABVIEW on which Robolab is based. So here some useful tips.

The following Labview/Robolab-program Camera_test.vi allows you to count various white blops on a grey background. The camera is initialized, then a grey snapshot is taken, transformed to a binary picture, corrected a bit, inverted. Now the picture is analyzed for blops and shown in an intensity graph. Finally the camera is closed. The program may run continously if the button is activated.

If the blops-analyzer is replaced by the Complex-blops icon, you'll get much more information about the blops. This information is available in the IMAQ ComplexParticle.vi, which is one sub-vi of the complex blops program-part. It is located in the ..\Robolab\Engine\Utilities\Vision\Analysis.llb library. Download camera_test2.vi.

As you can see the information is stored in a 1-dimensional array of a cluster where you find the total area, perimeter, position and s.o. of the single particle. In the example we have the fields 0 .. 6 for 7 particles. This information can easily be extracted by unbundling the clusters. (This will be documented later)

Conclusion : It is quite easily possible to use the LEGO camera (or any other compatible Logitech-camera) for global positioning. 


Here the test of some geometric forms :

Note that the picture has been filtered differently and the graph has been transposed.

triangle, Projection x = 85 = 278-193 ...

square, biggest area

disc


Here now a more serious program for analyzing pictures and sending data to the RCX.

GPS.vi

You need the Msg_to_string.vi

The program checks every second if the area of the blops are within the given ranges. If true, for test reasons the respective y-position is sent to the RCX.

NOTE: There are two special vis which are implemented :

..\Robolab\Engine\Multimedia.llb\Display Blobs.vi

..\Robolab\Engine\Vi.lib\VideoII.llb\Histograph.vi

The program can be tested with :

Message_get_test.vi


We tested GPS.vi on different computers and we found out that for slow computers the image-processing thread will blocate the serial communication. So we changed the program a bit to

GPS3.vi

Here we need some new sub.vis :

set_up_broadcast.vi, close_broadcast.vi and write_broadcast.vi. We added some dummy cluster-terminals, so that the icons can be propperly arranged in the multimedia-series. As Labview is data-flow controlled, we don't need sequence-structures anymore.

There seems to be a problem when loading GPS.vi or GPS3.vi, Robolab doesn't scan the library ..\Robolab\Engine\Multimedia.llb while searching for Display Blobs.vi. You have to do this manually. Better is to change the location to a library which is scanned, for example ..\Robolab\Engine\Vi.lib\VideoII.llb.

With GPS3.vi we may now send the blop-identification-number, the posx and posy of all the blops whose areas are in the user-defined area-ranges. The refresh-time may be set. 

NOTE that GPS.vi and GPS.vi should ONLY be exited by disabling the Continuous-Button !!! Any hardbrake will not close the camera-port correctly.

Test the GPS3.vi with Message_get_test2.vi

The results will be stored in variables 1..3 (4?). The Serial Port Write.vi sends the characters from the serial port buffer, which is not the actual but the previous information. So, after sending and receiving data from one blop (example : ID 1 pos-x 147, pos-y 233), the RCX-containers will have the following values :

Red container (var 0) 4
Blue (1) 232 (from previous package)
Yellow (2) 1  ID
User 3 (3) 147  pos-x
User 4 (4) 233  pos-y

 


RetourMain Page