The disclosed system includes a robot configured to perform a task on a workpiece. A camera having a field of view is operably connected to the robot. A light system is configured to project structured light onto a region of interest having a smaller area within the field of view. A control system is operably coupled to the robot and the camera is configured to determine a depth of the workpiece relative to a position of the robot using the structured light projected onto the workpiece within the region of interest.