Handheld 3D camera
The handheld 3D camera (HHC) is composed of a digital singlelens reflex (DSLR) camera body, lens and grating projection system (GrPS). In our experimental setup, we used a Nikon D90 with a Nikkor 50 mm f/1.8 G AFS lens. The GrPS is composed of an industrial Cmount lens (Computar M2514MP, 25 mm, F1.4, 2/3″), a grating mask and a connection arm (see Figure 1). The builtin camera flash was used as a light source. The grating mask was placed on the back of the holder, between the projector lens and the camera flash. The mask is rectangular in shape, approximately 8.8×6.6 mm in size and composed of a 67stripe Ronchi pattern which was made using a laser micromarking technique (LPKF MarkLine8V).
For acquiring measurements a picture of the measured surface was captured using the camera flash. The mask was illuminated by the camera flash and the generated light pattern was projected onto the surface by the GrPS lens (see Figure 2). The deformed grating pattern is seen on the captured image. For the surface reconstruction, we transferred the images to a personal computer and processed them with developed surface reconstruction software. It is based on the principle of the Fourier transform profilometry method [12, 13], the phase unwrapped by a qualityguided unwrapping algorithm [14] and reconstruction method [15].
The measuring range of the system is 700×520×400 mm at a distance of 2 m. Calibration was done by the reference surface [16]. Ten measurements of the reference surface (plate with semicircular grooves, of which the dimensions are exactly known) were captured across the measuring range and imported into the software for the optimization of the surface reconstruction parameters. These parameters include the focal length of the lens, the rotations of the camera and the projector, the triangulation angle, the angular separation between the light planes, the camera and lens distortion, the camera sensor dimensions and the image center location. The parameters were numerically optimized until the minimum standard deviation of the displacements between the measured and reference surface was found. After the calibration the standard deviation of the displacement was 1.6 mm.
In Figure 3 examples of the three reconstructed surfaces of the same human subject, captured by the presented 3D measuring system are shown. The surface seen in Figure 3a was acquired in the reference position and is later aligned in the coordinate system; measurements in Figure 3b and Figure 3c, are registered following the procedure presented in the next section.
Headtotrunk rotation extraction from 3D measurements
The rotations of the human body and head can be described as rotations in three body planes; the sagittal, coronal and transverse plane (see Figure 4). Because the software can measure only the rotations in the software’s coordinate system, it is essential that the body planes are parallel to the coordinate system planes of the software. The sagittal body plane is found using the mirroring and aligning procedure [17]. We determined the coronal plane assuming that the body’s coronal plane is parallel to the wall the person was leaning on. The wall was measured at the same time as the person and can be seen in Figure 4. The directions of the X, Y and Z axis are also seen in Figure 4. Any translation of the coronal plane in the Z direction and the transverse plane in the Y direction has no effect on the calculated Euler angles.
Hereinafter, the flexion and extension in the sagittal plane (around the X axis) will be noted as the positive and negative φ angle, respectively; the right and left rotation in the transverse plane (around the Y axis) as the positive and negative angles θ, respectively, and the left and right lateral tilt (around the Z axis) as the positive and negative angles ψ, respectively.
Each measured surface was split on the subject’s head surface and the subject’s trunk surface, where only the parts of the head or trunk on which we expected a small degree of deformation during the movement are kept for further analysis. This means that the neck and upper arm parts are excluded from the head and trunk partial measurements to enable a reliable determination of the head orientation. The divided measurements are then aligned to the reference measurement by using the Geomagic Studio software (GMS) [18]. An example of such alignment procedure is shown in Figure 5, where the colours indicate the deviations of the currently analysed body position with respect to the reference measurement (shown in grey).
In this manner we obtained a pair of rotation matrices from the GMS for each measurement. We denoted the matrix of the head rotation R_{
h
} and matrix of the trunk rotation R_{
t
}. Due to the possibility of the person moving between consecutive measurements and the movement of the measuring instrument, we calculated the relative head rotation with respect to the trunk R as:
\mathbf{R}={\mathbf{R}}_{h}\xb7{\mathbf{R}}_{t}^{1}
(1)
Since the matrix R_{
t
} is orthogonal, the inverse operation can be substituted with transposition, to reduce the computational demands.
The Euler angles, which represent the headtotorso orientation, are then calculated by the rotation matrix decomposition technique as follows [19]:
\mathit{\phi}=\text{arctan}\left(\frac{{R}_{2,3}}{{R}_{3,3}}\right)
(2)
\mathit{\theta}=\text{arctan}\left(\frac{{R}_{1,3}}{\sqrt{{R}_{1,2}^{2}+{R}_{1,1}^{2}}}\right)
(3)
\mathit{\psi}=\text{arctan}\left(\frac{{R}_{1,2}}{{R}_{1,1}}\right)
(4)
Invitro verification
The uncertainty of the measuring method was verified by measuring the upper part of a female mannequin with a movable head. An inertial measurement sensor (Xsens 3DOF orientation Tracker, hereinafter referred to as “XOT”, [20]) was attached to the top of the mannequin’s head to perform reference measurements of the head’s orientation. Since the trunk of the mannequin was immovably fixed, the changes in the orientation XOT measured were entirely caused by the head rotation. That is why we can interpret measured head orientation as headtotrunk orientation. Its specified resolution is 0.235° at the acquisition rate of 100 Hz. In addition, simultaneous 3D measurements with a 3D laser scanner (LS) with a higher resolution compared to the HHC (one standard deviation after the calibration was 0.3 mm) were carried out. However, it is important to note, that the LS is inappropriate for invivo measurements, due to the long data acquisition times (about 5 s) and its lesser portability. With the presented experimental setup we evaluated the impact of the apparatus’ resolution on the final–head rotation–precision.
A series of measurements of the fixed mannequin with a moveable head were acquired by all three measuring systems. The orientation of the head was measured in eight positions which imitated the standard positions for the determination of the cervical range of motion. These standard positions are:

1
Neutral head position, where the body planes of the head are parallel to the body planes of the trunk (this is also the reference position).

2
Natural head position, where the head is relaxed; in healthy subjects it should be the same as the reference one. In the case of the mannequin, the position was simulated as a random rotation around all axes.

3
Position of the maximal angle φ (flexion).

4
Position of the minimal angle φ (extension).

5
Position of the maximal angle θ (right rotation).

6
Position of the minimal angle θ (left rotation).

7
Position of the maximal angle ψ (left lateral tilt).

8
Position of the minimal angle ψ (right lateral tilt).
Since the coordinate systems of the utilized measuring instruments (CS_{1} and CS_{2} on Figure 6) are misaligned, the rotation matrix R_{
g
} between CS_{1} and CS_{2} has to be determined in order to measure the rotation angles about the same axes and be able to compare the rotation values obtained by different measuring instruments. If the first instrument measures the rotation of the object as R_{1}, the second as R_{2} and R_{1→2} is the rotation R_{1} transformed to the CS_{2}, the R_{
g
} can be calculated using the following procedure:
First, the rotation matrices are transformed into the axisangle representation [19], where the rotation angle α is:
\mathit{\alpha}=\text{arccos}\left(\frac{{R}_{1,1}+{R}_{2,2}+{R}_{3,3}1}{2}\right)
(5)
The vector k which represents the rotation axis is:
\mathbf{k}=\frac{1}{2sin\mathit{\alpha}}\left[\begin{array}{c}\hfill {R}_{3,2}{R}_{2,3}\hfill \\ \hfill {R}_{1,3}{R}_{3,1}\hfill \\ \hfill {R}_{2,1}{R}_{1,2}\hfill \end{array}\right]
(6)
where R_{i,j} is the element of a rotation matrix in the ith row and the jth column. In this way, we calculate α_{1}, α_{2}, k_{1} and k_{2} from the known rotation matrices R_{1} and R_{2}. Further we calculate the rotation axis k_{
g
} and the angle α_{
g
} between CS_{1} and CS_{2} as follows:
{\mathbf{k}}_{g}=\frac{{\mathbf{k}}_{1}\times {\mathbf{k}}_{2}}{\u01c1{\mathbf{k}}_{1}\times {\mathbf{k}}_{2}\u01c1}
(7)
{\mathit{\alpha}}_{g}=\text{arccos}\left(\frac{{\mathbf{k}}_{1}\xb7{\mathbf{k}}_{2}}{\u01c1{\mathbf{k}}_{1}\u01c1\xb7\u01c1{\mathbf{k}}_{2}\u01c1}\right)
(8)
In general the rotation matrix R from the known angle α and axis k = (k_{1},k_{2},k_{3})^{T} is calculated as:
\mathbf{R}=\left[\begin{array}{ccc}\hfill {k}_{1}^{2}v+cos\left(\mathit{\alpha}\right)\hfill & \hfill {k}_{1}{k}_{2}v{k}_{3}sin\left(\mathit{\alpha}\right)\hfill & \hfill {k}_{1}{k}_{3}v+{k}_{2}sin\left(\mathit{\alpha}\right)\hfill \\ \hfill {k}_{1}{k}_{2}v+{k}_{3}sin\left(\mathit{\alpha}\right)\hfill & \hfill {k}_{2}^{2}v+cos\left(\mathit{\alpha}\right)\hfill & \hfill {k}_{2}{k}_{3}v{k}_{1}sin\left(\mathit{\alpha}\right)\hfill \\ \hfill {k}_{1}{k}_{3}v+{k}_{2}sin\left(\mathit{\alpha}\right)\hfill & \hfill {k}_{2}{k}_{3}v+{k}_{1}sin\left(\mathit{\alpha}\right)\hfill & \hfill {k}_{3}^{2}v+cos\left(\mathit{\alpha}\right)\hfill \end{array}\right]
(9)
where v = 1 − cos(α).
Ideally the angles α_{1} and α_{2} should be the same if both instruments measure the same object movement. But due to the limited measurement uncertainty some variation occurs. Therefore, the measurements were taken in all standard positions and {\mathbf{R}}_{g}^{i} for each ith position was calculated. After that, the average rotation matrix {\overline{\mathbf{R}}}_{g} was calculated by averaging the corresponding Euler angles. So to transform R_{1} to R_{1→2}, we calculate k_{1} and α_{1} as shown in Equations (7) and (8). Vector k_{1→2} and angle α_{1→2} in CS_{2} are then defined as:
{\mathbf{k}}_{1\to 2}={\overline{\mathbf{R}}}_{g}\xb7{\mathbf{k}}_{1}
(10)
{\mathit{\alpha}}_{1\to 2}={\mathit{\alpha}}_{1}
(11)
Once k_{1→2} and α_{1→2} are obtained, we calculate R_{1→2} as shown in the Equation (9). In the case of ideal measuring instruments, R_{1→2} and R_{2} should be exactly the same.
The differences of measured angles between the reference instrument (XOT) and 3D measuring instruments (LS and HHC) were analysed using single factor analysis of variance (ANOVA). The factor was measuring instrument. We analysed the main angles of all standard positions with the exception of the reference one. That results into seven ANOVA analyses between three sets of data. Differences were considered significant at p < 0.05. Bonferroni corrected ttest was used to pairwise analyse the differences XOT vs. LS and XOT vs. HHC. Here, differences were considered significant at p < 0.0250.
Invivo verification
All invivo measurements were performed using the HHC apparatus. The human subject (diagnosed with cervical dystonia, aged 60) was dressed in a white Tshirt and a white headband was used to prevent the hair obstructing the subject’s face and extending the measurable surface. During the measuring procedure, the subject was resting against a wall. He was asked to rotate his head left and right as far as possible. Then he stepped away from the wall, relaxed for one minute and repeated the procedure for 13 times.
The presented research has received approval by the National Medical Ethics Committee of the Republic of Slovenia, which assesses the compliance with the Helsinki Declaration. The approval (No.: 133/04/13) is dated on 8th May 2013.
Invitro vs. invivo comparison
Invitro and invivo comparison was done on the basis of an experiment where the HHC apparatus was used to measure headtotrunk orientation of the mannequin and a healthy male (aged 29), respectively. To assure the repeatable head positioning, a laser projector, firmly attached to the head (in the direction of axis –Z on Figure 4), was used for illuminating the markers on the opposite wall. In the case of rotation and flexion/extension laser beam projector and one marker for each position were used. In the case of lateral tilt we used laser plane projector and two markers for each position, placed on the opposite wall approximately four meters apart. The neutral, moderate left and right rotation, moderate left and right lateral tilt and moderate flexion and extension were measured for 15 times. Only the main angles of each position were considered, since only these angles were monitored using the laser projector. Absolute values of the main angles (θ for left and right position, φ for flexion and extension and ψ for left and right lateral tilt) were summed to eliminate the effect of the mismatch of the laser placements on the both heads. The ranges of the rotation for both subjects were analysed using ANOVA single factor analysis. The factor was measured subject. Differences were considered significant at p < 0.05.