A method for demonstrating a function of a vehicle-mounted heads up display, the method comprising:
- setting a projection region for displaying a first image, wherein the projection region overlaps a virtual display region of the vehicle-mounted heads up display;
- obtaining relative position and relative size relationships between the projection region and the virtual display region;
- projecting the first image in the projection region, the first image comprising one or more objects to be marked in the virtual display region;
- capturing a second image, wherein the second image is an image of the projection region containing the first image;
- generating a virtual recognition region in the second image based on the relative position and relative size relationships;
- determining whether an object in the second image is located within the virtual recognition region, and determining, in a case that the object is located within the virtual recognition region, a first position of the object within the virtual recognition region;
- determining, based on the first position, a display position of a virtual marker representative of the object within the virtual display region;
- and
- displaying the virtual marker at the display position within the virtual display region,
- wherein generating the virtual recognition region in the second image comprises:
- making relative position and relative size relationships between the second image and the virtual recognition region to be the same as the relative position and relative size relationships between the projection region and the virtual display region,
- wherein shapes of the projection region and the virtual display region are rectangles, wherein a bottom edge of the projection region coincides with a bottom edge of the virtual display region, wherein a center of the bottom edge of the projection region coincides with a center of the bottom edge of the virtual display region, and wherein obtaining the relative position and relative size relationships between the projection region and the virtual display region comprises:
- establishing a first coordinate system such that an abscissa axis of the first coordinate system coincides with the bottom edge of the projection region, and an ordinate axis of the first coordinate system passes through the center of the bottom edge of the projection region;
- respectively determining coordinates of a first endpoint and a second endpoint of a top edge of the projection region in the first coordinate system;
- respectively determining coordinates of a third endpoint and a fourth endpoint of a top edge of the virtual display region in the first coordinate system;
- and
- determining a ratio r1 of a length of the top edge of the projection region to a length of the top edge of the virtual display region and a ratio r2 of a length of a side edge of the projection region to a length of a side edge of the virtual display region,
- wherein the coordinates of the third endpoint and the fourth endpoint of the top edge of the virtual display region are as follows:
- XC=−s*tan(α/2),YC=2s*tan(β/2);
- and
- XD=s*tan(α/2),YD=2s*tan(β/2);
- wherein XC and YC respectively represent an abscissa and an ordinate of the third endpoint, XD and YD respectively represent an abscissa and an ordinate of the fourth endpoint, s represents a distance from a view window center of the vehicle-mounted heads up display to the projection region, and α and β respectively represent a horizontal angle of view and a vertical angle of view of the vehicle-mounted heads up display.