0% found this document useful (0 votes)
236 views16 pages

SC Corr Table

This document provides instructions for using the sc_corr_table program to edit USC Correction Files (UCF) which compensate for scanhead-specific optical distortions. It describes how to convert correction file formats, adjust the coordinate system orientation, create a new UCF using calibration points, and calculate a new correction file from measured calibration points.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
236 views16 pages

SC Corr Table

This document provides instructions for using the sc_corr_table program to edit USC Correction Files (UCF) which compensate for scanhead-specific optical distortions. It describes how to convert correction file formats, adjust the coordinate system orientation, create a new UCF using calibration points, and calculate a new correction file from measured calibration points.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

sc_corr_table Manual

© 2022 SCAPS GmbH


03.06.2022
sc_corr_table Manual - Contents 2

Table of Contents

1 .........................................................................................................................
Overview 3

2 .........................................................................................................................
Safety 4

3 .........................................................................................................................
Convert correction file 4

4 .........................................................................................................................
Orientation of coordinate system 4

5 .........................................................................................................................
Rotation of correction file 7

6 .........................................................................................................................
Create new UCF by calibration points 7

6.1 Show and delete calibration points


.............................................................................................................. 11
6.2 Options for correction of UCF
.............................................................................................................. 12
7.........................................................................................................................
Calculate correction file 13

7.1 AutoExport
.............................................................................................................. 14
8.........................................................................................................................
UCF File Format 15

8.1 Read and write UCF


.............................................................................................................. 16

© 2022 SCAPS GmbH


sc_corr_table Manual - Overview 3

1 Overview
The program sc_corr_table is used to edit USC SAMLight coordinate [mm]
Correction Files (UCF). These files compensate for scan- X i, SAMLight and Y i, SAMLight
head-specific optical distortions. Since build version
3_6_5_20170411_0052 of SAMLight, sc_corr_table is
included in the installer (<SCAPS>\tools\). SAM optic
sc_corr_table is designed for the following purposes: settings
· Convert (Import/Export) an existing correction file into
*.ucf, the format which is required by SAMLight
Correction file
· Adapt the orientation of the coordinate system for an (*.ucf)
existing correction file
· Create a new correction file or improve an existing
correction file Scanner coordinate [bit]
XY2-100
· Calculate a new correction file

A good correction file adjusts the SAMLight coordinates Scanner and


such that they will be displayed in reality at the desired Optics
position. Thus, measuring accurately the reality
coordinates which map the image defects is critical for
Reality coordinate [mm]
the generation of a good correction file (see table 1).
X i, Measured and Y i, Measured
In the following, the denomination 'calibration points' will
Table 1: Coordinate transformations
be used for the SAMLight and the reality coordinates.

Figure 1: Main window of sc_corr_table.

© 2022 SCAPS GmbH


sc_corr_table Manual - Overview 4

2 Safety
The goods delivered by SCAPS are designed to control a laser scanner system. Laser radiation may effect a
person's health or may otherwise cause damage. Prior to installation and operation compliance with all
relevant laser safety regulations has to be secured. The client shall solely be responsible to strictly comply
with all applicable and relevant safety regulations regarding installation and operation of the system at any
time.
The goods will be delivered without housing. The client shall be solely responsible to strictly comply with all
relevant safety regulations for integration and operation of the goods delivered.

3 Convert correction file


In order to convert other correction files (such as *.xml, *.ctb, *.asc or *.gcd) to UCF, do the following:

· Import the non-UCF correction file in 'sc_corr_table' via File -> Import.
· Select the imported correction file in the View2D or in the entity list.
· Export the correction file via File -> Export into the UCF file format.

In order to convert *.ct5 correction files to UCF format, please first convert *.ct5 correction files to *.ctb
format by CorrectionFileConverter.exe delivereded with SCANLAB RTC 5/6 drivers and then convert
generated *.ctb correction files to UCF as described above.

4 Orientation of coordinate system


The program sc_corr_table can be used to change the orientation of the coordinate system by flipping and
inverting axes. An easy way to check and adjust the current orientation of the axes is by the help of job
<SCAPS>\jobfiles\100mm_Square.sjf and table 2.

Figure 2: Dialog to change the orientation of the coordinate system

It is recommended to un-check all boxes for flipping and inversion of axes in SAMLight -> Settings -> System
-> Optic -> Lens before starting to mark job 100mm_Square.sjf. If any corrections are necessary, they will
then be made in sc_corr_table. Thus, they will be stored directly in the UCF file.
After marking the job 100mm_Square.sjf, it is necessary to check the orientation of the result (in reality). If
the orientation of the text 'Left Top' is not correct (as in the first picture of table 2), use the following pictures
to find out which adjustments are needed. It is important to adjust the orientation directly in sc_corr_table.

· Close SAMLight and start sc_corr_table.


· In sc_corr_table, import the currently applied correction file (*.ucf).
· Find the picture of table 2 which represents your marking result.
· Go to Correction -> Orientation of coordinate system (see figure 2) and set Axes, X Axis and Y Axis as
mentioned in the text directly below the picture representing your marking result (in table 2).
· Select the entity and save the *.ucf overwriting the old correction file (File -> Export).

© 2022 SCAPS GmbH


sc_corr_table Manual - Orientation of coordinate system 5

Axes: normal, X: normal, Y: normal Axes: normal, X: inverted, Y: normal

Axes: normal, X: normal, Y: inverted Axes: normal, X: inverted, Y: inverted

Axes: flipped, X: normal, Y: normal Axes: flipped, X: inverted, Y: normal

© 2022 SCAPS GmbH


sc_corr_table Manual - Orientation of coordinate system 6

Axes: normal, X: normal, Y: normal Axes: normal, X: inverted, Y: normal

Axes: flipped, X: normal, Y: inverted Axes: flipped, X: inverted, Y: inverted


Table 2: Marking results with instructions for correction of orientation

© 2022 SCAPS GmbH


sc_corr_table Manual - Orientation of coordinate system 7

5 Rotation of correction file


To rotate a correction file, import the correction file via File - Import, select the imported file in the entity list
and go to the property page "Dimension" to rotate the correction file according to your needs.

Figure 3: Rotated correction file with dimension property page

A rotation of the correction file reduces the effective field size!

6 Create new UCF by calibration points


A new correction file can be created starting either from the neutral correction file (cor_neutral.ucf) or from
any existing correction file (*.ucf). For both cases, please follow the steps described below. Information on
where to do each step is given in brackets at the end.
For a quick correction of overall symmetric angular or scaling distortions, please refer to Calculate correction
file, but for precise correction of asymmetric distortions, please refer to the following method using calibration
points.

© 2022 SCAPS GmbH


sc_corr_table Manual - Create new UCF by calibration points 8

For purposes of reproducibility, it is recommended to


save all files which are used in the process in a
backup folder. These files are: the settings
(<SCAPS>\system\sc_light_settings.sam), the
original correction file (cor_neutral.ucf, or *.ucf), the
original calibration points (sc_calib_points.txt), the
newly created correction file
(*_YYYYMMDDFit2D#.ucf) and the log file (Postfix:
*_fit_log.txt).Install the latest version of SAMLight,
because most of the code is in the SAM DLLs.
1) If you are using cor_neutral.ucf, create a copy
and rename this copy with a proper name.
2) Go to SAMLight -> Settings -> System -> Optic
(see figure 4)
a. Apply a correction file. This can either be the
your copy of the neutral correction file or any
existing correction file (*.ucf) which should be
improved. Make sure NOT to check the box
'Load lcf if present'.
b. Set X gain and Y gain to ‘1’ and offsets and
rotation to '0'.
c. Set field size (Lens Size) to ‘100’ mm and set
Center X and Center Y to '0'.
Note: This is only a starting field size used to
determine the real field size of the system (see
point 4). Different starting field sizes are possible -
but then don't forget to adapt the job
100mm_Square.sjf.

d. Make sure, all checkboxes for inversion and Figure 4: Neutral optic settings
flip are inactive.

3) Load the job <SCAPS>\jobfiles\100mm_Square.sjf and mark it. (SAMLight)


a. Check if the orientation of 'Left Top' is correct. (reality)
Change the current state of Axes, X axis and Y axis to get the proper orientation of the coordinate
system. (sc_corr_table -> Correction -> Orientation of coordinate system)
Please refer to chapter Orientation of coordinate system for more information.
Mark the job again and check if the orientation is correct now.
Note: Do not use the checkboxes XY Flip, X Invert and Y Invert in SAMLight.
b. Find the side length of the insquare for the marked shape. More specific, find the biggest square
which fits totally into the distorted square, see figure 5. (reality)

Figure 5: Find the side length of the insquare (blue) for the marked shape (red)

4) Set the field size (FS) to the side length of the insquare. (SAMLight -> Settings -> System -> Optic ->
Lens Size)
5) Create a new job file with 11x11 (=121) centered points (X i, SAMLight and Y i, SAMLight) covering the whole
field. (SAMLight)
It is also possible to create and measure less points (for example 9x9, 7x7 or 5x5), but using less than
5x5 points is not recommended. In general, the more calibration points are used, the better will be the

© 2022 SCAPS GmbH


sc_corr_table Manual - Create new UCF by calibration points 9

result.

Figure 6: 11x11 points covering the whole field

An easy way for the creation of the points is the following:


Create a 'Point' entity and position this point to the left bottom of the field. This means, set the X and
Y coordinate to -FS/2. (Dimension Property Page)

Figure 7: Point dimension

To generate the rest of the points, create 11x11 (=121) array copies of this point and set the
increment to FS/10. (EntityInfo Property Page)

Figure 8: Point array copies

6) Mark these points with drill mode. (SAMLight)


Set the drill jump delay to a reasonably high value to ensure the scanner is in the desired position
before each mark.
To avoid temperature drifts, the test marking should be done with the scanner already at working
temperature.
7) Measure the coordinates (X i, Measured and Y i, Measured) of all these marked points. (reality)
It is common to measure the points relative to the center of the scan head (0;0). This is the critical and
time consuming part.
8) Create an ASCII text file, name it 'sc_calib_points.txt' and save it in the folder <SCAPS>\system. (any
text editor)
This text file must be filled with the SAMLight coordinates and the related reality coordinates which you
measured:

X 1, SAMLight Y 1, SAMLight X 1, Measured Y 1, Measured


X 2, SAMLight Y 2, SAMLight X 2, Measured Y 2, Measured
: : : :
X 121, SAMLight Y 121, SAMLight X 121, Measured Y 121, Measured
It is possible to use semi-colon (;) or tab ( ) for the separation of the values. Please just use one
separator between the values. Decimal separators can be comma (,) or point (.). Do not use any
Thousands separator.
Don't forget to save at the end.

© 2022 SCAPS GmbH


sc_corr_table Manual - Create new UCF by calibration points 10

9) Close SAMLight (save your job) and start sc_corr_table.


10) Use Correction -> Show calibration points to display the measured data. For improvement of the fit
result, the function Delete worst point can be used. A detailed description is found in chapter Show
calibration points. (sc_corr_table)
11) Go to Correction -> Correct UCF by calibration points and choose the desired fit order in the drop down
menu of 2D Fit-> Fit Order (Default mode: 3_Advanced). A detailed description is found in chapter
Options for correction of UCF. (sc_corr_table)
12) After clicking 'OK', two correction files are displayed (65x65 grid lines). (sc_corr_table)
The first one is the original correction file (<SCAPS>\usc1\cor_neutral_org.ucf or *.ucf).
The second one is the newly created correction file
(<SCAPS>\usc1\cor_neutral_YYYYMMDDFit2D#.ucf or *_YYYYMMDDFit2D#.ucf). This new UCF is
automatically saved in the same folder as the original correction file.
13) Optional step: Rename the newly created UCF file. (file explorer)
14) Apply the new UCF file in the settings. (SAMLight -> Settings -> System -> Optic)
15) Check with a new marking if the new correction file is good.

© 2022 SCAPS GmbH


sc_corr_table Manual - Create new UCF by calibration points 11

6.1 Show and delete calibration points


With Correction -> Show calibration points, the calibration points stored in
<SCAPS>\system\sc_calib_points.txt are displayed. In more detail, you will see two sets of points, the
SAMLight coordinates (X i, SAMLight,Y i, SAMLight) (in figure 9 in red) and the reality coordinates
(X i, Measured,Y i, Measured) (in figure 9 in green). Each pair of corresponding points (calibration point) is
interconnected with an arrow. When the calibration points are shown, they are already fitted with the default
fit mode (Fit2D 3_Advanced).
In the right top of the main view, detailed fit information is given. Especially, information on the distance
between the fit and the calibration points can be useful (this is not the length of the arrow). Mean and
standard deviation (sigma) of the distribution of these distances are a measure of the quality of the global fit.
The maximal distance (worst) is the largest local difference between fit and calibration point. In the main
view, the corresponding pair of points is highlighted by a circle (see figure 9).
With Correction -> Delete worst calibration point, this worst calibration point (pair of red and green point) is
no longer considered for further fitting (it is labeled with # in sc_calib_points.txt). This can be repeated
several times. To obtain good fit results, it has often proven successful to delete points as long as the ratio of
Worst to Sigma is above three (stop for Worst/Sigma <3).
Show calibration points will change into Hide calibration points and vice versa. When using Correction ->
Correct UCF by calibration points, the points will be hidden automatically and can be displayed again
afterwards manually.

Figure 9: Main view for Show calibration points

© 2022 SCAPS GmbH


sc_corr_table Manual - Create new UCF by calibration points 12

6.2 Options for correction of UCF


With Correction -> Correct UCF by calibration points, the currently used correction file (*.ucf) can be
adjusted by the calibration points stored in <SCAPS>\system\sc_calib_points.txt.
Correct SAMLight modes:

· 2D Fit: Minimizes the sum of squared residuals (distance between the fit and the calibration points). The
more points in sc_calib_points.txt, the better is the compensation of measuring errors.
It is possible to try different fit modes and to compare the results in *_fit_log.txt.
Postfix: _YYYYMMDDFit2D#.ucf
To decide which mode gives the best fitting result, the following information might help:
'Mean' and 'sigma' (standard deviation) are a measure of the quality of the global fit. 'Mean' and 'sigma'
decrease with increasing fit order (1 to 6). This does not directly represents an improvement of the fit. The
'worst' value (maximal distance) is the largest local difference between fit and calibration point. For low fit
orders, usually the 'worst' value will decrease with increasing fit order, which could indicate an
improvement of the global fit. However, the 'worst' value can increase after a certain fit order, which could
indicate that the chosen fit order is too high.
o 2D Fit Basic (1, 2): Recommended for measurements with big errors. Improved compensation of
measurement errors. 1_Basic can only compensate linear (trapezoid) distortions and should not be
used for the neutral correction file (cor_neutral.ucf).
o 2D Fit Advanced (3,4): Recommended for most scenarios. 3_Advanced is the default mode.

o 2D Fit Expert (5, 6): Only recommended for precise measurements which means the measurement
error is really small.
· Legacy modes (not recommended):

o Rotation, Translation, Scale: Rotation, translation and scaling operations are used to minimizes the sum of
squared residuals of all calibration points.
Postfix: _YYYYMMDDRts.ucf

o Inverse Distance Weighting: The position of each UCF grid point is influenced by the nearest calibration points
(the number of influence points can be chosen: #) weighted by their inverse distance. This algorithm tends to
cause unwanted oscillations.
Postfix: _YYYYMMDDIdw#.ucf

o Old algorithm: The UCF grid points will be mapped through a linear interpolation of the 4 enclosing calibration
points. Finding the enclosing calibration points could fail and lead to single UCF grid point distortions.
Postfix: _YYYYMMDDOld.ucf

Command Line Parameter:


'sc_corr_table' can be started using the command line parameter /Settingsfile=<*.sam> to define the
settings file the software is using. The settings file must be stored in the folder <SCAPS>\system\. If
'sc_corr_table' is started without this command line parameter, the default settings file sc_light_settings.sam
is used.
Client Control Interface:
Instead of using sc_corr_table -> Correction -> Correct UCF by calibration points, it is also possible to adjust
the currently used correction file via CCI. You can find a CCI example Correct UCF in the SAMLight manual.
Advanced information:

· sc_calib_points.txt is read when Correction -> Correct UCF by calibration points dialog is opened.
· sc_light_settings.sam is read when the above dialog is left by clicking OK.

© 2022 SCAPS GmbH


sc_corr_table Manual - Create new UCF by calibration points 13

7 Calculate correction file


The program sc_corr_table offers the possibility to calculate basic correction files without the measurement
of calibration points. Such a basic correction file can only compensate for overall symmetric angular or
scaling distortions. For precise correction of asymmetric distortions, please refer to Calculate new UCF by
calibration points.
Go to sc_corr_table -> Correction -> Calculate new UCF (see figure 10).

· XScale and YScale values can be used to equalize


linear distortions in X- and Y-direction (similar to
Gain-X and Gain-Y values in SAMLight).

· XAngle and YAngle describe the opening angle of


the laser.

· XCorrect is a factor for correction in X-direction


depending on the current Y position.

· YCorrect is a factor for correction in Y-direction


depending on the current X position.

· Swap X/Y

· See chapter AutoExport for more information.

Figure 10: Calculate new UCF Dialog

A new correction file is calculated after exiting the dialog (figure 10) with OK. Examples for different values of
XAngle and YAngle are given in figure 11 and figure 12.

Figure 11: XAngle=20, YAngle=20, no Swap X/Y Figure 12: XAngle=30, YAngle=30, Swap X/Y on

To save the new correction file, select the entity in the entity list (on the left of the view) and use File ->
Export. Then, apply the new UCF file in your settings (SAMLight -> Settings -> System -> Optic) and check
the result with a new marking.
If direction of the compensation is wrong, use Swap X/Y in sc_corr_table -> Correction -> Calculate new
UCF. You might need several iterations to optimize the correction file.

© 2022 SCAPS GmbH


sc_corr_table Manual - Calculate correction file 14

7.1 AutoExport
AutoExport offers the possibility to speed up the iterating process of generating and testing the correction
file. By creating and visualizing the correction file nearly simultaneously, a good correction file can be created
relatively fast. To use the AutoExport functionality, the software option SAMLight Client Control Interface is
needed.
1) Start SAMLight and start sc_corr_table
2) Adjust laser and Red Pointer (at the same position) as good as possible using SAMLight -> Settings ->
System -> Laser -> Red Pointer. This is important as for safety reasons AutoExport uses only the Red
Pointer for visualization.
3) Draw a square with the same size as the scan field size in SAMLight (more sophisticated geometries
like adding diagonals to the square, nested squares or just points could also be used).
4) Set the Red Pointer to your preferred speed using Mark -> Start -> Advanced and eventually also
change Red Pointer mode in SAMLight.
5) Open sc_corr_table -> Correction -> Calculate new UCF and activate the checkbox 'AutoExport'. Select
the desired location where to save the new correction file (using Browse...).
6) Press the button 'Start Pointer'. Now, the square should be marked by the Red Pointer.
7) Leave the dialog with 'OK'. The Red Pointer will stop shortly, a new correction file (according to the
parameters inserted) will be generated in the selected folder. Then, the dialog will open again and the
Red Pointer will scan the square using the new correction file. Stopping, generating and starting
procedure should take about 2 seconds.
8) Please check size and geometry of the scanned square using a ruler or another appropriate tool.
If the outline of the scanned square is curved or if the size of the square doesn't fit, please iterate adjusting
the parameters XAngle, YAngle, XScale and YScale (XScale, YScale typically should be 0) until the scanned
square is of the correct size and has straight lines. To stop the Red Pointer, press the button 'Stop Pointer',
deactivate the checkbox 'AutoExport' or leave the dialog with 'Cancel'. At the end of this procedure of course
it is also possible to mark the square or geometry by SAMLight to check the quality of the correction file.
For your information: Before a new correction file is generated and saved, the old one is deleted. At the
same time, path and file name of the newly generated correction file is applied within SAMLight (this can be
verified in Settings -> System -> Optic).

© 2022 SCAPS GmbH


sc_corr_table Manual - Calculate correction file 15

8 UCF File Format


Each Grid Point GP(x,y) keeps 3 unsigned shorts
(range is from 0 to 65535) for the corrected X,Y
and Z values in absolute coordinates.
The X,Y and Z values for each GP(x,y) are
named GP(x,y).X, GP(x,y).Y and GP(x,y).Z.
A neutral correction file is defined by:

· GP(x,y).X = x*1024
· GP(64,y).X = 65535
· GP(x,y).Y= y*1024
· GP(x,64).Y= 65535
· GP(x,y).Z= 32768
The correction map is calculated theoretically or
by a measuring method. The scanner
coordinates are centered in the range [-32768;
+32767].
Figure 13: Correction Point Matrix

A SAMLight coordinate is interpolated linearly by the 4 surrounding GPs of the correction file.
The UCF file is a binary file with the content as described in table 3 (set Version number to 4). The byte
ordering is little-endian.

Order Name Type Default


0 Version Long ( 4 Bytes) 4
1 CP(0,0).X Unsigned short ( 2 Bytes) 0
2 CP(1,0).X Unsigned short ( 2 Bytes) 1024
3 CP(2,0).X Unsigned short ( 2 Bytes) 2048
... ... ... ...
65 CP(64,0).X Unsigned short ( 2 Bytes) 65535
66 CP(0,1).X Unsigned short ( 2 Bytes) 0
... ... ... ...
4225 CP(64,64).X Unsigned short ( 2 Bytes) 65535
4226 CP(0,0).Y Unsigned short ( 2 Bytes) 0
4227 CP(1,0).Y Unsigned short ( 2 Bytes) 0
... ... ... ...
4291 CP(0,1).Y Unsigned short ( 2 Bytes) 1024
4292 CP(1,1).Y Unsigned short ( 2 Bytes) 1024
... ... ... ...
8450 CP(64,64).Y Unsigned short ( 2 Bytes) 65535
8451 CP(0,0).Z Unsigned short ( 2 Bytes) 32768
8452 CP(1,0).Z Unsigned short ( 2 Bytes) 32768
... ... ... ...
12675 CP(64,64).Z Unsigned short ( 2 Bytes) 32768
Table 3: File Format

© 2022 SCAPS GmbH


sc_corr_table Manual - UCF File Format 16

8.1 Read and write UCF


Here is an python example how to read and write a UCF file:

import numpy as np

ucf_dtype = np.dtype(
[
("version", "uint32"), # ucf version, 32-bit unsigned integer
("x", "(65, 65) uint16"), # X data in bit, 65x65 matrix, 16-bit unsigned integer
("y", "(65, 65) uint16"), # Y data in bit, 65x65 matrix, 16-bit unsigned integer
("z", "(65, 65) uint16"), # Z data in bit, 65x65 matrix, 16-bit unsigned integer
]
)

def main():
input_path = r"F:\cor_neutral.ucf"
output_path = r"F:\new_correction_file.ucf"

x, y, z = read_ucf(input_path)
print(f"first point: x = {x[0][0]} bit, y = {y[0][0]} bit, z = {z[0][0]} bit")
write_ucf(output_path, x, y, z)

def read_ucf(input_path):
"""Read UCF file

Args:
input_path (str): Path to UCF file to be read.

Returns:
x: X data in bit, 65x65 matrix
y: Y data in bit, 65x65 matrix
z: Z data in bit, 65x65 matrix

"""
data = np.fromfile(input_path, ucf_dtype)[0]
return data["x"].astype(int), data["y"].astype(int), data["z"].astype(int)

def write_ucf(output_path, x, y, z):


"""Write UCF file

- Check that all elements of the matrix can be represented with 16bit.
- Create UCF data type
- Write UCF to file

Args:
outut_path (str): Path to UCF file to be written.
x: X data in bit, 65x65 matrix
y: Y data in bit, 65x65 matrix
z: Z data in bit, 65x65 matrix

"""
for matrix in (x, y, z):
if np.any(matrix < 0) or np.any(matrix > 65535):
raise OverflowError("Not all matrix elements can be represented as an unsigned short.")

data = np.zeros((1,), dtype=ucf_dtype)


data["version"] = 4
data["x"] = x
data["y"] = y
data["z"] = z

data.tofile(output_path)

if __name__ == "__main__":
main()

© 2022 SCAPS GmbH

You might also like