Start of trail End of trail navigation bar

Table of Contents

Image Get Camera Extrinsics

Get the world coordinates of the camera given object detection information.

Library

QUARC Targets/Image Processing/Generic

Description

Image Get Camera Extrinsics

The Image Get Camera Extrinsics block uses object detection information to determine the world coordinates of the camera. It is typically used with the Image Find Tags block.

Warning

The Image Get Camera Extrinsics block is experimental. The algorithm is likely to change in the future.

The Image Get Camera Extrinsics block uses the camera intrinsics as part of its algorithm. The camera intrinsics matrix is a 3x3 matrix containing the focal lengths and principal point, as well as any skew. It takes the form:

Fx

s

x0

0

Fy

y0

0

0

1

where Fx and Fy are the focal length in pixels in the x and y directions respectively, x0 and y0 are the principal point offsets in pixels, and s is the axis skew. For all the cameras currently supported, the axis skew is zero. The x-direction corresponds to columns measured from the left-edge of the image and the y-direction corresponds to rows measured from the top edge of the image.

The output is a 4x4 homogeneous transformation matrix representing the position and orientation of the camera in world coordinates. The homogeneous transformation takes the form:

R

d

0

1

where R is a 3x3 rotation matrix and d is a translation vector. QUARC has a number of blocks supporting operations on homogeneous transformation matrices of this form. The translations are in the same units as the world coordinates of the object corners.

Input Ports

crn

The corners of each object found. The input may be a variable-size 2x4xN single-precision floating-point matrix, where N is the number of objects found. Otherwise it is a fixed-size matrix where the number of columns is equal to the maximum number of objects that may be found. In this case, page i corresponds to the ith object.

Each 2x4 submatrix defines the coordinates of the four corners of the tag. The corners are always ordered in counter-clockwise order around the tag, starting in the top, left corner of the tag. Each center coordinate is a 2-tuple of the form: (row, column). Row and column indices are zero-based. The values are single-precision floating-point because the calculated corner location may not lie on a pixel boundary.

Alternatively, the input may be a complex 4xN matrix instead. In this case, the real part of each complex number is the row, and the imaginary part is the column.

xform

The homography transformation for each object found. The input may be a variable-size 3x3xN single-precision floating-point matrix, where N is the number of objects found. Otherwise it is a fixed-size matrix where the number of pages is equal to maximum number of objects that may be found. In this case, page i corresponds to the ith object.

Each 3x3 submatrix defines the homography matrix representing the projection from an "ideal" object, with corners (-1,-1), (1,-1), (1,1) and (-1,1), to the pixels in the image. The values are single-precision floating-point.

fnd

An N-vector indicating which objects were actually found so that invalid corners and transforms may be ignored.

intrin

A 3x3 single-precision matrix representing the camera intrinsics, namely the focal lengths and principal point offsets in pixels and any axis skew. See the description above for details. This input is only present if the Source of camera intrinsics parameter is set to External input.

Output Ports

xform

A 4x4 homogeneous transform representing the camera position and orientation in world coordinates.

err

An int32 error code indicating the results of the operation. If the camera coordinates are determined successfully then this output will be zero. Otherwise another negative error code is returned. See Error Codes for the different error codes and their values. Use the Compare to Error block rather than the error code itself to check for specific error codes.

Parameters and Dialog Box

Image Get Camera Extrinsics

Source of camera intrinsics

This option indicates whether the camera intrinsics are specified via a dialog box parameter or an external input port.

Camera intrinsics (tunable offline)

The camera intrinsics as a 3x3 matrix. See the description of the block above for more details. This parameter is only used if the Source of camera intrinsics parameter is Specify via dialog.

World coordinates of object corners (tunable offline)

A 3x3xN or 3x4xN matrix containing the world coordinates of the objects detected. Each 3x3 or 3x4 submatrix represents the world coordinates of three or four corners of the object respectively.

Targets

Target Name

Compatible*

Model Referencing

Comments

QUARC Win32 Target

Yes

Yes

QUARC Win64 Target

Yes

Yes

QUARC Linux Nvidia Target

Yes

Yes

QUARC Linux QBot Platform Target

Yes

Yes

QUARC Linux QCar 2 Target

Yes

Yes

QUARC Linux QDrone 2 Target

Yes

Yes

QUARC Linux Raspberry Pi 3 Target

Yes

Yes

QUARC Linux Raspberry Pi 4 Target

Yes

Yes

QUARC Linux RT ARMv7 Target

Yes

Yes

QUARC Linux x64 Target

Yes

Yes

QUARC Linux DuoVero Target

Yes

Yes

QUARC Linux DuoVero 2016 Target

Yes

Yes

QUARC Linux Verdex Target

Yes

Yes

QUARC QNX x86 Target

Yes

Yes

Last fully supported in QUARC 2018.

Rapid Simulation (RSIM) Target

Yes

Yes

S-Function Target

No

N/A

Old technology. Use model referencing instead.

Normal simulation

Yes

Yes

* Compatible means that the block can be compiled for the target.

 

navigation bar