Azimuth determination method and device, automobile and storage medium
The straight pole and its shadow are identified through the on-board camera, combined with the solar azimuth angle and the car latitude information, and the north and south orientations are determined, which solves the problem of increasing costs of hardware equipment and achieves low-cost azimuth recognition and navigation intuitiveness.
Patent Information
- Application Number
- CN202510471639.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-15
- Publication Date
- 2025-07-29
AI Technical Summary
In existing cars, hardware equipment such as compass or electronic compass can identify the orientation and increase manufacturing costs.
Through the on-board camera image acquisition and processing, the pixel coordinates at the top of the straight rod and its shadow are identified, and combined with the car's latitude information and the sun's azimuth angle, the shadow moves forward and backward at the sun's azimuth angle, and then the north and south azimuth directions are determined.
Accurately identify north-south position information, reduce automobile manufacturing costs, and improve driving navigation intuitiveness and sense of direction.
Smart Images

Figure CN120388069A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of orientation determination, and particularly relates to an orientation determination method and device, an automobile, a storage medium. Background Art
[0002] Currently, hardware devices such as compasses or electronic compasses are often equipped inside automobiles to accurately identify the orientations of east, south, west, and north. However, the improvement of this configuration inevitably increases the manufacturing cost of the automobiles. Summary of the Invention
[0003] One of the purposes of the present invention is to provide an orientation determination method to solve the problem of the increased manufacturing cost of automobiles; the second purpose is to provide an orientation determination device; the third purpose is to provide an automobile; the fourth purpose is to provide a computer-readable storage medium; the fifth purpose is to provide a computer program product.
[0004] To achieve the above purposes, the technical solutions adopted by the present invention are as follows:
[0005] An orientation determination method, the orientation determination method comprising:
[0006] Processing an image collected by an in-vehicle camera to obtain first pixel coordinates of the top of the shadow of a straight rod in the image;
[0007] Obtaining a solar azimuth angle based on the obtained latitude information and current time information of the automobile;
[0008] Based on the first pixel coordinates of the top of the shadow and the solar azimuth angle, obtaining second pixel coordinates after the shadow rotates by the solar azimuth angle;
[0009] Connecting the first pixel coordinates and the second pixel coordinates to determine the due south and due north directions.
[0010] According to the above technical means, by identifying the straight rod and its shadow and analyzing the moving direction of the top of the shadow before and after rotating by the solar azimuth angle, the north-south orientation information can be accurately determined. Using this method to identify the north-south orientation helps to reduce the manufacturing cost of automobiles.
[0011] Further, the obtaining the second pixel coordinates after the shadow rotates by the solar azimuth angle based on the first pixel coordinates of the top of the shadow and the solar azimuth angle includes: obtaining the distance between the straight rod and the in-vehicle camera; based on the conversion relationship between the world coordinate system and the pixel coordinate system and the distance between the straight rod and the in-vehicle camera, converting the first pixel coordinates of the top of the shadow into first world coordinates; based on the conversion relationship and the first world coordinates of the top of the shadow, obtaining the second pixel coordinates after the shadow rotates by the solar azimuth angle.
[0012] Further, obtaining the second pixel coordinates after the shadow rotates by the solar azimuth angle based on the conversion relationship and the first world coordinates of the shadow tip includes: obtaining the second world coordinates after the shadow rotates by the solar azimuth angle based on the solar azimuth angle and the first world coordinates of the shadow tip; and converting the second world coordinates after the shadow rotates by the solar azimuth angle into the second pixel coordinates based on the conversion relationship.
[0013] According to the above technical means, by determining the second pixel coordinates of the tip of the shadow after the shadow rotates by the solar azimuth angle and combining with the first pixel coordinates of the tip before rotation, the moving direction of the tip of the shadow before and after rotating by the solar azimuth angle can be analyzed, and thus the north-south azimuth information can be accurately determined.
[0014] Further, obtaining the second world coordinates after the shadow rotates by the solar azimuth angle based on the solar azimuth angle and the first world coordinates of the shadow tip includes: substituting the solar azimuth angle into a preset rotation matrix to obtain a target rotation matrix; and obtaining the second world coordinates after the shadow rotates by the solar azimuth angle based on the target rotation matrix and the first world coordinates of the shadow tip.
[0015] Further, obtaining the solar azimuth angle based on the obtained latitude information of the vehicle and the current time information includes: determining the solar declination angle based on the date included in the current time information; obtaining the solar altitude angle based on the time point included in the current time information, the solar declination angle, and the latitude information; and obtaining the solar azimuth angle based on the solar declination angle, the solar altitude angle, and the latitude information.
[0016] Further, processing the image collected by the vehicle-mounted camera to obtain the first pixel coordinates of the tip of the shadow of the straight rod in the image includes: using the image collected by the vehicle-mounted camera as the input of a trained target recognition module to obtain the positions of the straight rod and its shadow in the image; extracting the edge information of the straight rod and its shadow using an edge extraction algorithm based on the positions of the straight rod and its shadow in the image; and obtaining the first pixel coordinates of the tip of the shadow of the straight rod based on the edge information of the straight rod and its shadow.
[0017] According to the above technical means, by extracting the edge information of the straight rod and its shadow in the image, the first pixel coordinates of the tip of the shadow of the straight rod can be accurately obtained.
[0018] Further, the step of connecting the first pixel coordinate and the second pixel coordinate to determine the due south and due north directions includes: taking the direction from the first pixel coordinate to the second pixel coordinate as the due north direction; taking the direction from the second pixel coordinate to the first pixel coordinate as the due south direction; the azimuth determination method further includes: displaying the image on a vehicle-mounted terminal, and displaying the due south direction and the due north direction on the image.
[0019] According to the above technical means, by displaying the image on the vehicle-mounted terminal and clearly marking the due south and due north azimuth indicators on the image, the driver can more conveniently identify the north-south direction. This not only improves the intuitiveness of driving navigation but also significantly enhances the driver's sense of direction during driving.
[0020] An azimuth determination device, the azimuth determination device includes:
[0021] A processing unit, configured to process an image collected by a vehicle-mounted camera to obtain the first pixel coordinate of the top of the shadow of the straight rod in the image;
[0022] The processing unit is further configured to obtain the solar azimuth angle based on the obtained latitude information of the vehicle and the current time information;
[0023] A conversion unit, configured to obtain the second pixel coordinate after the shadow rotates by the solar azimuth angle based on the first pixel coordinate of the top of the shadow and the solar azimuth angle;
[0024] The processing unit is further configured to connect the first pixel coordinate and the second pixel coordinate to determine the due south and due north directions.
[0025] A vehicle, the vehicle includes: a processor and a memory configured to store a computer program that can run on the processor, wherein the processor is configured to execute the steps of the foregoing method when running the computer program.
[0026] A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the foregoing method are implemented.
[0027] A computer program product, including a computer program or instruction, and when the computer program or instruction is executed by a processor, the steps of the foregoing method are implemented.
[0028] Advantages of the present invention:
[0029] (1) By identifying the straight rod and its shadow and analyzing the moving direction of the top of the shadow before and after rotating the solar azimuth angle, the present invention can accurately determine the north-south azimuth information; using this method to identify the north-south azimuth helps to reduce the manufacturing cost of the vehicle;
[0030] (2) By displaying the image on the vehicle-mounted terminal and clearly marking the azimuth indicators of true south and true north on the image, the driver can more conveniently identify the north-south direction; this not only improves the intuitiveness of driving navigation but also significantly enhances the driver's sense of direction during driving. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 It is a schematic flow chart of the azimuth determination method in an embodiment of the present invention Figure 1 ;
[0032] Figure 2 It is a schematic flow chart of the azimuth determination method in an embodiment of the present invention Figure 2 ;
[0033] Figure 3 It is a schematic flow chart of the azimuth determination method in an embodiment of the present invention Figure 3 ;
[0034] Figure 4 It is a schematic flow chart of the azimuth determination method in an embodiment of the present invention Figure 4 ;
[0035] Figure 5 It is a schematic flow chart of the azimuth determination method in an embodiment of the present invention Figure 5 ;
[0036] Figure 6 It is a schematic flow chart of the azimuth determination method in an embodiment of the present invention Figure 6 ;
[0037] Figure 7 It is a schematic structural diagram of the composition of the azimuth determination device in an embodiment of the present invention;
[0038] Figure 8 It is a schematic structural diagram of the composition of an automobile in an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0039] In order to more comprehensively understand the features and technical content of the embodiments of the present invention, the implementation of the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings. The accompanying drawings are only for reference and illustration purposes and are not used to limit the embodiments of the present invention.
[0040] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which the present invention belongs. The terms used herein are only for the purpose of describing the present embodiments and are not intended to limit the present invention.
[0041] In the following description, terms such as "some embodiments", "this embodiment", "the present embodiment", and examples are involved, which describe subsets of all possible embodiments. However, it can be understood that "some embodiments" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict.
[0042] If similar descriptions such as "first / second" appear in the application documents, the following explanation shall be added. In the following description, the terms "first / second / third" only distinguish similar objects and do not represent a specific order for the objects. It can be understood that "first / second / third" can be interchanged in a specific order or sequence when allowed, so that the present embodiment described here can be implemented in an order other than that illustrated or described here.
[0043] In this embodiment, the term "and / or" only describes the association relationship of associated objects, indicating that there can be three relationships. For example, object A and / or object B can represent three situations: object A exists alone, object A and object B exist simultaneously, and object B exists alone.
[0044] An embodiment of the present invention provides a method for determining orientation. Figure 1 It is a flowchart illustration of the method for determining orientation in the embodiment of the present invention. Figure 1 , as Figure 1 shown, the method for determining orientation includes the following steps:
[0045] S101: Process the image collected by the in-vehicle camera to obtain the first pixel coordinates of the top of the shadow of the straight rod in the image.
[0046] In the embodiment of the present invention, generally, a front-view camera, a rear-view camera, and a surround-view camera are installed on the vehicle. The surround-view camera includes a left-front camera, a right-front camera, a left-rear camera, and a right-rear camera. The in-vehicle camera here can be any camera on the vehicle.
[0047] Among them, the first pixel coordinates refer to the coordinates of the top of the shadow corresponding to the top of the straight rod in the pixel coordinate system. The pixel coordinate system is a two-dimensional coordinate system with the upper left corner of the image as the coordinate origin and the unit as pixels.
[0048] S102: Based on the obtained latitude information and current time information of the vehicle, obtain the solar azimuth angle.
[0049] Among them, the solar azimuth angle refers to the angle between the projection of the sun's rays on the ground plane and the due north direction.
[0050] Exemplarily, signals from satellites can be received through the in-vehicle GPS navigation system, and then the exact position of the vehicle, including longitude and latitude, can be calculated based on the satellite signals. Alternatively, an independent GPS receiver can be used to obtain the exact longitude and latitude information.
[0051] In the embodiments of the present invention, the current time information includes date and time point. The time point can be Universal Time Coordinated (UTC), or it can be the local time point. If it is the local time point, the corresponding UTC can be obtained according to the time difference between the local time point and UTC.
[0052] S103: Based on the first pixel coordinates of the shadow tip and the solar azimuth angle, obtain the second pixel coordinates after the shadow rotates by the solar azimuth angle.
[0053] Here, first convert the first pixel coordinates of the shadow tip into the first world coordinates, then based on the conversion of the first world coordinates, obtain the second world coordinates after the shadow rotates by the solar azimuth angle, and then convert the second world coordinates of the shadow tip into the second pixel coordinates.
[0054] S104: Connect the first pixel coordinates and the second pixel coordinates to determine the due south and due north directions.
[0055] In the embodiments of the present invention, by identifying a straight rod and its shadow, and analyzing the moving direction of the shadow tip before and after rotating the solar azimuth angle, the north-south azimuth information can be accurately determined. Using this method to identify the north-south azimuth helps to reduce the manufacturing cost of the vehicle.
[0056] In some embodiments of the present invention, the connecting the first pixel coordinates and the second pixel coordinates to determine the due south and due north directions includes: taking the direction from the first pixel coordinates to the second pixel coordinates as the due north direction; taking the direction from the second pixel coordinates to the first pixel coordinates as the due south direction;
[0057] The azimuth determination method further includes: displaying the image on the vehicle terminal, and displaying the due south direction and the due north direction on the image.
[0058] It should be noted that the solar azimuth angle refers to the angle between the projection of the sun's rays on the ground plane and the due north direction. Therefore, taking the direction from the first pixel coordinates to the second pixel coordinates as the due north direction, correspondingly, taking the direction from the second pixel coordinates to the first pixel coordinates as the due south direction.
[0059] Here, by displaying the image on the in-vehicle terminal and clearly marking the azimuth indicators of due south and due north on the image, the driver can more conveniently identify the north-south orientation. This not only improves the intuitiveness of driving navigation but also significantly enhances the driver's sense of direction during driving. Whether driving through complex urban blocks or on vast rural roads, the driver can quickly determine their orientation and thus make more accurate navigation decisions.
[0060] In some embodiments of the present invention, obtaining the second pixel coordinates of the shadow after rotating by the solar azimuth angle based on the first pixel coordinates of the shadow tip and the solar azimuth angle includes the following steps:
[0061] S201: Obtain the distance between the straight rod and the in-vehicle camera.
[0062] Here, based on the distance between two in-vehicle cameras, the camera focal length, and the horizontal coordinate difference of the straight rod in the images collected by the two in-vehicle cameras respectively, the distance between the straight rod and the in-vehicle camera is obtained.
[0063] In the embodiments of the present invention, these two in-vehicle cameras can be front-view cameras, with the same focal length, and the images captured by each include the same straight rod.
[0064] In the embodiments of the present invention, the horizontal coordinate difference of the straight rod in the images collected by the two in-vehicle cameras respectively, that is, the horizontal coordinate difference of the straight rod in the two images in the pixel coordinate system, is also called parallax.
[0065] Furthermore, according to the relational formula deduced from the binocular camera triangulation ranging principle, that is, (X - f) / X = (b - d) / b, where X is the distance between the straight rod and the in-vehicle camera, f is the camera focal length, b is the distance between the two in-vehicle cameras, and d represents the horizontal coordinate difference of the straight rod in the images collected by the two in-vehicle cameras respectively. Here, f, b, and d are known values. Substituting them into the above relational formula, the distance X between the straight rod and the in-vehicle camera can be obtained.
[0066] S202: Based on the conversion relationship between the world coordinate system and the pixel coordinate system and the distance between the straight rod and the in-vehicle camera, convert the first pixel coordinates of the shadow tip into the first world coordinates.
[0067] Among them, the world coordinate system can refer to a three-dimensional coordinate system with the center of the car as the coordinate origin.
[0068] Among them, the conversion relationship (1) between the world coordinate system and the pixel coordinate system is expressed as:
[0069]
[0070] The left side of the equal sign is the pixel coordinates, and on the right side of the equal sign are the camera internal parameter matrix, the camera external parameter matrix, and the three-dimensional world coordinates in sequence.
[0071] Here, if the top of the shadow is on the ground, then Z is zero; X is the distance between the straight rod and the vehicle-mounted camera; Y is an unknown. Based on this, substituting the first pixel coordinates of the top of the shadow, Z, and X into the above conversion relationship, the first world coordinates corresponding to the first pixel coordinates of the top of the shadow can be obtained.
[0072] S203: Based on the conversion relationship and the first world coordinates of the top of the shadow, obtain the second pixel coordinates after the shadow rotates by the solar azimuth angle.
[0073] In the embodiments of the present invention, the bottom of the straight rod is the rotation center, and the rotation angle of the shadow around the rotation center towards the straight rod direction is the solar azimuth angle, so that the first world coordinates of the top of the shadow are rotated by the solar azimuth angle to obtain the second world coordinates. Then, substituting the second world coordinates into the above conversion relationship, the second pixel coordinates corresponding to the second world coordinates of the top of the shadow can be obtained.
[0074] In some embodiments of the present invention, the step of obtaining the second pixel coordinates after the shadow rotates by the solar azimuth angle based on the conversion relationship and the first world coordinates of the top of the shadow includes the following steps:
[0075] S301: Based on the solar azimuth angle and the first world coordinates of the top of the shadow, obtain the second world coordinates after the shadow rotates by the solar azimuth angle.
[0076] In some embodiments, S301 may include the following steps: Substitute the solar azimuth angle into a preset rotation matrix to obtain a target rotation matrix; based on the target rotation matrix and the first world coordinates of the top of the shadow, obtain the second world coordinates after the shadow rotates by the solar azimuth angle.
[0077] It should be noted that since the shadow is on the ground, the Z coordinate value perpendicular to the ground corresponding to the top of the shadow is zero. Therefore, only the X and Y coordinates on the horizontal plane need to be concerned. Then the preset rotation matrix (2) can be expressed as:
[0078]
[0079] Where θ is the rotation angle. Here, the rotation angle is the solar azimuth angle.
[0080] Furthermore, represent the X and Y coordinates in the first world coordinates of the top of the shadow as a two-dimensional vector. Then, based on the target rotation matrix and the two-dimensional vector corresponding to the first world coordinates of the top of the shadow, obtain the new X and Y coordinates. The Z coordinate is zero. Based on this, obtain the second world coordinates after the shadow rotates by the solar azimuth angle.
[0081] S302: Based on the conversion relationship, convert the second world coordinates after rotating the shadow by the solar azimuth angle into second pixel coordinates.
[0082] That is, substitute the second world coordinates of the shadow tip into the above conversion relationship, and the second pixel coordinates corresponding to the second world coordinates of the shadow tip can be obtained.
[0083] In some embodiments of the present invention, the obtaining the solar azimuth angle based on obtaining the latitude information and the current time information of the vehicle includes the following steps:
[0084] S401: Determine the solar declination angle based on the date included in the current time information.
[0085] S402: Obtain the solar altitude angle based on the time point included in the current time information, the solar declination angle, and the latitude information.
[0086] S403: Obtain the solar azimuth angle based on the solar declination angle, the solar altitude angle, and the latitude information.
[0087] In the embodiments of the present invention, the solar declination angle refers to the angle between the equatorial plane of the earth and the line connecting the sun and the center of the earth. The calculation formula (3) of the solar declination angle is expressed as:
[0088]
[0089] Wherein, n is the date serial number. For example, when the date is January 1st, n = 1, and when the date is March 22nd, n = 81. The solar declination angle is a phenomenon caused by the earth's revolution around the sun, and it changes with time. Because the direction of the earth's axis remains unchanged, the declination angle has different values at different points on the earth's orbit. The declination angle moves within the range of +23°26′ and -23°26′ with a one-year cycle, which is called the sign of the season.
[0090] In the embodiments of the present invention, the solar altitude angle refers to the angle between the sun's rays at a certain place and the surface tangent plane passing through this place and the center of the earth. The calculation formula (4) of the solar altitude angle is expressed as:
[0091]
[0092] Wherein, h is the solar altitude angle, δ is the solar declination angle, is the local latitude, and t is the solar hour angle. The solar hour angle is determined based on the current UTC. The time point can be UTC or the local time point. If it is the local time point, the corresponding UTC can be obtained according to the time difference between the local time point and UTC.
[0093] For example, taking noon as 0 o'clock, negative in the morning, positive in the afternoon, 15° per hour, then at 10 o'clock in the morning, the hour angle is -30°, and at 2 o'clock in the afternoon, the hour angle is +30°.
[0094] In the embodiments of the present invention, the calculation formula (5) of the solar azimuth angle is expressed as:
[0095]
[0096] Wherein, A is the solar azimuth angle, h is the solar altitude angle, δ is the solar declination angle, and is the local latitude.
[0097] Based on the above formula, the solar azimuth angle can be obtained.
[0098] In some embodiments of the present invention, the processing of the image collected by the vehicle-mounted camera to obtain the first pixel coordinates of the top of the shadow of the straight rod in the image includes the following steps:
[0099] S501: Take the image collected by the vehicle-mounted camera as the input of the trained target recognition module to obtain the positions of the straight rod and its shadow in the image.
[0100] Here, the positions of the straight rod and its shadow in the image are represented in the form of pixel coordinates.
[0101] Here, the algorithm of the target recognition model can be the Faster R-CNN algorithm.
[0102] S502: Based on the positions of the straight rod and its shadow in the image, use the edge extraction algorithm to extract the edge information of the straight rod and its shadow.
[0103] In the embodiments of the present invention, the edge extraction algorithm can identify the regions where the brightness or color in the image changes significantly, so as to extract the edge information of the straight rod and its shadow. Exemplarily, the edge extraction algorithm can be the Canny algorithm or the Kirsch algorithm.
[0104] S503: Based on the edge information of the straight rod and its shadow, obtain the first pixel coordinates of the top of the shadow of the straight rod.
[0105] Based on this, through the edge extraction algorithm, the edge information of the straight rod and its shadow and the pixel coordinates of the top of the shadow can be quickly and accurately extracted from the image, improving the efficiency of image processing.
[0106] In some embodiments of the present invention, the azimuth determination method further includes:
[0107] Obtain an image sample set; the image includes a straight rod and its shadow;
[0108] Take the image sample set as the input of a preset recognition model to obtain the test labels of the image sample set;
[0109] Taking the true labels and test labels of the image sample set as the inputs of a preset loss function to obtain a loss value;
[0110] Training the preset recognition model based on the loss value to obtain the trained target recognition model.
[0111] Based on the above embodiments, an embodiment of the present invention specifically provides a method for determining an orientation. Figure 6 It is a schematic flowchart of the method for determining an orientation in an embodiment of the present invention. As Figure 6 shown, the method for determining an orientation includes the following steps:
[0112] S601: Using the trained target recognition algorithm to recognize the straight pole and its shadow in the image collected by the vehicle-mounted camera.
[0113] Before executing S601, training of the target recognition algorithm is required, which specifically includes:
[0114] I. Preparing a data set
[0115] Preparing a data set: Using a python crawler script to collect a large number of images containing straight poles and shadows.
[0116] Data annotation: Using an image annotation tool (such as LabelImg, VGG Image Annotator, etc.) to annotate the straight poles and shadows in the images. Usually, the straight poles are annotated as one category and the shadows are annotated as another category.
[0117] Image normalization: Normalizing the pixel values of the images to a specific range, such as [0, 1] or [-1, 1], to accelerate the training process and improve the stability of the model.
[0118] Data augmentation: Expanding the data set through operations such as random rotation, flipping, scaling, cropping, and brightness adjustment to increase the robustness of the model.
[0119] II. Selecting a neural network architecture
[0120] The Faster R-CNN target detection algorithm is selected for the target detection algorithm. This algorithm has relatively high accuracy but relatively large computational complexity.
[0121] III. Setting training parameters
[0122] The multi-task loss function: cross-entropy loss is usually used for the target detection algorithm. The classification loss is used to judge the category of the target, and the regression loss is used to determine the position and size of the target. And the backpropagation algorithm is selected to optimize and update the weights of the neural network to minimize the loss function.
[0123] Set an appropriate learning rate. The learning rate determines the step size of each weight update. Use a larger learning rate at the beginning of training and then gradually decrease it to improve the convergence speed and stability. You can use a learning rate scheduling strategy such as step decay. Select an appropriate batch size according to the computing resources and dataset size. The number of training epochs represents the number of times the entire dataset is cycled through the neural network. Enough training epochs are required to obtain good performance.
[0124] IV. Training Process
[0125] Divide the preprocessed dataset into a training set and a test set.
[0126] Use the training set for training: Input the images in the training set into the neural network and calculate the loss function. According to the loss function, use an optimization algorithm to update the weights of the neural network. Repeat this process until the predetermined number of training epochs is reached or the model converges.
[0127] During the training process, regularly evaluate the model performance using the test set: Calculate metrics such as accuracy, recall, and average precision on the validation set. Adjust the hyperparameters such as the learning rate and batch size according to the test set performance.
[0128] Save the best model during the training process: Select the best model weights for saving according to the validation set performance. You can save multiple intermediate models to restore to a better state in case of problems during training.
[0129] Through the above steps, a neural network for identifying straight rods and their shadows in images, that is, an object recognition model, can be trained.
[0130] S602: Use an edge extraction algorithm to extract the edge information of the straight rod and its shadow, and obtain the first pixel coordinates of the top of the straight rod's shadow.
[0131] S603: Based on the obtained latitude information of the vehicle and the current time information, obtain the solar azimuth angle.
[0132] Here, the latitude information of the vehicle can be obtained according to the built-in GPS positioning system of the vehicle. The current time information includes the date and time point.
[0133] The calculation formula (5) of the solar azimuth angle is expressed as:
[0134]
[0135] Among them, A is the solar azimuth angle, h is the solar altitude angle, δ is the solar declination angle, is the local latitude.
[0136] Among them, h is the solar altitude angle, which can be calculated according to the calculation formula (4) of the solar altitude angle. The calculation formula (4) of the solar altitude angle is expressed as:
[0137]
[0138] Among them, δ is the solar declination angle, is the local latitude, and t is the solar hour angle. The solar hour angle is determined based on the current UTC. The time point can be UTC or the local time point. If it is the local time point, the corresponding UTC can be obtained according to the time difference between the local time point and UTC. For example, taking noon as 0 o'clock, morning as negative, afternoon as positive, 15° per hour, then at 10 am, the hour angle is -30°, and at 2 pm, the hour angle is +30°.
[0139] Among them, δ is the solar declination angle, which can be calculated according to the calculation formula (3) of the solar declination angle. The calculation formula (3) of the solar declination angle is expressed as:
[0140]
[0141] Among them, n is the date serial number. For example, when the date is January 1st, n = 1, and when the date is March 22nd, n = 81.
[0142] S604: Based on the conversion relationship between the world coordinate system and the pixel coordinate system and the distance between the straight rod and the vehicle-mounted camera, convert the first pixel coordinate of the shadow tip into the first world coordinate.
[0143] Among them, the conversion relationship (1) between the world coordinate system and the pixel coordinate system is expressed as:
[0144]
[0145] On the left side of the equal sign is the pixel coordinate, and on the right side of the equal sign are the camera internal parameter matrix, the camera external parameter matrix, and the three-dimensional world coordinate in sequence.
[0146] Here, since the shadow tip is on the ground, Z is zero; X is the distance between the straight rod and the vehicle-mounted camera; Y is the unknown. Based on this, substituting the first pixel coordinate of the shadow tip, Z, and X into the above conversion relationship, the first world coordinate corresponding to the first pixel coordinate of the shadow tip can be obtained.
[0147] S605: Based on the solar azimuth angle and the first world coordinate of the shadow tip, obtain the second world coordinate after the shadow rotates by the solar azimuth angle.
[0148] It should be noted that since the shadow is on the ground, the Z coordinate value perpendicular to the ground corresponding to the shadow tip is zero. Therefore, only the X and Y coordinates on the horizontal plane need to be concerned. Then the preset rotation matrix can be expressed as (2):
[0149]
[0150] Among them, θ is the rotation angle. Here, the rotation angle is the solar azimuth angle. Substitute the solar azimuth angle into the preset rotation matrix to obtain the target rotation matrix.
[0151] Furthermore, represent the X and Y coordinates in the first world coordinates of the shadow tip as a two-dimensional vector. Then, based on the target rotation matrix and the two-dimensional vector corresponding to the first world coordinates of the shadow tip, obtain the new X and Y coordinates. The Z coordinate is zero. Based on this, obtain the second world coordinates after the shadow rotates by the solar azimuth angle.
[0152] S606: Based on the conversion relationship, convert the second world coordinates after the shadow rotates by the solar azimuth angle into second pixel coordinates.
[0153] S607: Take the direction from the first pixel coordinate to the second pixel coordinate as the due north direction, and take the direction from the second pixel coordinate to the first pixel coordinate as the due south direction.
[0154] S608: Display the image on the vehicle-mounted terminal, and display the due south and due north directions on the image.
[0155] That is, the present invention uses a vehicle-mounted camera to identify a straight rod and its shadow, and determines the north-south direction through shadow features. Without increasing the vehicle hardware cost, it can add the function of identifying the north-south direction to the vehicle, improve the navigation ability of the intelligent driving system, and can also be mounted on the vehicle center control screen for use as an application for indicating directions.
[0156] Based on the above embodiments, the embodiments of the present invention further provide an azimuth determination device. Figure 7 This is a schematic structural diagram of the components of the azimuth determination device in the embodiments of the present invention, as Figure 7 shown. The azimuth determination device includes:
[0157] A processing unit 701, configured to process the image collected by the vehicle-mounted camera to obtain the first pixel coordinates of the shadow tip of the straight rod in the image;
[0158] The processing unit 701 is further configured to obtain the solar azimuth angle based on the obtained latitude information and current time information of the vehicle;
[0159] A conversion unit 702, configured to obtain the second pixel coordinates after the shadow rotates by the solar azimuth angle based on the first pixel coordinates of the shadow tip and the solar azimuth angle;
[0160] The processing unit 701 is further configured to connect the first pixel coordinates and the second pixel coordinates to determine the due south and due north directions.
[0161] In an embodiment of the present invention, by identifying a straight rod and its shadow, and analyzing the moving direction of the top of the shadow before and after rotating the solar azimuth angle, the north-south azimuth information can be accurately determined. Using this method to identify the north-south azimuth helps to reduce the manufacturing cost of the vehicle.
[0162] In some embodiments of the present invention, the conversion unit 702 is further configured to obtain the distance between the straight rod and the vehicle-mounted camera; based on the conversion relationship between the world coordinate system and the pixel coordinate system and the distance between the straight rod and the vehicle-mounted camera, convert the first pixel coordinate of the top of the shadow into a first world coordinate; based on the conversion relationship and the first world coordinate of the top of the shadow, obtain the second pixel coordinate after the shadow rotates the solar azimuth angle.
[0163] In some embodiments of the present invention, the conversion unit 702 is further configured to obtain a second world coordinate after the shadow rotates the solar azimuth angle based on the solar azimuth angle and the first world coordinate of the top of the shadow; based on the conversion relationship, convert the second world coordinate after the shadow rotates the solar azimuth angle into the second pixel coordinate.
[0164] In some embodiments of the present invention, the conversion unit 702 is further configured to substitute the solar azimuth angle into a preset rotation matrix to obtain a target rotation matrix; based on the target rotation matrix and the first world coordinate of the top of the shadow, obtain the second world coordinate after the shadow rotates the solar azimuth angle.
[0165] In some embodiments of the present invention, the processing unit 701 is further configured to determine the solar declination angle based on the date included in the current time information; obtain the solar altitude angle based on the time point included in the current time information, the solar declination angle, and the latitude information; obtain the solar azimuth angle based on the solar declination angle, the solar altitude angle, and the latitude information.
[0166] In some embodiments of the present invention, the processing unit 701 is further configured to use the image collected by the vehicle-mounted camera as the input of a trained target recognition module to obtain the positions of the straight rod and its shadow in the image; based on the positions of the straight rod and its shadow in the image, use an edge extraction algorithm to extract the edge information of the straight rod and its shadow; based on the edge information of the straight rod and its shadow, obtain the first pixel coordinate of the top of the shadow of the straight rod.
[0167] In some embodiments of the present invention, the processing unit 701 is further configured to use the direction from the first pixel coordinate to the second pixel coordinate as the due north direction; use the direction from the second pixel coordinate to the first pixel coordinate as the due south direction; and display the image on the vehicle terminal, and display the due south direction and the due north direction on the image.
[0168] An embodiment of the present invention further provides another vehicle. Figure 8 It is a schematic structural diagram of the components of the vehicle in the embodiment of the present invention, as Figure 8 shown. The vehicle 80 includes: a processor 801 and a memory 802 configured to store a computer program that can run on the processor.
[0169] Wherein, when the processor 801 is configured to run the computer program, it executes the method steps in the foregoing embodiments.
[0170] Of course, in actual application, as Figure 8 shown, each component in the vehicle 80 is coupled together through a bus system 803. It can be understood that the bus system 803 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 803 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clear illustration, in Figure 8 all kinds of buses are labeled as the bus system 803.
[0171] In actual application, the foregoing processor may be at least one of an application specific integrated circuit (ASIC), a digital signal processing device (DSPD), a programmable logic device (PLD), a field-programmable gate array (FPGA), a controller, a microcontroller, and a microprocessor. It can be understood that for different devices, the electronic devices for implementing the functions of the foregoing processor may also be others, and the embodiments of the present invention do not make specific limitations.
[0172] The above-mentioned memory may be a volatile memory, such as a random-access memory (RAM); or a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid-state drive (SSD); or a combination of the above types of memories, and provides instructions and data to the processor.
[0173] In an exemplary embodiment, the embodiment of the present invention further provides a computer-readable storage medium for storing a computer program.
[0174] Optionally, the computer-readable storage medium can be applied to any one of the methods in the embodiment of the present invention, and the computer program causes the computer to execute the corresponding processes implemented by the processor in each of the methods of the embodiment of the present invention. For the sake of brevity, it will not be described in detail here.
[0175] In several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined, or can be integrated into another system, or some features can be ignored, or not executed. In addition, the coupling, direct coupling, or communication connection between the displayed or discussed components can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical, or other forms.
[0176] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units; some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0177] In addition, each functional unit in the embodiments of the present invention may be entirely integrated into a processing module, or each unit may be separately regarded as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated unit may be implemented in the form of hardware, or in the form of a combination of hardware and software functional units. Those of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions. The aforementioned program may be stored in a computer-readable storage medium. When the program is executed, it performs the steps including the above method embodiments; and the aforementioned storage medium includes various media that can store program codes, such as removable storage devices, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs.
[0178] The methods disclosed in several method embodiments provided by the present invention can be arbitrarily combined without conflict to obtain new method embodiments.
[0179] The features disclosed in several product embodiments provided by the present invention can be arbitrarily combined without conflict to obtain new product embodiments.
[0180] The features disclosed in several method or device embodiments provided by the present invention can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0181] The above is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of changes or substitutions, which should all be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.
Claims
1. A method for determining orientation, characterized in that, The azimuth determination method includes: Processing the image collected by the vehicle-mounted camera to obtain the first pixel coordinates of the top of the shadow of the straight rod in the image; Based on the obtained latitude information of the vehicle and the current time information, obtaining the solar azimuth angle; Based on the first pixel coordinates of the top of the shadow and the solar azimuth angle, obtaining the second pixel coordinates after the shadow rotates by the solar azimuth angle; Connecting the first pixel coordinates and the second pixel coordinates to determine the due south and due north directions.
2. The orientation determination method according to claim 1, characterized in that, The obtaining the second pixel coordinates after the shadow rotates by the solar azimuth angle based on the first pixel coordinates of the top of the shadow and the solar azimuth angle includes: Obtaining the distance between the straight rod and the vehicle-mounted camera; Based on the conversion relationship between the world coordinate system and the pixel coordinate system and the distance between the straight rod and the vehicle-mounted camera, converting the first pixel coordinates of the top of the shadow into the first world coordinates; Based on the conversion relationship and the first world coordinates of the top of the shadow, obtaining the second pixel coordinates after the shadow rotates by the solar azimuth angle.
3. The orientation determination method according to claim 2, wherein The obtaining the second pixel coordinates after the shadow rotates by the solar azimuth angle based on the conversion relationship and the first world coordinates of the top of the shadow includes: Based on the solar azimuth angle and the first world coordinates of the top of the shadow, obtaining the second world coordinates after the shadow rotates by the solar azimuth angle; Based on the conversion relationship, converting the second world coordinates after the shadow rotates by the solar azimuth angle into the second pixel coordinates.
4. The orientation determination method according to claim 3, characterized in that, The obtaining the second world coordinates after the shadow rotates by the solar azimuth angle based on the solar azimuth angle and the first world coordinates of the top of the shadow includes: Substituting the solar azimuth angle into a preset rotation matrix to obtain a target rotation matrix; Based on the target rotation matrix and the first world coordinates of the top of the shadow, obtaining the second world coordinates after the shadow rotates by the solar azimuth angle.
5. The orientation determination method according to any one of claims 1 to 4, characterized in that, The obtaining the solar azimuth angle based on the obtained latitude information of the vehicle and the current time information includes: Based on the date included in the current time information, determining the solar declination angle; Based on the time point included in the current time information, the solar declination angle and the latitude information, obtaining the solar altitude angle; Based on the solar declination angle, the solar altitude angle and the latitude information, obtaining the solar azimuth angle.
6. The orientation determination method according to any one of claims 1 to 4, characterized in that The processing the image collected by the vehicle-mounted camera to obtain the first pixel coordinates of the top of the shadow of the straight rod in the image includes: Taking the image collected by the vehicle-mounted camera as the input of a trained target recognition module to obtain the positions of the straight rod and its shadow in the image; Based on the positions of the straight rod and its shadow in the image, using an edge extraction algorithm to extract the edge information of the straight rod and its shadow; Based on the edge information of the straight rod and its shadow, obtaining the first pixel coordinates of the top of the shadow of the straight rod.
7. The orientation determination method according to any one of claims 1 to 4, characterized in that, The connecting the first pixel coordinates and the second pixel coordinates to determine the due south and due north directions includes: Taking the direction from the first pixel coordinates to the second pixel coordinates as the due north direction; Take the direction in which the second pixel coordinate points to the first pixel coordinate as the due south direction; The azimuth determination method further includes: Display the image on the vehicle terminal, and display the due south direction and the due north direction on the image.
8. An orientation determination device, characterized in that, The azimuth determination device includes: A processing unit, configured to process the image collected by the vehicle-mounted camera to obtain the first pixel coordinate of the top of the shadow of the straight rod in the image; The processing unit is further configured to obtain the solar azimuth angle based on the obtained latitude information of the vehicle and the current time information; A conversion unit, configured to obtain the second pixel coordinate after the shadow rotates by the solar azimuth angle based on the first pixel coordinate of the shadow top and the solar azimuth angle; The processing unit is further configured to connect the first pixel coordinate and the second pixel coordinate to determine the due south and due north directions.
9. A vehicle, characterized in that, The vehicle includes: a processor and a memory configured to store a computer program that can run on the processor, wherein, when the processor is configured to run the computer program, it executes the steps of the azimuth determination method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the azimuth determination method according to any one of claims 1 to 7.