A shadow positioning method, device, medium and terminal

By collecting and processing monocular camera images and training shadow prediction models, the problem that intelligent robots cannot measure object distance and angle at the same time is solved, and the multifunctional measurement capability of monocular cameras is realized.

CN114972786BActive Publication Date: 2025-07-11SHENZHEN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210551533.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-20
Publication Date
2025-07-11
Estimated Expiration
2042-05-20

AI Technical Summary

Technical Problem

Existing intelligent robots cannot simultaneously obtain the distance and angle information of an object relative to the target through a monocular camera.

Method used

Images containing preset objects and shadows are collected, images of different distances and angles are taken through a monocular camera, training features are extracted, and shadow prediction models are trained using polynomial regression to predict the position data of objects and targets.

Benefits of technology

It is possible to accurately measure the distance and angle of an object relative to the target using only a monocular camera.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114972786B_ABST
    Figure CN114972786B_ABST
Patent Text Reader

Abstract

The present invention discloses a shadow positioning method, device, medium and terminal. The shadow positioning method includes: collecting an image containing a preset object and the shadow of the preset object, and obtaining the actual position label of the preset object; preprocessing the image to extract training features in the image; training a model through the training features and the position label to obtain a shadow prediction model; inputting a to-be-tested image into the shadow prediction model for calculation, and outputting predicted position data. After adopting the above method, the present invention can obtain the distance and angle between an object and a target only by using a monocular camera.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of visual detection, and in particular, to a method, device, medium and terminal for shadow positioning. Background Art

[0002] Vision, as the most important and intuitive organ for humans to obtain external information, is responsible for more than 80% of information acquisition. With the development of technology, the existing types of intelligent robots are developing in a diversified direction, such as intelligent spraying robots, intelligent painting robots, intelligent gluing robots, etc. As the fields of applying intelligent robots are increasing, more fields will require intelligent robots to have the ability of visual ranging and angle measurement in the future.

[0003] Humans can simply judge the distance and angle of an object through a single eye with prior information, while robots still cannot obtain the information of the distance and angle between an object and a target only through a single monocular camera. Summary of the Invention

[0004] In view of the above deficiencies of the prior art, the purpose of the present application is to provide a method, device, medium and terminal for shadow positioning, aiming to solve the problem that the distance and angle between an object and a target can be obtained only by using a single monocular camera.

[0005] To solve the above technical problems, in the first aspect of the embodiments of the present application, a method for shadow positioning is provided, and the method includes:

[0006] Collect an image containing a preset object and the shadow of the preset object, and obtain the actual position label of the preset object;

[0007] Preprocess the image and extract the training features in the image;

[0008] Train the model through the training features and the position label to obtain a shadow prediction model;

[0009] Input the image to be measured into the shadow prediction model for calculation, and output the predicted position data.

[0010] As a further improved technical solution, the step of collecting an image containing a preset object and the shadow of the preset object, and obtaining the actual position label of the preset object includes:

[0011] Keep the relative positions of the preset object, the light source and the monocular camera unchanged;

[0012] Take a number of distance images of a preset object and a target at the same angle but different distances through the monocular camera, and take a number of angle images of the preset object and the target at the same distance but different angles through the monocular camera. Among them, both the distance images and the angle images contain the preset object and the shadow of the preset object;

[0013] Measure the actual distance between the preset object and the target in each group of the distance images, measure the actual angle between the preset object and the target in each group of the angle images, use the actual distance as the distance label, and use the actual angle as the angle label.

[0014] As a further improved technical solution, the preprocessing of the image to extract the training features in the image includes:

[0015] Perform closing operation on the distance image to obtain a result image;

[0016] Perform difference between the result image and the distance image to extract the contour image of the preset object and the shadow of the preset object in the image;

[0017] Convert the contour image into a grayscale image, and perform binarization processing on the grayscale image to obtain a binary image;

[0018] Perform opening operation on the binary image to obtain a denoised image, use the image contour search algorithm on the denoised image to calculate the coordinates of the endpoints of the preset object and the endpoints of the shadow of the preset object, perform subtraction on the coordinates of the endpoints of the preset object and the coordinates of the endpoints of the shadow of the preset object in the same direction to obtain the image distance feature, and use the image distance feature as the distance training feature.

[0019] As a further improved technical solution, the preprocessing of the image to extract the training features in the image further includes:

[0020] Use the circle / ellipse detection algorithm on the angle image to calculate the image angle feature, and use the image angle feature as the angle training feature.

[0021] As a further improved technical solution, the endpoints of the preset object include the endpoints of the preset object close to the shadow of the preset object, and the endpoints of the shadow of the preset object include the endpoints of the shadow of the preset object close to the preset object.

[0022] As a further improved technical solution, the training of the shadow prediction model by using the training features and the position labels as inputs includes:

[0023] The distance training features and the distance labels are trained through polynomial regression to obtain an initial model. The distance training features are input into the initial model for prediction to obtain a predicted value. The difference between the predicted value and the actual distance is calculated to obtain a distance difference. The distance difference and the training features are trained through polynomial regression to obtain a compensation model. The compensation model and the initial model are combined to form a distance prediction model;

[0024] The angle training features and the angle labels are trained through polynomial regression to obtain an angle prediction model;

[0025] The distance prediction model and the angle prediction model are combined to form a shadow prediction model.

[0026] As a further improved technical solution, when the image to be measured is input into the shadow prediction model for calculation, the output predicted position data includes:

[0027] The image to be measured is input into the distance prediction model for calculation, and the output predicted distance data is obtained. The image to be measured is input into the angle prediction model for calculation, and the output predicted angle data is obtained.

[0028] The second aspect of the embodiments of the present application provides a shadow positioning device, including:

[0029] An acquisition module, configured to acquire an image containing a preset object and the shadow of the preset object, and obtain the actual position label of the preset object;

[0030] A feature extraction module, configured to preprocess the image and extract the training features in the image;

[0031] A training module, configured to train a model through the training features and the position labels to obtain a shadow prediction model;

[0032] A calculation module, configured to input the image to be measured into the shadow prediction model for calculation, and output the predicted position data.

[0033] The third aspect of the embodiments of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in any one of the above shadow positioning methods.

[0034] The fourth aspect of the embodiments of the present application provides a terminal device, which includes: a processor, a memory, and a communication bus; a computer-readable program executable by the processor is stored on the memory;

[0035] The communication bus realizes the connection and communication between the processor and the memory;

[0036] When the processor executes the computer-readable program, it implements the steps in any of the above-described shadow positioning methods.

[0037] Beneficial effects: Compared with the prior art, the shadow positioning method of the present invention includes: collecting an image containing a preset object and the shadow of the preset object, and obtaining the actual position label of the preset object; preprocessing the image to extract the training features in the image; training a model through the training features and the position label to obtain a shadow prediction model; inputting the to-be-tested image into the shadow prediction model for calculation, and outputting the predicted position data. After adopting the above method, the present invention can obtain the distance and angle between the object and the target only by using a monocular camera. Description of the Drawings

[0038] Figure 1 It is a flowchart of the shadow positioning method of the present invention.

[0039] Figure 2 It is a structural schematic diagram of the terminal device provided by the present invention.

[0040] Figure 3 It is a flowchart of the distance image preprocessing in the shadow positioning method of the present invention.

[0041] Figure 4 It is a flowchart of the angle image preprocessing in the shadow positioning method of the present invention.

[0042] Figure 5 It is a flowchart of the training of the distance prediction model in the shadow positioning method of the present invention.

[0043] Figure 6 It is a flowchart of the training of the angle prediction model in the shadow positioning method of the present invention.

[0044] Figure 7 It is a schematic diagram of the image for training in the shadow positioning method of the present invention.

[0045] Figure 8 It is a structural block diagram of the shadow positioning device provided by the present invention.

[0046] The realization, functional features and advantages of the object of the present invention will be further described with reference to the embodiments and the accompanying drawings. Detailed Embodiments

[0047] For ease of understanding the present application, the present application will be described more comprehensively below with reference to the relevant accompanying drawings. Preferred embodiments of the present application are shown in the accompanying drawings. However, the present application can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, these embodiments are provided to make the disclosure of the present application more thorough and comprehensive.

[0048] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which this application belongs. The terms used in the description of this application herein are for the purpose of describing specific embodiments only and are not intended to limit this application.

[0049] The inventor has found through research that the prior art has the following problems:

[0050] Vision, as the most important and intuitive organ for humans to obtain external information, is responsible for obtaining more than 80% of the information. With the development of technology, the existing types of intelligent robots are developing in the direction of diversification, such as intelligent spraying robots, intelligent painting robots, intelligent gluing robots, etc. As the fields using intelligent robots are increasing, in the future, more fields will require intelligent robots to have the ability of visual ranging and angle measurement. Humans can simply judge the distance and angle of an object through a monocular camera when having prior information, while a robot still cannot obtain the information of the distance and angle between an object and a target simultaneously through only one monocular camera.

[0051] To solve the above problems, various non-limiting embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0052] As Figure 1 shown, a shadow positioning method provided by an embodiment of the present application includes the following steps:

[0053] S1, collect an image containing a preset object and the shadow of the preset object, and obtain the actual position label of the preset object;

[0054] Specifically, first, an image for training needs to be collected. The image must contain both a preset object and the shadow of the preset object. The shadow of the preset object is projected onto a target, which is generally a plane. The image also contains an aperture formed by the light source irradiating the target. The preset object can be a long strip-shaped object with a tip, such as a pencil, a probe, etc., which is convenient for subsequent measurement and training.

[0055] Among them, the step of collecting an image containing a preset object and the shadow of the preset object and obtaining the actual position label of the preset object includes the following steps:

[0056] S101, keep the relative positions of the preset object, the light source, and the monocular camera unchanged;

[0057] S102. Take a number of distance images of a preset object and a target at the same angle but different distances, and take a number of angle images of the preset object and the target at the same distance but different angles through the monocular camera. Among them, both the distance images and the angle images contain the preset object and the shadow of the preset object;

[0058] S103. Measure the actual distance between the preset object and the target in each group of the distance images, measure the actual angle between the preset object and the target in each group of the angle images, use the actual distance as the distance label, and use the actual angle as the angle label.

[0059] Specifically, in this embodiment, a clamping mechanism can be used to keep the preset object, the light source, and the monocular camera relatively fixed. The light source and the preset object are set in a parallel state. The preset object, the light source, and the monocular camera are fixed on the clamping mechanism. During subsequent shooting, the relative positions among the preset object, the light source, and the monocular camera will not change. Among them, the light source can irradiate the preset object to generate a shadow when approaching the target. The target can be a plane, which can be a drawing board, a spraying plane, or other planes in practical applications. First, in this embodiment, a robotic arm with relatively high positioning accuracy is mainly used as the moving mechanism. The moving mechanism can also be a stepping device such as a motor. The moving mechanism can drive the clamping mechanism to move and rotate the clamping mechanism, so that the preset object, the light source, and the monocular camera move synchronously and rotate synchronously. When collecting images, first, make the end with a tip of the preset object face the target, and set the preset object perpendicular to the target. Then control the robotic arm to drive the clamping mechanism to gradually move towards the target until the preset object touches the target. At this time, the distance between the preset object and the target is 0 mm, and the angle is 90°. Then control the robotic arm to drive the clamping mechanism to move away from the target successively. The distance of each movement can be 0.2 mm. Each time the monocular camera takes an image after each movement. The image contains the preset object and the shadow of the preset object. This image is used as a distance image. Measure the actual distance between the preset object and the target each time. The total distance moved by the robotic arm can be used as the actual distance. After collecting several distance images, angle images can be collected. First, make the preset object perpendicular to the target. Then control the robotic arm to drive the clamping mechanism to gradually move towards the target until the preset object touches the target. At this time, the distance between the preset object and the target is 0 mm, and the angle is 90°. Then control the robotic arm to drive the clamping mechanism to move away from the target. Stop moving when the moving distance is 1 cm. At this time, the distance between the preset object and the target is 10 cm, and the angle is 90°. Then control the robotic arm to drive the clamping mechanism to rotate successively. Each time it can rotate 5°. Each time it rotates 5°, the monocular camera takes an image. The image contains the preset object, the shadow of the preset object, and the light circle irradiated by the light source on the plane. This image is used as an angle image. Measure the actual angle between the preset object and the target each time. The actual angle can be obtained by adding or subtracting the total angle of the robotic arm rotation from 90°. The actual distance is used as the distance label, and the actual angle is used as the angle label.

[0060] S2. Preprocess the image and extract the training features in the image;

[0061] Specifically, first, preprocess the above distance image and angle image respectively, and extract the training features of the distance image and the training features of the angle image respectively.

[0062] Among them, preprocessing the image and extracting the training features in the image includes the following steps:

[0063] S201, perform closing operation on the distance image to obtain a result image;

[0064] S202, perform difference between the result image and the distance image to extract the contour images of the preset object and the shadow of the preset object in the image;

[0065] S203, convert the contour image into a grayscale image and perform binarization processing on the grayscale image to obtain a binary image;

[0066] S204, perform opening operation on the binary image to obtain a denoised image, use the image contour search algorithm to calculate the coordinates of the endpoints of the preset object and the endpoints of the shadow of the preset object on the denoised image, perform subtraction on the coordinates of the endpoints of the preset object and the coordinates of the endpoints of the shadow of the preset object in the same direction to obtain the image distance feature, and use the image distance feature as the distance training feature. The endpoints of the preset object include the endpoints of the preset object close to the shadow of the preset object, and the endpoints of the shadow of the preset object include the endpoints of the shadow of the preset object close to the preset object.

[0067] S205, use the circle / ellipse detection algorithm to calculate the image angle feature from the angle image, and use the image angle feature as the angle training feature.

[0068] Specifically, first perform 10 times of closing operation on the distance image using a 5x5 cross-shaped structuring element to obtain a result image, then perform difference between the result image and the distance image to extract the contour images of the preset object and the shadow of the preset object in the image, convert the contour image into a grayscale image, perform binarization processing on the grayscale image to obtain a binary image, then perform 1 time of opening operation on the binary image to filter out noise to obtain a denoised image, use the image contour search algorithm to calculate the coordinates of the endpoints of the preset object and the coordinates of the endpoints of the shadow of the preset object on the denoised image. The endpoints of the preset object include the endpoints of the preset object close to the shadow of the preset object, and the endpoints of the shadow of the preset object include the endpoints of the shadow of the preset object close to the preset object. Perform subtraction on the coordinates of the endpoints of the preset object and the coordinates of the endpoints of the shadow of the preset object in the x-axis direction and the y-axis direction respectively to obtain the distance in the x-axis direction between the preset object and the shadow of the preset object in the image, denoted as Δx, and obtain the distance in the y-axis direction between the preset object and the shadow of the preset object in the image, denoted as Δy. Use Δx and Δy as the image distance feature, and use the image distance feature as the distance training feature;

[0069] To facilitate angle measurement, the angle image can use the ED Circles algorithm to calculate the elliptical deviation angle of the light source's aperture on the plane. Denote this elliptical deviation angle as Δa. Since the relative positions of the light source and the preset object do not change, the angle of the light source rotation is equal to the angle of the preset object rotation. Take Δa as the image angle feature and use the said image angle feature as the angle training feature.

[0070] Among them, opening operation is to erode the image first and then dilate it. Its function is to eliminate small objects, smooth the shape boundary, and not change its area. It can remove small particle noise and disconnect the adhesion between objects. The mathematical expression of the opening operation is: A ○ S = (A Θ S) ⊕ S

[0071] Among them, A represents the image, S represents the cross structuring element, ○ represents the opening operation, Θ represents erosion, and ⊕ represents dilation.

[0072] Image difference. The difference image is the image formed by subtracting two images. There are two ways of the difference method: 1. The difference between the current image and the fixed background image; 2. The difference between two consecutive images. What is used in the above method is the difference between two consecutive images.

[0073] Binarization. By setting a given threshold, the gray value of the pixel points on the image is set to 0 or 255, that is, the whole image presents an obvious visual effect of only black and white. The formula for binarization is:

[0074]

[0075] Among them, in the formula, x and y are the coordinates in the pixel coordinate system, Dst(x, y) is the gray value at the position (x, y) of the processed image, src(x, y) is the gray value at the position (x, y) of the unprocessed image, and thresh is the gray threshold determined manually.

[0076] Closing operation is to dilate the image first and then erode it. Its function is to fill the small holes in the object, connect adjacent objects, connect the broken contour lines, and smooth its boundary without changing the area. The mathematical expression of the closing operation is: A ● S = (A ⊕ S) Θ S, where A represents the image, S represents the cross structuring element, ● represents the closing operation, Θ represents erosion, and ⊕ represents dilation.

[0077] Image contour search algorithm, that is, to perform topological analysis on the digital binary image and find the outermost boundary of the object contour.

[0078] The ED Circles algorithm is an algorithm that can efficiently find circles and ellipses in an image. The returned parameters are the diameter of the circle, the major axis, the minor axis of the ellipse, and the inclination angle of the ellipse.

[0079] S3. Train the model using the training features and the position labels to obtain a shadow prediction model;

[0080] Specifically, the training features include distance training features and angle training features. The distance training features are used as the input of the model for training to output a distance prediction model, and the angle training features are used as the input of the model for training to output an angle prediction model. The shadow prediction model includes a distance prediction model and an angle prediction model. The angle prediction model is used to predict the angle between the object to be measured and the target, and the distance prediction model is used to predict the distance between the object to be measured and the target.

[0081] Among them, training the shadow prediction model with the training features and the position labels as the input includes the following steps:

[0082] S301. Train the distance training features and the distance labels through polynomial regression to obtain an initial model. Input the distance training features into the initial model for prediction to obtain a predicted value. Calculate the difference between the predicted value and the actual distance to obtain a distance difference. Train the distance difference and the training features through polynomial regression to obtain a compensation model. Combine the compensation model with the initial model to form a distance prediction model;

[0083] S302. Train the angle training features and the angle labels through polynomial regression to obtain an angle prediction model;

[0084] S303. Combine the distance prediction model and the angle prediction model to form a shadow prediction model.

[0085] Specifically, training the distance training features and the distance labels through polynomial regression to obtain an initial model means using the image distance features Δx, Δy as the training input and the actual distance s as the training label for polynomial regression training and fitting to obtain an initial model for distance prediction. At the same time, record the difference between the distance predicted by the initial model and the actual distance as Δs. Then, use Δx, Δy as the training input and Δs as the training label for polynomial regression training and fitting to obtain a compensation model. Combine the compensation model with the initial model to form a distance prediction model, and subtract the output of the compensation model from the output of the initial model as the output of the final distance prediction model.

[0086] At the same time, use the image angle feature Δa as the training input and the actual angle a as the training label for polynomial regression training and fitting to directly obtain an angle prediction model. Combine the distance prediction model and the angle prediction model to form a shadow prediction model

[0087] S4. Input the image to be measured into the shadow prediction model for calculation and output the predicted position data.

[0088] Specifically, the image to be measured contains the object to be measured, the shadow of the object to be measured, and the target plane. The image to be measured is input into the shadow prediction model for calculation, and the position data between the object to be measured and the target plane is output. The position data includes the distance and angle data between the object to be measured and the target plane.

[0089] Among them, the step of inputting the image to be measured into the shadow prediction model for calculation and outputting the predicted position data includes the following steps:

[0090] S401, input the image to be measured into the distance prediction model for calculation, and output the predicted distance data. Input the image to be measured into the angle prediction model for calculation, and output the predicted angle data.

[0091] Specifically, input the image to be measured containing the object to be measured, the shadow of the object to be measured, and the target plane into the distance prediction model for calculation, and output the predicted distance data. Input the image to be measured containing the object to be measured, the shadow of the object to be measured, and the target plane into the angle prediction model for calculation, and output the predicted angle data.

[0092] As Figure 8 shown, based on the above shadow measurement and positioning method, this embodiment provides a shadow measurement and positioning device, including:

[0093] Acquisition module 1, configured to acquire an image containing a preset object and the shadow of the preset object, and obtain the actual position label of the preset object;

[0094] Feature extraction module 2, configured to preprocess the image and extract the training features in the image;

[0095] Training module 3, configured to train the model through the training features and the position label, and train to obtain a shadow prediction model;

[0096] Calculation module 4, configured to input the image to be measured into the shadow prediction model for calculation, and output the predicted position data.

[0097] In addition, it is worth noting that the working process of the shadow measurement and positioning device provided in this embodiment is the same as that of the above shadow measurement and positioning method. Specifically, it can refer to the working process of the shadow measurement and positioning method, which will not be elaborated here.

[0098] Based on the above shadow measurement and positioning method, this embodiment provides a computer-readable storage medium. The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in the shadow measurement and positioning method as described in the above embodiment.

[0099] As Figure 2 shown, based on the above shadow positioning method, the present application also provides a terminal device, which includes at least one processor 20; a display screen 21; and a memory 22, and may further include a communication interface 23 and a bus 24. Among them, the processor 20, the display screen 21, the memory 22, and the communication interface 23 can complete mutual communication through the bus 24. The display screen 21 is set to display a user guidance interface preset in the initial setting mode. The communication interface 23 can transmit information. The processor 20 can call the logical instructions in the memory 22 to execute the method in the above embodiments.

[0100] In addition, when the logical instructions in the above-mentioned memory 22 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium.

[0101] The memory 22, as a computer-readable storage medium, can be set to store software programs and computer-executable programs, such as the program instructions or modules corresponding to the methods in the embodiments of the present disclosure. The processor 20 executes functional applications and data processing by running the software programs, instructions, or modules stored in the memory 22, that is, implements the methods in the above embodiments.

[0102] The memory 22 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system and application programs required for at least one function; the data storage area can store data created according to the use of the terminal device, etc. In addition, the memory 22 may include a high-speed random access memory and may also include a non-volatile memory. For example, various media that can store program codes such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks, or optical discs can also be transient storage media.

[0103] Compared with the prior art, after adopting the above method, the present invention can obtain the distance and angle data of the object to be measured relative to the target only by using a monocular camera.

[0104] It should be understood that the application of the present invention is not limited to the above examples. For those of ordinary skill in the art, improvements or transformations can be made according to the above description, and all such improvements and transformations should fall within the protection scope of the appended claims of the present invention.

Claims

1. A shadow positioning method, characterized in that, The method includes: Collecting an image containing a preset object and the shadow of the preset object, and obtaining the actual position label of the preset object; Preprocessing the image to extract the training features in the image; Training a model with the training features and the position label to obtain a shadow prediction model; Inputting the image to be measured into the shadow prediction model for calculation, and outputting the predicted position data; The collecting an image containing a preset object and the shadow of the preset object, and obtaining the actual position label of the preset object includes: Keeping the relative positions between the preset object, the light source and the monocular camera unchanged; Taking a plurality of distance images of the same angle but different distances between the preset object and the target by the monocular camera, and taking a plurality of angle images of the same distance but different angles between the preset object and the target by the monocular camera, wherein both the distance images and the angle images contain the preset object and the shadow of the preset object; Measuring the actual distance between the preset object and the target in each group of the distance images, measuring the actual angle between the preset object and the target in each group of the angle images, taking the actual distance as the distance label, and taking the actual angle as the angle label; The preprocessing the image to extract the training features in the image includes: Performing closing operation on the distance image to obtain a result image; Performing difference between the result image and the distance image to extract the contour image of the preset object and the shadow of the preset object in the image; Converting the contour image into a grayscale image, and performing binarization processing on the grayscale image to obtain a binary image; Performing opening operation on the binary image to obtain a denoised image, calculating the coordinates of the endpoints of the preset object and the endpoints of the shadow of the preset object on the denoised image by using an image contour search algorithm, subtracting the coordinates of the endpoints of the preset object and the coordinates of the endpoints of the shadow of the preset object in the same direction to obtain an image distance feature, and taking the image distance feature as the distance training feature.

2. The shadow positioning method according to claim 1, wherein The preprocessing the image to extract the training features in the image further includes: Calculating an image angle feature from the angle image by using a circle / ellipse detection algorithm, and taking the image angle feature as the angle training feature.

3. A shadow positioning method according to claim 2, characterized in that, The endpoints of the preset object include the endpoints of the preset object close to the shadow of the preset object, and the endpoints of the shadow of the preset object include the endpoints of the shadow of the preset object close to the preset object.

4. A shadow positioning method according to claim 3, characterized in that, The training a model with the training features and the position label as inputs to obtain a shadow prediction model includes: Training an initial model by polynomial regression with the distance training feature and the distance label, inputting the distance training feature into the initial model for prediction to obtain a predicted value, calculating the difference between the predicted value and the actual distance to obtain a distance difference, training a compensation model by polynomial regression with the distance difference and the training feature, and combining the compensation model and the initial model to form a distance prediction model; Training an angle prediction model by polynomial regression with the angle training feature and the angle label; Combine the distance prediction model and the angle prediction model to form a shadow prediction model.

5. A shadow positioning method according to claim 4, characterized in that, Input the image to be measured into the shadow prediction model for calculation, and the output predicted position data includes: Input the image to be measured into the distance prediction model for calculation, and output the predicted distance data. Input the image to be measured into the angle prediction model for calculation, and output the predicted angle data.

6. A shadow positioning device for implementing the shadow positioning method according to any one of claims 1-5, characterized in that, Including: An acquisition module, configured to acquire an image containing a preset object and the shadow of the preset object, and obtain the actual position label of the preset object; A feature extraction module, configured to preprocess the image and extract the training features in the image; A training module, configured to train the model through the training features and the position label, and train to obtain a shadow prediction model; A calculation module, configured to input the image to be measured into the shadow prediction model for calculation, and output the predicted position data.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in the shadow positioning method according to any one of claims 1-5.

8. A terminal device, characterized in that, Including: A processor, a memory and a communication bus; a computer-readable program executable by the processor is stored on the memory; The communication bus realizes the connection and communication between the processor and the memory; When the processor executes the computer-readable program, it implements the steps in the shadow positioning method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Shadow-based night object single-camera locating device and method

    CN105138999A

  • Monocular vision-based ahead vehicle detection method

    CN106529530A