A robot vision routine detects the endpoints of a narrow part and averages their pixel coordinates. That gives the midpoint of the image segment. It does not generally identify the projection of the part's physical midpoint.
The distinction survives in a perfect, distortion-free pinhole camera. If the two endpoints have different depths, perspective changes how distance along the part is represented along its image. Straightness can survive projection while midpoint ratios do not.
This is a geometric interpretation problem rather than a claim about an imperfect detector. The calculations below use invented coordinates and a known ideal camera model. They are not measurements, calibration results, or a method validated on a robot.
Define a camera-centered construction
Let X and Y be coordinates transverse to the viewing direction and let Z be positive depth in front of the projection center. Use an ideal pinhole model with horizontal focal-length parameter f_x in pixels and horizontal principal-point coordinate c_x.
The horizontal image coordinate is u = c_x + f_x X/Z. The vertical coordinate follows the corresponding Y/Z relationship.
OpenCV's Camera Calibration and 3D Reconstruction documentation, version 4.12.0, presents this distortion-free mapping. The author-hosted third-edition pbrt text likewise describes perspective projection through division by depth, contrasting it with orthographic projection. Those sources establish the camera model. The following midpoint example is an independent derivation.
Assume f_x = 800 pixels, c_x = 640 pixels, and vertical principal point c_y = 480 pixels. Both hypothetical scene points have Y = 0, so their projected vertical coordinate is 480 throughout. Image coordinates are continuous geometric values before any raster rounding.
Two endpoints at different depths
Choose endpoint A at (0, 0, 1) meter and endpoint B at (0.6, 0, 3) meters, all expressed in camera coordinates. The two points lie on a straight three-dimensional segment that remains in front of the camera.
Endpoint A projects to u_A = 640 + 800 × 0/1 = 640 pixels.
Endpoint B projects to u_B = 640 + 800 × 0.6/3 = 800 pixels.
Averaging these detected endpoint coordinates gives an image midpoint of (640 + 800)/2 = 720 pixels, with vertical coordinate 480.
Now calculate the physical midpoint first. Its three-dimensional coordinates are M = (0.3, 0, 2) meters. Its projection is u_M = 640 + 800 × 0.3/2 = 760 pixels.
The two results differ by 40 pixels. No distortion, noise, or endpoint-detection error was introduced. The operations “take the physical midpoint” and “project to the image” simply do not commute in this example.
Where the image midpoint actually falls
Parameterize the physical segment by t from zero at A to one at B:
P(t) = (0.6t, 0, 1 + 2t) meters.
Equal increments of t correspond to equal physical distance along this straight segment. The horizontal image coordinate becomes u(t) = 640 + 480t/(1 + 2t).
To find which physical point projects to the image midpoint, set u(t) to 720. Then 480t = 80(1 + 2t), giving t = 0.25.
The image midpoint therefore corresponds to the physical quarter point, P(0.25) = (0.15, 0, 1.5) meters. Substituting into the camera equation gives 720 pixels again.
The true physical halfway point, at t = 0.5, is farther along the projected image segment: its 760-pixel coordinate is three quarters of the image distance from 640 to 800. One segment has two different parameter scales, depending on whether distance is measured before or after projection.
Depth supplies the weighting
There is also a compact way to check the result. For two endpoints with positive depths Z_A and Z_B under the same ideal camera, the physical midpoint projects to:
u_M = (Z_A u_A + Z_B u_B)/(Z_A + Z_B).
This follows by substituting each endpoint's projection into the projection of their averaged three-dimensional coordinates. The principal-point term is preserved because the weights sum to one.
For the example, the result is (1 × 640 + 3 × 800)/4 = 760 pixels. This is a depth-weighted image-coordinate average, not the unweighted average of the two pixels.
The formula requires the endpoint depths. Endpoint pixels alone do not supply them. All scene points on the same viewing ray share an image location in the ideal model, so a pixel coordinate does not uniquely specify a three-dimensional point.
When the two midpoints do agree
If both endpoints have the same positive depth, the common denominator is constant along their segment. Perspective then reduces to an affine mapping on that constant-depth plane, and averaging endpoint pixels does locate the projection of the physical midpoint.
For example, move both hypothetical endpoints to depth 2 meters while retaining their X coordinates of zero and 0.6 meter. They project to 640 and 880 pixels. Their image midpoint is 760 pixels, matching the projection of (0.3, 0, 2).
This special case explains why a midpoint shortcut can appear reliable on a front-facing flat target and change when the same geometry is tilted in depth. It does not establish how much error an unspecified real arrangement would have.
Different geometric corrections answer different questions
Lens undistortion removes modeled departures from the chosen ideal projection. It does not generally remove perspective's depth division. A perfectly undistorted image can still have the 40-pixel midpoint discrepancy derived here.
A known planar geometry can support a plane-specific mapping, while known three-dimensional endpoint coordinates allow the midpoint to be constructed before projection. Those are additional geometric inputs. Enlarging the image or detecting endpoints at finer fractional-pixel coordinates does not supply the missing depth information.
For a robot interpreting a part center, the meaningful definition comes first: center of the visible image segment, center of a physical line segment, and center of an object's shape are different targets. Naming the target and retaining the projection assumptions prevents a correct pixel average from being mistaken for an independently established physical location.
Sources and scope
OpenCV, Camera Calibration and 3D Reconstruction, version 4.12.0:
https://docs.opencv.org/4.12.0/d9/d0c/group__calib3d.html
Physically Based Rendering, author-hosted third-edition online text, 3ed-2018 web edition, Section 6.2, Projective Camera Models:
https://www.pbr-book.org/3ed-2018/Camera_Models/Projective_Camera_Models
Sources checked October 23, 2026. All point coordinates and calculations are hypothetical; no source examples or figures are reproduced.
Illustration note: The site-library concept image shows a robot above metal parts with a blue sensing pattern. It does not show measured endpoint coordinates, a calibrated camera, or validation of this hypothetical geometry.