Herror ::get_line_of_sight (
const HTuple &Row,
const HTuple &Column,
const HTuple &CamParam,
HTuple *PX,
HTuple *PY,
HTuple *PZ,
HTuple *QX,
HTuple *QY,
HTuple *QZ
)
Compute the line of sight corresponding to a point in the image.
::get_line_of_sight computes the line of sight corresponding
to a pixel (Row, Column) in the image plane. The
line of sight is a (straight) line in the camera coordinate system,
which is described by two points
(PX,PY,PZ) and
(QX,QY,QZ) on the line. A pinhole or
telecentric camera model with radial distortions described by the
internal camera parameters CamParam is used (see
::camera_calibration). If a pinhole camera is used, the
second point lies on the focal plane, i.e., the output parameter
QZ is equivalent to the focal length of the camera. The
equation of the line of sight is given by
|X| |Px| |Qx-Px|
|Y| = |Py| + t * |Qy-Py| .
|Z| |Pz| |Qz-Pz|
The advantage of representing the line of sight as two points is
that with this, it is easier to transform the line in 3D. To do so,
all that is necessary is to apply the operator
::affine_trans_point_3d to the two points.
Parameters
Row (input_control)
|
real-array -> HTuple.double
|
|
Row coordinate of the pixel. |
Column (input_control)
|
real-array -> HTuple.double
|
|
Column coordinate of the pixel. |
CamParam (input_control)
|
number-array -> HTuple.double / long
|
|
Internal camera parameters. |
|
Number of elements: 8 |
PX (output_control)
|
real-array -> HTuple.double *
|
|
X coordinate of the first point on the line of sight |
PY (output_control)
|
real-array -> HTuple.double *
|
|
Y coordinate of the first point on the line of sight |
PZ (output_control)
|
real-array -> HTuple.double *
|
|
Z coordinate of the first point on the line of sight |
QX (output_control)
|
real-array -> HTuple.double *
|
|
X coordinate of the second point on the line of sight |
QY (output_control)
|
real-array -> HTuple.double *
|
|
Y coordinate of the second point on the line of sight |
QZ (output_control)
|
real-array -> HTuple.double *
|
|
Z coordinate of the second point on the line of sight |
Example
HTuple CamParam,Row,Column,PX,PY,PZ,QX,QY,QZ;
// get internal camera parameters
::read_cam_par("campar.dat",&CamParam);
// inverse projection
Row[1] = 100;
Row[0] = 50;
Column[1] = 200;
Column[0] = 100;
::get_line_of_sight(Row,Column,CamParam,&PX,&PY,&PZ,&QX,&QY,&QZ);
Result
::get_line_of_sight returns H_MSG_TRUE if all parameter values are
correct. If necessary, an exception handling is raised.
Possible Predecessors
::read_cam_par,
::camera_calibration
Possible Successors
::affine_trans_point_3d
See also
::camera_calibration,
::disp_caltab,
::read_cam_par,
::project_3d_point,
::affine_trans_point_3d
Module
Camera calibration
Copyright © 1996-2002 MVTec Software GmbH