Skip to main content
. 2018 Jan 16;18(1):248. doi: 10.3390/s18010248
Algorithm 1: Horizontal image correction using the inclinometer.
  1. Rotate the camera coordinate system to the inclinometer coordinate system using the rotation matrix Ric in Equation (1);

  2. Rotate the inclinometer coordinate system to the geodetic coordinate system according to the direction cosine matrix Rgi in Equation (6);

  3. Rotate the geodetic coordinate system to the horizontal camera coordinate system by rotating 90° around the Xg-axis, the rotation matrix Rh can be indicated as
    Rh=[1000cos90sin900sin90cos90]=[100001010]. (7)
  4. According to homography matrix theory in multiple-view geometry [9], the homography matrix H12 between two images can be simplified as
    H12=KR12K1, (8)
    where K is the intrinsic parameter matrix of the camera, which can be expressed as
    K=[fx0cx0fycy001], (9)
    where fx and fy are focal lengths in x and y directions, and cx and cy are principal points.
    R12 is the rotation matrix from image 1 to image 2
    R12=RhRgiRic=RhRz(α)Ri(θ,ϕ)Ric. (10)
    Substitute Equation (10) into Equation (8); the homography matrix H12 can be written as
    H12=KR12K1=KRhRz(α)Ri(θ,ϕ)RicK1. (11)
    Substitute Equations (7) and (9) into Equation (11); we have
    H12=[fx0cx0fycy001][100001010][cosαsinα0sinαcosα0001]Ri(θ,ϕ)RicK1. (12)
     =[fxcosα+cxsinαfxsinα+cxcosα0cysinαcycosαfysinαcosα0]Ri(θ,ϕ)RicK1. (13)

    Finally, the horizontal corrected image can be obtained by multiplying the homography matrix H12 with the original image.