You are on page 1of 4

# How Plot Digitizer’s Calibration Works

Plot Digitizer allows the user to calibrate an image using any three non-collinear points. The calibration is
actually a transformation of the image data between two reference frames. Call the reference frame of the
scanned image the S' frame and the reference frame of the computer monitor the S frame (see Figure 1 below).
To make the transformation completely general, consider the possibility that the scanned image may be rotated
( θ ≠ 0 ) and that the axes of the image may be non-orthogonal ( φ ≠ 90o ) .

## S' frame (scanned image)

y' •P

G
S frame (computer monitor) r'
φ x'
y θ
G
r
G
O

## Figure 1: The reference frames.

G
Now consider some point P. The position of this point in the S' frame is given by the position vector r ' where
G
r ' = x 'iˆ '+ y ' ˆj' . Writing the unit vectors î ' and ĵ' in terms of the S frame we get:

## ˆi ' = cos(θ) ˆi + sin ( θ ) ˆj

ˆj' = cos(φ + θ) ˆi + sin ( φ + θ ) ˆj

G
This allows us to rewrite r ' in terms of the S frame unit vectors. This gives us:
G
r ' = [ x 'cos(θ) + y 'cos(φ + θ) ] ˆi + [ x 'sin(θ) + y 'sin(φ + θ) ] ˆj

G G G G
Notice from Figure 1 that the position of the point P in the S frame is given by r = O + kr ' where O is a vector
pointing to the origin of the S' frame, and k is a scale factor to transform the physical units of the scanned
image to the dimensionless pixels of the computer monitor.

Finally, we can write the equations for transforming the ( x ', y ') image coordinates of the point P to the
( x, y ) coordinates of the computer monitor.
x = O x + kx 'cos(θ) + ky 'cos(φ + θ)
y = O y + kx 'sin(θ) + ky 'sin(φ + θ)

Note that we have 2 equations with 6 unknowns ( O x , O y , cos(θ), cos(φ + θ),sin(θ),sin(φ + θ) ) . To solve for the
6 unknowns, we therefore must calibrate the image by selecting 3 points. This will give us 6 equations and 6
unknowns.

## Writing out all 6 equations we get:

x1 = O x + kx1 'cos(θ) + ky1 'cos(φ + θ)
y1 = O y + kx1 'sin(θ) + ky1 'sin(φ + θ)

x 2 = O x + kx 2 'cos(θ) + ky 2 'cos(φ + θ)
y 2 = O y + kx 2 'sin(θ) + ky 2 'sin(φ + θ)

## x 3 = O x + kx 3 'cos(θ) + ky3 'cos(φ + θ)

y3 = O y + kx 3 'sin(θ) + ky3 'sin(φ + θ)

The points ( x1 ', y1 ') , ( x 2 ', y 2 ') , and ( x 3 ', y3 ' ) are the physical values (entered by the user during the
calibration procedure) of the three calibration points. The points ( x1 , y1 ) , ( x 2 , y 2 ) , and ( x 3 , y3 ) are the pixel
coordinates of the mouse as recorded by the computer when the user clicks the point during the calibration.

To make solving this set of equations a bit less cumbersome, I performed a change of variable:

a = k cos(θ)
b = k cos(φ + θ)
c = Ox
d = k sin(θ)
e = k sin(φ + θ)
f = Oy
This gives:
x1 = x1 'a + y1 'b + c
y1 = x1 'd + y1 'e + f

x 2 = x 2 'a + y 2 ' b + c
y 2 = x 2 'd + y 2 'e + f

x 3 = x 3 'a + y3 ' b + c
y3 = x 3 'd + y3 'e + f
Writing the set of equations as a matrix equation ( Ax = B ) in terms of the redefined variables gives:

⎡ x1 ' y1 ' 1 0 0 0 ⎤ ⎡ a ⎤ ⎡ x1 ⎤
⎢ 0 0 0 x1 ' y1 ' 1 ⎥⎥ ⎢ b ⎥ ⎢⎢ y1 ⎥⎥
⎢ ⎢ ⎥
⎢ x 2 ' y2 ' 1 0 0 0⎥ ⎢ c ⎥ ⎢ x 2 ⎥
⎢ ⎥•⎢ ⎥ = ⎢ ⎥
⎢ 0 0 0 x 2 ' y 2 ' 1 ⎥ ⎢d ⎥ ⎢ y 2 ⎥
⎢ x 3 ' y3 ' 1 0 0 0⎥ ⎢ e ⎥ ⎢ x 3 ⎥
⎢ ⎥ ⎢ ⎥ ⎢ ⎥
⎣⎢ 0 0 0 x 3 ' y3 ' 1 ⎥⎦ ⎣ f ⎦ ⎣⎢ y3 ⎦⎥

## ⎡a ⎤ ⎡ y1 ' x 3 − y1 ' x 2 + y3 ' x 2 − y 2 ' x 3 + y 2 ' x1 − y3 ' x1 ⎤

⎢b⎥ ⎢ − x 1 ' x 3 − x 3 ' x 2 + x 2 ' x 3 + x 3 ' x1 + x1 ' x 2 − x 2 ' x1 ⎥
⎢ ⎥ ⎢ ⎥
⎢ c ⎥ 1 ⎢ y1 ' x 3 ' x 2 − x1 y 2 ' x 3 '− y3 ' x1 ' x 2 + y3 ' x 2 x1 + x 3 y 2 ' x1 '− y1 ' x 2 ' x 3 ⎥
⎢ ⎥= ⎢ ⎥
⎢d ⎥ D ⎢ y3 ' y 2 + y 2 ' y1 + y1 ' y3 − y3 ' y1 − y 2 ' y3 − y1 ' y 2 ⎥
⎢e⎥ ⎢ − x 2 ' y1 + x 2 ' y3 + x 3 ' y1 − y3 x1 '− y 2 x 3 '+ y 2 x1 ' ⎥
⎢ ⎥ ⎢ ⎥
⎣f ⎦ ⎢⎣ − x 2 ' y1 ' y3 + x 2 ' y3 ' y1 − x 3 ' y 2 ' y1 + y3 y 2 ' x1 '− y 2 y3 ' x1 '+ x 3 ' y1 ' y 2 ⎥⎦

where D = − y 2 ' x 3 '+ y 2 ' x1 '− y3 ' x1 '− y1 ' x 2 '+ y 2 ' x 2 '− y1 ' x 3 ' .

The variables a − f are calculated at the end of the calibration procedure when the user clicks the “Calibrate”
button in the calibration pop-up window.

Finally, to get the physical values ( x ', y ') of a clicked point ( x, y ) , I solve the pair of equations

x = x 'a + y 'b + c
y = x 'd + y 'e + f
for ( x ', y ') to get:
a(y − f ) − d(x − c)
y' =
ea − db
x − by '− c
x'=
a

These equations calculate ( x ', y ') as the mouse is moved in the calibrated image and the results are displayed in
the status bar at the bottom of the screen. When the user clicks a point to digitize, the value ( x ', y ') is copied to
the data table.
Although it is not necessary to know the values of φ and θ for Plot Digitizer to work, this information is given
to the user as a tool to assess the quality of the scanned image and its calibration.

## ( a ) and φ = tan ( e b ) − θ . To avoid division by zero errors, I used

From the definitions of a − f , θ = tan −1 d −1

⎛ ⎞ ⎛ ⎞
the trig. identities tan −1 (x) = sin −1 ⎜ x 2 ⎟
and tan −1 (x) = cos −1 ⎜ 1 2 ⎟
to finally get:
⎝ 1+ x ⎠ ⎝ 1+ x ⎠
⎛ ⎞ ⎛ ⎞
θ = sin −1 ⎜ d 2 2 ⎟ and
φ = cos −1 ⎜ b 2 2 ⎟
−θ .
⎝ a +d ⎠ ⎝ e +b ⎠