wiki:Tutorial/GeometricCalibration

Version 11 (modified by g7moreau, 7 years ago) (diff)

Name changed from Tutorial: geometric calibration to Tutorial/GeometricCalibration

TracNav(Tutorial/TOC)?

Tutorial / Simple scaling

Open again a test image in 'UVMAT_DEMO01_pair'.(accessible on http://servforge.legi.grenoble-inp.fr/pub/soft-uvmat/)

We shall use the diameter of the half cylinder visible on the upper let of the image to set the calibration. Its physical diameter is 2cm. The corresponding diameter in pixels can be obtained with the ruler displayed by the menu bar Tools/ruler of uvmat.

First zoom on the cylinder to optimize the precison. Select zoom on, press the left mouse button and adjust the field with the directional key board arrows. Then unselect zoom on to allow for other mouse actions (otherwise zoom has priority). It is also useful to increase the contrast at the cylinder edge by setting MaxA to 100 in the frame Scalar (right side of uvmat).

Then select the menu bar Tools/ruler, press the left hand mouse button on the cylinder edge, draw a diameter keeping the mouse pressed, release it on the opposite edge. The length in pixels, 140, is displayed, so the scaling factor is 140/2=70 pixels/cm.

Open the menu bar Tools/geometric calibration. A new GUI geometry_calib appears on the right side. Activate the upper menu bar Tools/Set scale on this GUI and introduce the value 70 in the edit box which pops up, and validate with OK. A set of calibration point coordinates appears in the table [ListCoord] of the GUI.

To see the calibration points on the image, first display the whole image by unselecting fix (tag [CheckFixLimits]) in the frame Coordinates of uvmat. Then press PLOT PTS in geometry_calib.

To perform the calibration, press APPLY, first with the default option 'rescale' in calib_type. The image is now displayed in phys coordinates. A xml file 'images.xml', containing the calibration parameters and reference point coordiantes, has been created in the folder 'UVMAT_DEMO01_pair' (it should be identical with the file 'images.ref.xml' put for reference).

translating the coordinates

The origin of the phys coordiantes is now arbitrary. It is more convenient to have it for instance at the centre of the cylinder, now at (x,y)=(1.69, 4.05).

To get the precise position of the cylindre, it is useful to introduce a projection circle, using in uvmat the menu bar command Projection object/ellipse. In set_object, select ProjMode='none', so that the line is just used as a marker, without projection operation. Set !XMax=1, !YMax=1, the radius of the circle, and the coordinates (1.69, 4.05) of the centre in the table Coord. Then press REFRESH. To optimise the visualisation, zoom in and increase the image contrast to MaxA=100.

To shift the coordinates, activate in geometry_calib the menu bar command Tools/Translate? points, and fills (x=-1.69, y=-4.05) in the edit box which pops up. the phys coordinates of the calibration points are then shifted, and a new calibration put the cylindre centre at the origin (0,0).

Calibration with reference points

An alternative method of calibration consists of using a set of reference points whose physical coordinates are known. Open with uvmat an image in 'UVMAT_DEMO06_PIVconvection/Dalsa1' (accessible on http://servforge.legi.grenoble-inp.fr/pub/soft-uvmat/)

Select in the menu bar Tools/geometric calibration. Mark the four box corners of the box with the mouse (left hand button). Their coordinates in pixels are displayed in the two last column of the table ListCoord in the GUI geometry_calib. To clear the table for corrections push the button CLEAR_PTS, or for a single line, use the key board backward arrow. To improve the position on the image, use the zoom and directional arrows. We find the coordinates of the four calibration points in pixels:

(X,Y)=(80.3, 81.6), (982.3, 86.1), (978.9, 937.4), (71.2, 929.5).

The corresponding physical coordinates are known to be

(x,y)=(0,0),(58.8,0),(58.8,55.1),(0,55.1), with an origin (0,0) taken at the lower left (and z=0).

Introduce those in the two first columns of the table [ListCoord]. This can be conveniently done by copy-paste Matlab vector x=[0 58.8 58.8 0] in the upper line of the x column, and y=[0 0 55.1 55.1] in the y column (use carriage return to validate the input).

To perform the calibration, press APPLY, first with the default option 'rescale' in calib_type. The image is now displayed in phys coordinates. We observe that the rectangular frame is slightly rotated. furthermore the displayed precision, about 3 pixels, is not excellent.

To improve the precision we then apply the option 'linear' in calib_type, which seeks a general linear transform, including rotation. The precision is indeed improved to about 1 pixel. The previous xml file has been saved with a ~, ('Dalsa1.xml~') so it can be reverted in case of error.

Attachments (10)

Download all attachments as: .zip