The algorithm’s initialization involves pre-solving and pre-allocating as many solver parameters as possible before entering the main loop. Pre-allocated parameters include the camera’s intrinsic parameters, the camera matrix, the minimum and maximum depth of field values, the field of view angles, and the minimum required angles of incidence. This is carried out to reduce loop time by having as much prior information as possible instead of having to solve for important parameters inside the loop. The key parameters that are initialized at this stage are the camera object and constraints, the facet of interest objects, and the initial box.
3.1.1. Camera Parameter Initialization
At the heart of the pose synthesis algorithm is the camera from which the poses will be derived. While detailed descriptions of camera models, parameters, and constraint derivations will be explored in greater detail in later sections, at this stage, it is important to know that the camera is defined as an object with the following parameters:
The field of view angles and ;
Available f-stop (aperture) settings;
The focal length components and and image center values and from the camera matrix;
Sensor size and pixel pitch;
Brown–Conrady lens distortion parameters;
Depth of field limits;
The maximum allowable image blur circle diameter, .
Most of these are specifications available directly from camera datasheets (field of view angles, f-stops, focal length, and sensor/pixel dimensions), but others must be solved or derived by the user. For instance, distortion parameters, image center values, and the
x and
y focal lengths must be derived by the user during camera calibration (they are usually used for image distortion correction algorithms, but they also inform the derivation of distortion constraints later on); the maximum blur circle diameter is specified by the user, and depth of field limits must be solved based on available f-stop values. For a detailed description of the camera matrix parameters and their derivations, see [
29].
In order to determine the acceptable distance range for an object to be imaged suitably sharply, the front and rear depth of field limits,
and
, must be evaluated.
Figure 3 expands on
Figure 1 to show the DOF limits and their relationship to
.
Calculating the DOF limits requires knowledge of the hyperfocal distance,
, which represents the distance beyond which any objects will appear equally in focus on the image plane, regardless of their relative positions. It is defined as
We must also determine our maximum allowable blur circle diameter,
, which is defined as
The DOF limits are then calculated [
30] according to Equations (
4) and (
5),
The full acceptable distance interval for the image,
, is then defined in Equation (
6) as
It should be noted that this approach assumes a fixed working distance for a lens, i.e., one that does not have variable focus settings. While this approach is fine in theory, in practice, most lenses have variable focus settings, and as such, it is overly simplistic and must be extended to model a variable-focus lens. Fortunately, the extension is not overly complex. The focus setting on a standard variable-focus lens is typically referred to as the working distance, or what has previously been named . To reiterate, this quantity is the distance at which a point will be perfectly projected onto the image plane with no blur. Most standard focus lenses have working distance settings from some minimum working distance (the smallest distance at which the lens can perfectly project a point onto the image plane), , up to infinity. In practice, though, the maximum setting is the hyperfocal distance. While is a parameter that the user must derive, is defined by the camera/lens manufacturer.
In order to then determine the appropriate interval for a real variable-zoom lens, is calculated for and . The intersection of these two intervals is then taken, and the result is used as the final for the definition of minimum and maximum distance constraints in the solver algorithm. This process is used because it allows for certification of the fact that if all features fall within this interval, there is some zoom setting on the lens that will allow for all features to be imaged with acceptable focus.
It is also important to briefly discuss the effect of
values on DOF intervals. As mentioned previously, the
value defines the relationship between focal length (a fixed quantity) and aperture diameter (a variable quantity). While on most practical lenses, the aperture diameter is technically continuously variable, the control for it is typically indexed to a standard set of values such that the amount of light entering through the lens increases/doubles by a factor of 2 at each setting. As such, it is often sufficient to calculate the discrete
intervals at each standard setting in the lens range as opposed to calculating a continuous set of
intervals. The aperture setting is typically selected based on the lighting conditions of the working environment but also by
limits imposed by working environment geometry, as the
number also affects the available DOF.
Figure 4 demonstrates how changing the aperture diameter changes the DOF for a fixed zoom setting.
By tracing a line from the aperture limits (in green for a narrow aperture and blue for a wide aperture) through the point on the optical axis at
and checking the points at which those lines intersect the nominal FOV frustum (in red), it is possible to see the
interval for the given aperture diameter.
Figure 4 thus demonstrates that a wider aperture setting results in a narrower DOF interval. This must then be taken into consideration along with environmental lighting conditions when selecting an aperture setting for a camera in a given deployment.
In the case where field of view angles are not explicitly included in camera documentation, it is possible to derive them as follows. They are commonly defined as half-angles, referred to as
, where the angle is defined as that between the optical axis and the plane defining the edge of the camera’s view frustum, as in
Figure 5. The full angle would then be the angle between the two frustum bounding planes and is equal to
.
The horizontal (
) and vertical (
) FOV half-angles are calculated based on the camera’s focal length and corresponding sensor dimensions [
31] according to
In these equations,
w and
h represent the sensor width and height in millimetres. Once the FOV angles have been solved, they are used to derive the allowable orientation intervals for box/facet pairs [
11].
The authors would also like to acknowledge that for more complex sensors [
32,
33], more advanced parameter derivations would be required, but these are beyond the current scope of this research. In the case of the basic machine vision optical digital cameras discussed herein, these derivations and those in [
11] are sufficient.