Create a forward-facing monocular camera sensor mounted on an ego vehicle. Examine an image captured from the camera and determine locations within the image in both vehicle and image coordinates.
Set the intrinsic parameters of the camera. Specify the focal length, the principal point of the image plane, and the output image size. Units are in pixels. Save the intrinsics as a cameraIntrinsics
object.
Specify the position of the camera. Position the camera 2.18 meters above the ground with a 14-degree pitch toward the ground.
Define a monocular camera sensor using the intrinsic camera parameters and the position of the camera. Load an image from the camera.
Determine the image coordinates of a point 10 meters directly in front of the camera. The X-axis points forward from the camera and the Y-axis points to the left.
xyImageLoc1 = 1×2
320.0000 216.2296
Display the point on the image.
Determine the vehicle coordinates of a point that lies on the road surface in the image.
xyVehicleLoc2 = 1×2
6.5959 0.1732
The point is about 6.6 meters in front of the vehicle and about 0.17 meters to the left of the vehicle center.
Display the vehicle coordinates of the point on the image.