551 | | Transforming image to physical coordinates is a key problem for measuring techniques based on imaging. The image coordinates represent the two cartesian axis x,y of the image, with origin at the lower left corner: the y direction is directed upward, while the corresponding image index j increases downward. The physical coordinates are defined from the experimental set-up. The correspondance is obtained by locating on the image a set of calibration points whose positions are known in the physical coordinate system. A cartesian calibration grid covering the whole image is the best option, but any set of calibration points can be used. We handle three kinds of transforms: |
552 | | |
553 | | -''' {'rescale'} ''': linear rescaling along x and y + translation (no rotation nor deformation) |
554 | | |
555 | | -''' {'linear'} ''': general linear transform, including translation and rotation (but no perspective effects) |
556 | | |
557 | | -''' {3D projection:} ''' this transforms handles projection effects, as needed for stereoscopic view, as well as quadratic distortion, according to the pinhole camera model ( R.Y. Tsai, 'An Efficient and Accurate Camera Calibration Technique for 3D Machine Vision'. Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, Miami Beach, FL, pp. 364-374, 1986). We use a more recent version, with the toolbox [->http://www.vision.caltech.edu/bouguetj/calib_doc/] . To use this option, the number of calibration points should be large enough and well spread over the whole image. |
558 | | |
559 | | The transform coefficients for each image series are stored in the corresponding xml documentation file <code><ImaDoc></code>, in the section <code><GeometryCalib></code>. Calibration coefficients can be obtained with the interface '''geometry_calib.fig'''. |
| 551 | Transforming image to physical coordinates is a key problem for measuring techniques based on imaging. |
| 552 | |
| 553 | The ''image coordinates'' represent the two cartesian axis X,Y of the image, with origin at the lower left corner. The coordinate of the first lower left pixel centre is therefore (1/2,1/2). Note that the Y axis is directed upward, while the corresponding image index j increases downward. Therefore, denoting npy the number of pixels along Y, the (X,Y) coordinates of a pixel indexed (i,j) are [[BR]] X=i-1/2, Y=npy-j+1/2. |
| 554 | |
| 555 | The ''physical coordinates'' are defined from the experimental set-up. The correspondance with images is obtained by identifying a set of calibration points whose positions are known in the physical coordinate system. A cartesian calibration grid covering the whole image is the best option, but any set of calibration points can be used. We handle three kinds of transforms: |
| 556 | |
| 557 | -'''rescale''': linear rescaling along x and y + translation (no rotation nor deformation) |
| 558 | |
| 559 | -'''linear''': general linear transform, including translation and rotation (but no perspective effects) |
| 560 | |
| 561 | -'''3D projection:''' this transforms handles projection effects, as needed for stereoscopic view, as well as quadratic distortion, according to the pinhole camera model ( R.Y. Tsai, 'An Efficient and Accurate Camera Calibration Technique for 3D Machine Vision'. Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, Miami Beach, FL, pp. 364-374, 1986). We use a more recent version, with the toolbox [->http://www.vision.caltech.edu/bouguetj/calib_doc/] . To use this option, the number of calibration points should be large enough and well spread over the whole image. |
| 562 | |
| 563 | To deduce the 3D physical coordinates from the 2D image coordinates, the z position, or more generally a plane of cut, defined generally by a laser sheet, must be given as part of the calibration parameters. It is possible to introduce a set of planes obtained by volume scanning. |
| 564 | |
| 565 | The transform coefficients for each image series are stored in the corresponding xml documentation file <!ImaDoc>, in the section <!GeometryCalib>. Calibration coefficients can be obtained with the GUI '''geometry_calib.fig'''. |
572 | | For editing the physical coordinates of a calibration point, select it in the list '''[ListCoord]''', and use the edit boxes '''[XObject]''', '''[YObject]''', '''[ZObject] ''' (for 3D calibration). The image coordinates can be also edited by '''[XImage]''', '''[YImage]''', although they are preferably set directly by the mouse. Type 'return carriage' to validate the edition. The reference point can be suppressed by typing the 'backward' arrow on the key-board, or by filling the five boxes with blank values. |
| 578 | For editing the physical coordinates of a calibration point, select it in the list '''[ListCoord]''', and use the edit boxes '''[XObject]''', '''[YObject]''', '''[ZObject] ''' (for 3D calibration). The image coordinates can be also edited by '''[XImage]''', '''[YImage]''', although they are preferably set directly by the mouse. Type 'return carriage' to validate the edition. The reference point can be suppressed by typing the 'backward' arrow on the key-board, or by filling the five boxes with blank values. |
584 | | Once the list of calibration points has been completed, press '''[APPLY]''', after selecting the appropriate option in '''[calib_type]'''. (see the previous sub-section 7.1). Note that the more advanced Tsai options require a sufficient number of calibration points (typically > 10) spread over the image. Calibration coefficients are recorded in the xml file <code><ImaDoc> </code> associated with the image currently opened by uvmat. If previous calibration data already exist, the previous xml file is updated, but the original one is preserved with the extension .xml~. If no xml file already exists, it is created. The image transformation to phys coordinates can be directly seen on the '''uvmat.fig''' interface after completion of the command '''[APPLY]'''. |
585 | | |
586 | | To reproduce the same calibrationn for image series, open one of the image in the series, and apply again the calibration with the same points, or copy-paste the section GeometryCalib of the xml documentation file with a text editor. |
587 | | |
588 | | Alternatively the command '''[REPLICATE]''' can be used to calibrate a whole set of experiments, using an overview of the data set provided by the GUI '''dataview.fig'''. |
| 590 | Once the list of calibration points has been completed, press '''[APPLY]''', after selecting the appropriate option in '''[calib_type]'''. (see the previous sub-section 7.1). Note that the more advanced Tsai options require a sufficient number of calibration points (typically > 10) spread over the image. Calibration coefficients are recorded in the xml file <code><ImaDoc> </code> associated with the image currently opened by uvmat. If previous calibration data already exist, the previous xml file is updated, but the original one is preserved with the extension .xml~. If no xml file already exists, it is created. The image transformation to phys coordinates can be directly seen on the '''uvmat.fig''' interface after completion of the command '''[APPLY]'''. |
| 591 | |
| 592 | To reproduce the same calibrationn for image series, open one of the image in the series, and apply again the calibration with the same points, or copy-paste the section GeometryCalib of the xml documentation file with a text editor. |
| 593 | |
| 594 | Alternatively the command '''[REPLICATE]''' can be used to calibrate a whole set of experiments, using an overview of the data set provided by the GUI '''dataview.fig'''. |
605 | | * <R>: rotation matrix (in 3 lines). For the option <[https://servforge.legi.grenoble-inp.fr/projects/soft-uvmat/search?q=wiki%3ACalibrationType CalibrationType]>= 'rescale', [[BR]] R (i=1)= [pxcmx 0 0] R (i=2)= [0 pxcmy 0] R (i=3)= [0 0 1], where pxcmx and pxcmy are the scaling factors along x and y. |
606 | | |
607 | | * <omc> 3 components of the rotation vector (this is for diagnostic use, it is redondant with the matrix R used for actual coordiante transforms). The physical coordinate axis are transformed to the image coordinate axis by a composition of the translation T and the rotation) |
| 611 | * <R>: rotation matrix (in 3 lines). For the option <[https://servforge.legi.grenoble-inp.fr/projects/soft-uvmat/search?q=wiki%3ACalibrationType CalibrationType]>= 'rescale', [[BR]] R (i=1)= [pxcmx 0 0] R (i=2)= [0 pxcmy 0] R (i=3)= [0 0 1], [[BR]]where pxcmx and pxcmy are the scaling factors along x and y. |
| 612 | |
| 613 | * <omc> 3 components of the rotation vector (this is for diagnostic use, it is redondant with the matrix R used for actual coordinate transforms). The physical coordinate axis are transformed to the image coordinate axis by a composition of the translation T and the rotation) |
611 | | * <ErrorMax> : maximum difference (in X and Y direction) between the image coordinates measured for the calibration points and the coordinates transformed from their physical coordinates. (using the function UVMAT/px.m) |
612 | | |
613 | | * <SourceCalib> set of the point coordinates used for calibration |
614 | | |
615 | | * <PointCoord> [x y z X Y] , where x,y,z are the physical coordinates of each point, X Y its image coordinates |
616 | | |
617 | | * <NbSlice_i> nbre of slices for the first field index i (multilevel case), =1 by default. |
618 | | |
619 | | * <NbSlice_j> </code>nbre of slices for the second index j (volume scan), =1 by default. |
620 | | |
621 | | * <SliceCoord> [x y z] positions (nb lines) of the nb planes, where nb=NbSlice_i (multilevel case) or nb=NbSlice_j of j indices (volume scan), for parallel volume scan, x=y=0, z= slice height, for angular scan, [x,y,z]=[origin]. |
622 | | |
623 | | * <SliceDZ> step distance between planes, or |
624 | | |
625 | | * <SliceDPhi> step angle for angular scan. |
| 617 | * <ErrorMax> : maximum difference (in X and Y direction) between the image coordinates measured for the calibration points and the coordinates transformed from their physical coordinates. (using the function ''px_XYZ.m'' in uvmat) |
| 618 | |
| 619 | * <SourceCalib> set of the point coordinates used for calibration |
| 620 | |
| 621 | * <PointCoord> [x y z X Y] , where x,y,z are the physical coordinates of each point, X Y its image coordinates |
| 622 | |
| 623 | * <NbSlice_i> nbre of slices for the first field index i (multilevel case), =1 by default. |
| 624 | |
| 625 | * <NbSlice_j> nbre of slices for the second index j (volume scan), =1 by default. |
| 626 | |
| 627 | * <SliceCoord> [x y z] positions (nb lines) of the nb planes, where nb=NbSlice_i (multilevel case) or nb=NbSlice_j of j indices (volume scan), for parallel volume scan, x=y=0, z= slice height, for angular scan, [x,y,z]=[origin]. |
| 628 | |
| 629 | * <SliceDZ> step distance between planes, or |
| 630 | |
| 631 | * <SliceDPhi> step angle for angular scan. |