dltEpipolarLine: Finds a epipolar or self-epipolar line

View source: R/dltEpipolarLine.R

dltEpipolarLineR Documentation

Finds a epipolar or self-epipolar line

Description

This function takes a point in one camera view and returns either its epipolar line in another camera view or its epipolar line in that same camera view (self-epipolar line).

Usage

dltEpipolarLine(p, cal.coeff1, cal.coeff2 = NULL, self = FALSE)

Arguments

p

vector of x,y pixel coordinates for a point in an image.

cal.coeff1

DLT calibration coefficients corresponding to the camera view from which p is taken or a two-column matrix of calibration coefficients in which the first column corresonds to the camera view from which p is taken and the second column corresponds to an additional camera view.

cal.coeff2

in the case that cal.coeff1 is a single column matrix, these are the DLT calibration coefficients corresponding to a camera view in a stereo camera setup other than that from which p is taken.

self

a logical indicating whether the epipolar line returned should be a self-epipolar line.

Details

In a stereo camera setup, a point in one camera view must fall somewhere along a line in a second camera view. This line is called its epipolar line. If a second point is taken anywhere along this epipolar line in the second camera and its epipolar line is found in the first camera, the original point must fall along this line. The epipolar line in the first camera view, along which the original point falls, is called its self-epipolar line (Yakutieli et al. 2007). dltEpipolarLine() uses DLT calibration coefficients (see dltCalibrateCameras) to find the epipolar or self-epipolar line for a given point in a stereo camera setup.

Although a stereo camera system may consist of more than two cameras, the coefficients of only two cameras should be input to dltEpipolarLine(). Only the coefficients of the two cameras between which epipolar lines are being calculated are relevant. These two columns of coefficients can be input as one matrix (to cal.coeff1) or as two separate, one-column matrices (to cal.coeff1 and cal.coeff2).

Currently, dltEpipolarLine() only works with the 11-parameter DLT model.

Value

dltEpipolarLine() outputs the resulting epipolar line in two forms: slope-intercept coefficients (m and b) and two points on the line (l1 and l2). These are stored in a list as follows:

m

the slope of the epipolar line.

b

the y-intercept of the epipolar line.

l1

one point on the epipolar line.

l2

a second point on the epipolar line.

Note

This function was modified by A Olsen from the Matlab function partialdlt() written by T Hedrick. A Olsen added the self-epipolar functionality after Yekutieli et al. 2007.

Author(s)

Aaron Olsen

References

Abdel-Aziz, Y.I., Karara, H.M. (1971) Direct linear transformation into object space coordinates in close-range photogrammetry. Proc. Symp. on Close-Range Photogrammetry (University of Illinois at Urbana-Champaign).

Yekutieli, Y., Mitelman, R., Hochner, B. & Flash, T. (2007). Analyzing Octopus Movements Using Three-Dimensional Reconstruction. Journal of Neurophysiology, 98, 1775–1790.

Hedrick, T.L. (2008) Software techniques for two- and three-dimensional kinematic measurements of biological and biomimetic systems. Bioinspiration & Biomimetics, 3 (034001).

For a general overview of DLT: http://kwon3d.com/theory/dlt/dlt.html

See Also

dltCalibrateCameras, dltEpipolarDistance, dltNearestPointOnEpipolar

Examples

## FIND THE FILE DIRECTORY FOR EXTRA R PACKAGE FILES
fdir <- paste0(path.package("StereoMorph"), "/extdata/")

## SET FILE PATH TO CALIBRATION COEFFICIENTS IN TWO CAMERA STEREO SETUP
cc_file <- paste0(fdir, "cal_coeffs.txt")

## LOAD COEFFICIENTS
cal.coeff <- as.matrix(read.table(file=cc_file))

## GET LANDMARKS IN FIRST CAMERA VIEW
lm_file <- paste0(fdir, "lm_2d_a1_v1.txt")

## READ LANDMARKS INTO MATRIX
lm.matrix <- readLandmarksToMatrix(file=lm_file, row.names=1)

## FIND EPIPOLAR LINE IN SECOND CAMERA VIEW
epipolar <- dltEpipolarLine(p=lm.matrix['occipital_condyle', ], cal.coeff1=cal.coeff)

## FIND SELF-EPIPOLAR LINE (IN FIRST CAMERA VIEW)
self_epipolar <- dltEpipolarLine(p=lm.matrix['occipital_condyle', ], cal.coeff1=cal.coeff, 
  self=TRUE)

## CONFIRM THAT DISTANCE FROM ORIGINAL POINT TO SELF-EPIPOLAR LINE IS ZERO
distancePointToLine(p=lm.matrix['occipital_condyle', ], l1=self_epipolar)

StereoMorph documentation built on May 25, 2022, 5:06 p.m.