Bird-eye view generation method and device, electronic equipment and storage medium
Accurate image coordinates are obtained through the corner detection method, and the feature matrix is used for perspective transformation and deghosting processing, which solves the ghosting problem when generating a bird's-eye view in the existing technology and improves the clarity and accuracy of the image.
Patent Information
- Application Number
- CN202410752387.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-12
- Publication Date
- 2024-09-10
AI Technical Summary
When the existing technology generates a bird's-eye view, the homography matrix is inaccurate due to manual selection of coordinates, resulting in obvious ghosting in the spliced bird's-eye view, affecting the clarity.
The corner detection method is used to automatically obtain image coordinates, perspective transformation is performed through the feature matrix, and splicing is performed after deghosting to optimize the accuracy and clarity of the bird's-eye view.
Improves the accuracy and clarity of bird's-eye views, reduces ghosting issues, and enhances the accuracy of generating bird's-eye views.
Smart Images

Figure CN118628344A
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a method, device, electronic device and storage medium for generating a bird's-eye view. Background Art
[0002] Panoramic imaging (AVM) is a method of capturing images through multiple ultra-wide-angle fisheye cameras. After data processing, the captured images are distorted and stitched together to obtain a bird's-eye view of the surroundings. It is often used in automotive systems to provide drivers with a bird's-eye view of the vehicle's surroundings, eliminate blind spots in the driver's field of vision, and provide visual assistance during vehicle driving.
[0003] At present, the bird's-eye view is mainly obtained by using the feature matching method. This method requires the calculation of the homography matrix, and the calculation of the homography matrix requires four world coordinates and the corresponding graphic coordinates. The current way to obtain the graphic coordinates is to manually select four coordinates on the graphic. This operation will produce errors, resulting in the final calculated homography matrix is not accurate enough, so that the final spliced bird's-eye view has obvious ghosting, affecting the clarity of the bird's-eye view. Therefore, how to improve the clarity of the generated bird's-eye view has become an urgent problem to be solved. Summary of the invention
[0004] In view of this, the purpose of the present application is to provide a method, device, electronic device and storage medium for generating a bird's-eye view, which can automatically obtain high-accuracy image coordinates through a corner detection method, and can determine an accurate feature matrix when using the image coordinates for feature matching. A target image is obtained by performing a perspective transformation based on the feature matrix, and each target image is de-ghosted and then spliced to obtain a bird's-eye view. The ghosting problem in the bird's-eye view is optimized, thereby improving the accuracy and clarity of the generated bird's-eye view.
[0005] This application mainly includes the following aspects:
[0006] In a first aspect, an embodiment of the present application provides a method for generating a bird's-eye view, the method comprising:
[0007] Obtain images captured by each camera on the target object;
[0008] For each camera's captured image, obtain the world coordinates of the calibration object in the camera's captured image, and obtain the image coordinates of the calibration object in the camera's captured image by using a corner point detection method;
[0009] Based on the world coordinates and image coordinates of the calibration object in the image captured by the camera, determine the feature matrix corresponding to the camera, and perform perspective transformation on the feature matrix to obtain the target image corresponding to the camera;
[0010] The target images corresponding to each camera are deghosted and then spliced to obtain a bird's-eye view of the target object.
[0011] Furthermore, the image coordinates of the calibration object in the image captured by the camera are obtained by the following steps:
[0012] Get the intrinsic parameters and distortion parameters of the camera;
[0013] De-distorting the image captured by the camera using the internal parameters and distortion parameters of the camera to obtain a distorted image of the camera;
[0014] The distorted image of the camera is converted into a grayscale image, and edge detection is performed on the calibration object in the grayscale image of the camera to obtain the contour of the calibration object;
[0015] Based on the calibration object contour, determine the perimeter of the calibration object contour, and perform polygon fitting on the calibration object based on the perimeter of the calibration object contour to obtain vertex coordinates of the calibration object;
[0016] Determining whether the number of vertex coordinates of the calibration object is a preset number;
[0017] If so, the vertex coordinates of the calibration object are determined as the image coordinates of the calibration object in the image captured by the camera.
[0018] Furthermore, the step of determining the feature matrix corresponding to the camera based on the world coordinates and image coordinates of the calibration object in the image captured by the camera includes:
[0019] The world coordinates and image coordinates of the calibration object in the image captured by the camera are input into the projection perspective transformation matrix function of the cross-platform computer vision library to obtain the feature matrix corresponding to the camera output by the projection perspective transformation matrix function.
[0020] Furthermore, the step of performing perspective transformation on the feature matrix to obtain a target image corresponding to the camera includes:
[0021] The feature matrix is input into the perspective transformation function of the cross-platform computer vision library to obtain the target image corresponding to the camera output by the perspective transformation function.
[0022] Furthermore, the step of removing ghosting from the target images corresponding to each camera and then splicing them to obtain a bird's-eye view of the target object includes:
[0023] Based on the images captured by each camera, an overlapping area between every two captured images is obtained;
[0024] The two target images corresponding to each overlapping area are cropped to obtain a residual image and a cropped image of each target image; wherein the residual image is an image after removing the overlapping area from the target image, and the cropped image is the overlapping area cropped from the target image;
[0025] Convert each cropped image into an image type to obtain a converted image corresponding to each cropped image;
[0026] Get the weight image corresponding to each overlapping area;
[0027] For each overlapping area, based on the conversion image corresponding to the overlapping area and the weight image corresponding to the overlapping area, a processed image corresponding to the overlapping area is obtained;
[0028] The processed image corresponding to each overlapping area is spliced with each remaining image to obtain a bird's-eye view of the target object.
[0029] Further, the weight image corresponding to each overlapping area is obtained through the following steps;
[0030] Perform grayscale conversion on each overlapping area to obtain a grayscale area image corresponding to each overlapping area;
[0031] Binarize the grayscale region image to obtain a binary image corresponding to each grayscale region image;
[0032] Performing dilation processing on each binary image to determine the obstacle contour and obtain the perimeter of the obstacle contour;
[0033] Based on the perimeter of the obstacle outline, polygon fitting is performed on the obstacle outline to obtain a target frame;
[0034] For each overlapping area, each pixel in the overlapping area is traversed, and a weight matrix formed by a set of distances from each pixel to the target frame is determined as a weight image corresponding to the overlapping area.
[0035] Furthermore, the step of obtaining a processed image corresponding to the overlapping area based on the two cropped images corresponding to the overlapping area and the weighted image corresponding to the overlapping area includes:
[0036] Based on the two cropped images corresponding to the overlapping area and the weight image corresponding to the overlapping area, a product of a first cropped image of the two cropped images and the weight image is determined as a first image;
[0037] Subtracting the number one from the weight value of each pixel in the weight image to obtain a second image;
[0038] Determine a third image by multiplying a second cropped image of the two cropped images and the second image;
[0039] The sum of the first image and the third image is determined as a processed image corresponding to the overlapping area.
[0040] In a second aspect, an embodiment of the present application further provides a device for generating a bird's-eye view, the device comprising:
[0041] An acquisition module is used to acquire images captured by each camera on the target object;
[0042] A determination module is used to obtain the world coordinates of the calibration object in the image taken by each camera, and obtain the image coordinates of the calibration object in the image taken by the camera by using a corner point detection method;
[0043] A processing module, used to determine a feature matrix corresponding to the camera based on the world coordinates and image coordinates of the calibration object in the image captured by the camera, and perform a projection transformation on the feature matrix to obtain a target image corresponding to the camera;
[0044] The generation module is used to remove ghosting from the target image corresponding to each camera and then splice it to obtain a bird's-eye view of the target object.
[0045] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the method for generating a bird's-eye view as described above are performed.
[0046] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the method for generating a bird's-eye view as described above are executed.
[0047] The embodiments of the present application provide a method, device, electronic device and storage medium for generating a bird's-eye view, and the generation method includes: obtaining images captured by each camera on a target object; for each camera's image, obtaining the world coordinates of a calibration object in the camera's image, and obtaining the image coordinates of the calibration object in the camera's image by a corner detection method; based on the world coordinates and image coordinates of the calibration object in the camera's image, determining a feature matrix corresponding to the camera, performing a perspective transformation on the feature matrix to obtain a target image corresponding to the camera; and removing ghosting from the target images corresponding to each camera and then splicing them to obtain a bird's-eye view of the target object.
[0048] In this way, the technical solution provided by the present application can automatically obtain high-accuracy image coordinates through the corner detection method, and can determine the accurate feature matrix when using the image coordinates for feature matching. The target image is obtained by performing perspective transformation according to the feature matrix, and each target image is de-ghosted and then spliced to obtain a bird's-eye view. The ghosting problem in the bird's-eye view is optimized, thereby improving the accuracy and clarity of the generated bird's-eye view.
[0049] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0051] Figure 1 A flowchart of a method for generating a bird's-eye view provided in an embodiment of the present application is shown;
[0052] Figure 2 A flowchart showing another method for generating a bird's-eye view provided in an embodiment of the present application is shown;
[0053] Figure 3 One of the structural schematic diagrams of a device for generating a bird's-eye view provided in an embodiment of the present application is shown;
[0054] Figure 4 A second structural schematic diagram of a device for generating a bird's-eye view provided in an embodiment of the present application is shown;
[0055] Figure 5 A schematic structural diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0056] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art, under the guidance of the content of the present application, can add one or more other operations to the flowchart, or remove one or more operations from the flowchart.
[0057] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0058] In order to enable those skilled in the art to use the contents of this application, the following implementation methods are provided in combination with a specific application scenario "generation of a bird's-eye view". For those skilled in the art, the general principles defined herein can be applied to other embodiments and application scenarios without departing from the spirit and scope of this application.
[0059] The following methods, devices, electronic devices or computer-readable storage media of the embodiments of the present application can be applied to any scenario where a bird's-eye view needs to be generated. The embodiments of the present application are not limited to specific application scenarios. Any scheme using a method, device, electronic device and storage medium for generating a bird's-eye view provided by the embodiments of the present application is within the scope of protection of the present application.
[0060] Based on this, the present application proposes a method, device, electronic device and storage medium for generating a bird's-eye view, the generation method comprising: obtaining images captured by each camera on the target object; for each camera's image, obtaining the world coordinates of the calibrated object in the camera's image, and obtaining the image coordinates of the calibrated object in the camera's image through a corner detection method; based on the world coordinates and image coordinates of the calibrated object in the camera's image, determining the feature matrix corresponding to the camera, performing a perspective transformation on the feature matrix to obtain a target image corresponding to the camera; removing ghosting from the target image corresponding to each camera and then splicing them to obtain a bird's-eye view of the target object.
[0061] In this way, the technical solution provided by the present application can automatically obtain high-accuracy image coordinates through the corner detection method, and can determine the accurate feature matrix when using the image coordinates for feature matching. The target image is obtained by performing perspective transformation according to the feature matrix, and each target image is de-ghosted and then spliced to obtain a bird's-eye view. The ghosting problem in the bird's-eye view is optimized, thereby improving the accuracy and clarity of the generated bird's-eye view.
[0062] To facilitate understanding of the embodiments of the present application, a method for generating a bird's-eye view disclosed in the embodiments of the present application is first introduced in detail.
[0063] See also Figure 1 , Figure 1 A flowchart of a method for generating a bird's-eye view provided in an embodiment of the present application is shown in FIG. Figure 1 As shown in , the generation method includes:
[0064] S101, obtaining images captured by each camera on the target object;
[0065] In this step, the target object may be a vehicle, and images captured by each camera on the vehicle body are obtained. Generally, a camera is set at the front, rear, left and right sides of the vehicle body. This implementation is explained using the four cameras on the vehicle as an example.
[0066] S102, for each camera's captured image, obtaining the world coordinates of the calibration object in the camera's captured image, and obtaining the image coordinates of the calibration object in the camera's captured image by using a corner point detection method;
[0067] In this step, the world coordinates can be obtained by vehicle calibration. Any method of obtaining world coordinates can be used. For obtaining image coordinates, please refer to Figure 2 , Figure 2 A flowchart of another method for generating a bird's-eye view provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the image coordinates of the calibration object in the image captured by the camera are obtained through the following steps:
[0068] S201, obtaining the internal parameters and distortion parameters of the camera;
[0069] S202, performing dedistortion processing on the image captured by the camera using the internal parameters and distortion parameters of the camera to obtain a distorted image of the camera;
[0070] S203, converting the distorted image of the camera into a grayscale image, and performing edge detection on the calibration object in the grayscale image of the camera to obtain the contour of the calibration object;
[0071] S204, determining the perimeter of the calibration object contour based on the calibration object contour, and performing polygon fitting on the calibration object based on the perimeter of the calibration object contour to obtain vertex coordinates of the calibration object;
[0072] S205, determining whether the number of vertex coordinates of the calibration object is a preset number;
[0073] S206: If yes, determine the vertex coordinates of the calibration object as the image coordinates of the calibration object in the image captured by the camera.
[0074] In the above steps S201 to S206, calibration can be performed using calibration cloth and other calibration objects. Only when edge detection is performed can the image contour be detected. The obtained camera intrinsic parameters and distortion parameters are provided by the camera manufacturer. The camera intrinsic parameters and distortion parameters are used to obtain the dedistorted image, and the dedistorted image is converted into a grayscale image. The grayscale image is edge detected to find the contour of the calibration object, determine the perimeter of the contour of the calibration object, and perform polygon fitting on the calibration object. After polygon fitting, several vertex coordinates will be returned. In this embodiment, when the returned vertex coordinates are four, they are the automatic point search coordinates (image coordinates) we need. Repeat the above steps for the images captured by the front, back, left and right cameras respectively to obtain the image coordinates corresponding to each camera.
[0075] S103, determining a feature matrix corresponding to the camera based on the world coordinates and image coordinates of the calibration object in the image captured by the camera, and performing perspective transformation on the feature matrix to obtain a target image corresponding to the camera;
[0076] In this step, the feature matrix is calculated using the world coordinates and the image coordinates, and a projection transformation is performed to obtain the bird's-eye view (target image) of the current camera.
[0077] It should be noted that the step of determining the feature matrix corresponding to the camera based on the world coordinates and image coordinates of the calibration object in the image captured by the camera includes:
[0078] 1. Input the world coordinates and image coordinates of the calibration object in the image captured by the camera into the projection perspective transformation matrix function of the cross-platform computer vision library to obtain the feature matrix corresponding to the camera output by the projection perspective transformation matrix function.
[0079] In this step, the projection perspective transformation matrix function getPerspectiveTransform is used in the cross-platform computer vision library Opencv to calculate the feature matrix based on the world coordinates and the image coordinates.
[0080] It should be noted that the step of performing perspective transformation on the feature matrix to obtain the target image corresponding to the camera includes:
[0081] 1) Input the feature matrix into the perspective transformation function of the cross-platform computer vision library to obtain the target image corresponding to the camera output by the perspective transformation function.
[0082] In this step, the perspective transformation function wrapPerspective is used in Opencv to perform projection changes based on the calculated feature matrix to obtain the bird's-eye view (target image) corresponding to the camera.
[0083] S104, removing ghost images from the target images corresponding to each camera and then splicing them to obtain a bird's-eye view of the target object.
[0084] In this step, the ghosting of the image is because, for example, the images obtained by the four fisheye cameras in the front, back, left and right have some overlapping parts. After obtaining the bird's-eye view of the four cameras in the front, back, left and right, ghosting will occur in the four corners of the stitched image, so a de-ghosting operation is required.
[0085] It should be noted that the step of removing ghosting from the target images corresponding to each camera and then splicing them to obtain a bird's-eye view of the target object includes:
[0086] S1041, based on the images captured by each camera, obtaining an overlapping area between every two captured images;
[0087] S1042, cropping the two target images corresponding to each overlapping area to obtain a remaining image and a cropped image of each target image;
[0088] In this step, the remaining image is the image after the overlapping area is removed from the target image, and the cropped image is the overlapping area cropped from the target image.
[0089] S1043, performing image type conversion on each cropped image to obtain a converted image corresponding to each cropped image;
[0090] In the above steps S1041 to S1043, the images captured by the front, rear, left and right cameras are cropped respectively, and the part corresponding to the size of the weighted image is obtained, and the image type conversion is performed on this part, which should be converted to CV_32F type (range 0-1); the original image type is CV_8U (range 0-255). If the images are added directly, the range will exceed 255, resulting in incorrect image color.
[0091] S1044, obtaining a weight image corresponding to each overlapping area;
[0092] It should be noted that the weight image corresponding to each overlapping area is obtained through the following steps;
[0093] (1) Perform grayscale conversion on each overlapping area to obtain a grayscale area image corresponding to each overlapping area;
[0094] (2) Binarizing the grayscale region image to obtain a binary image corresponding to each grayscale region image;
[0095] (3) dilating each binary image to determine the obstacle contour and obtain the perimeter of the obstacle contour;
[0096] (4) Based on the perimeter of the obstacle contour, polygon fitting is performed on the obstacle contour to obtain a target frame;
[0097] (5) For each overlapping area, traverse each pixel in the overlapping area, and determine the weight matrix composed of the set of distances from each pixel to the target frame as the weight image corresponding to the overlapping area.
[0098] In the above steps (1) to (5), the weight image is obtained. First, the overlapping area image is obtained (for example, the overlapping area is the overlapping area between the front camera and the left camera image), and then the overlapping area image is converted into a grayscale image. Figure 2 The binary image is then dilated to find the image contour, obtain the contour perimeter, and perform polygon fitting on the image contour. Finally, each pixel point is traversed to obtain the distance between each point and the polygon (the coordinate range of the point is 0-255), and the set of distances between the points and the polygon is determined as a weight matrix. There are four overlapping areas in total, namely the overlapping area between the front camera and the left camera, the overlapping area between the front camera and the side camera, the overlapping area between the rear camera and the left camera, and the overlapping area between the rear camera and the right camera. The above steps need to be repeated to calculate four weight matrices.
[0099] S1045. For each overlapping region, based on the conversion image corresponding to the overlapping region and the weight image corresponding to the overlapping region, obtain a processed image corresponding to the overlapping region;
[0100] It should be noted that the step of obtaining the processed image corresponding to the overlapping area based on the two cropped images corresponding to the overlapping area and the weighted image corresponding to the overlapping area includes:
[0101] ①, based on the two cropped images corresponding to the overlapping area and the weight image corresponding to the overlapping area, the product of the first cropped image of the two cropped images and the weight image is determined as the first image;
[0102] ②, subtract the number 1 from the weight value of each pixel in the weight image to obtain a second image;
[0103] ③, multiplying the second cropped image of the two cropped images and the second image to determine the third image;
[0104] ④. Determine the sum of the first image and the third image as the processed image corresponding to the overlapping area.
[0105] In the above steps ① to ④, as an example, the front camera image and the left camera image are selected for calculation, and the calculation method is: (front camera image * weight image) + (left camera image * (1-weight image)); it needs to be repeated four times to calculate the front camera and left camera images, the front camera and right camera images, the rear camera and left camera images, and the rear camera and right camera images respectively.
[0106] S1046: splice the processed image corresponding to each overlapping area with each remaining image to obtain a bird's-eye view of the target object.
[0107] In this step, the image calculated by the above steps and the remaining image after cropping are spliced together to obtain a top view centered on the target vehicle without ghosting, that is, a bird's-eye view of the target object. This embodiment uses the Opencv corner detection automatic point finding method to obtain accurate image coordinates. When using the image coordinates for feature matching, an accurate homography matrix can be calculated. A bird's-eye view is obtained by performing perspective transformation based on the homography matrix. Finally, ghosting removal is performed, and the images of the four cameras in front, behind, left and right are spliced to obtain a corresponding top view around the vehicle. It can be seen that the ghosting of the four corners of the vehicle is optimized.
[0108] A method for generating a bird's-eye view is provided in an embodiment of the present application. The method comprises: obtaining images captured by each camera on a target object; for each camera image, obtaining the world coordinates of a calibration object in the camera image, and obtaining the image coordinates of the calibration object in the camera image by a corner detection method; based on the world coordinates and image coordinates of the calibration object in the camera image, determining a feature matrix corresponding to the camera, performing a perspective transformation on the feature matrix to obtain a target image corresponding to the camera; and removing ghosting from the target images corresponding to each camera and then splicing them to obtain a bird's-eye view of the target object.
[0109] In this way, the technical solution provided by the present application can automatically obtain high-accuracy image coordinates through the corner detection method, and can determine the accurate feature matrix when using the image coordinates for feature matching. The target image is obtained by performing perspective transformation according to the feature matrix, and each target image is de-ghosted and then spliced to obtain a bird's-eye view. The ghosting problem in the bird's-eye view is optimized, thereby improving the accuracy and clarity of the generated bird's-eye view.
[0110] Based on the same inventive concept, an embodiment of the present application also provides a device for generating a bird's-eye view corresponding to the above-mentioned method for generating a bird's-eye view. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the above-mentioned method in the embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0111] See also Figure 3 , Figure 4 , Figure 3 This is one of the structural schematic diagrams of a device for generating a bird's-eye view provided in an embodiment of the present application. Figure 4 The second structural diagram of a device for generating a bird's-eye view provided in an embodiment of the present application is as follows: Figure 3 As shown in , the generating device 310 includes:
[0112] An acquisition module 311 is used to acquire images captured by each camera on the target object;
[0113] A determination module 312 is used to obtain the world coordinates of the calibration object in the image taken by each camera, and obtain the image coordinates of the calibration object in the image taken by the camera by using a corner point detection method;
[0114] The processing module 313 is used to determine the feature matrix corresponding to the camera based on the world coordinates and image coordinates of the calibration object in the image captured by the camera, and perform a projection transformation on the feature matrix to obtain a target image corresponding to the camera;
[0115] The generation module 314 is used to remove ghosting from the target image corresponding to each camera and then splice it to obtain a bird's-eye view of the target object.
[0116] Optionally, when the determination module 312 is used to obtain the image coordinates of the calibration object in the image captured by the camera, the determination module 312 is specifically used to:
[0117] Get the intrinsic parameters and distortion parameters of the camera;
[0118] De-distorting the image captured by the camera using the internal parameters and distortion parameters of the camera to obtain a distorted image of the camera;
[0119] The distorted image of the camera is converted into a grayscale image, and edge detection is performed on the calibration object in the grayscale image of the camera to obtain the contour of the calibration object;
[0120] Based on the calibration object contour, determine the perimeter of the calibration object contour, and perform polygon fitting on the calibration object based on the perimeter of the calibration object contour to obtain vertex coordinates of the calibration object;
[0121] Determining whether the number of vertex coordinates of the calibration object is a preset number;
[0122] If so, the vertex coordinates of the calibration object are determined as the image coordinates of the calibration object in the image captured by the camera.
[0123] Optionally, when the processing module 313 is used to determine the feature matrix corresponding to the camera based on the world coordinates and image coordinates of the calibration object in the image captured by the camera, the processing module 313 is specifically used to:
[0124] The world coordinates and image coordinates of the calibration object in the image captured by the camera are input into the projection perspective transformation matrix function of the cross-platform computer vision library to obtain the feature matrix corresponding to the camera output by the projection perspective transformation matrix function.
[0125] Optionally, when the processing module 313 is used to perform perspective transformation on the feature matrix to obtain a target image corresponding to the camera, the processing module 313 is specifically used to:
[0126] The feature matrix is input into the perspective transformation function of the cross-platform computer vision library to obtain the target image corresponding to the camera output by the perspective transformation function.
[0127] Optionally, when the generating module 314 is used to remove ghosting from the target images corresponding to each camera and then splice them to obtain a bird's-eye view of the target object, the generating module 314 is specifically used to:
[0128] Based on the images captured by each camera, an overlapping area between every two captured images is obtained;
[0129] The two target images corresponding to each overlapping area are cropped to obtain a residual image and a cropped image of each target image; wherein the residual image is an image after removing the overlapping area from the target image, and the cropped image is the overlapping area cropped from the target image;
[0130] Convert each cropped image into an image type to obtain a converted image corresponding to each cropped image;
[0131] Get the weight image corresponding to each overlapping area;
[0132] For each overlapping area, based on the conversion image corresponding to the overlapping area and the weight image corresponding to the overlapping area, a processed image corresponding to the overlapping area is obtained;
[0133] The processed image corresponding to each overlapping area is spliced with each remaining image to obtain a bird's-eye view of the target object.
[0134] Optional, such as Figure 4As shown, the generating device 310 further includes a preprocessing module 315, and the preprocessing module 315 is used to:
[0135] Perform grayscale conversion on each overlapping area to obtain a grayscale area image corresponding to each overlapping area;
[0136] Binarize the grayscale region image to obtain a binary image corresponding to each grayscale region image;
[0137] Performing dilation processing on each binary image to determine the obstacle contour and obtain the perimeter of the obstacle contour;
[0138] Based on the perimeter of the obstacle outline, polygon fitting is performed on the obstacle outline to obtain a target frame;
[0139] For each overlapping area, each pixel in the overlapping area is traversed, and a weight matrix formed by a set of distances from each pixel to the target frame is determined as a weight image corresponding to the overlapping area.
[0140] Optionally, when the generating module 314 is used to remove ghosting from the target images corresponding to each camera and then splice them to obtain a bird's-eye view of the target object, the generating module 314 is specifically used to:
[0141] Based on the two cropped images corresponding to the overlapping area and the weight image corresponding to the overlapping area, a product of a first cropped image of the two cropped images and the weight image is determined as a first image;
[0142] Subtracting the number one from the weight value of each pixel in the weight image to obtain a second image;
[0143] Determine a third image by multiplying a second cropped image of the two cropped images and the second image;
[0144] The sum of the first image and the third image is determined as a processed image corresponding to the overlapping area.
[0145] An embodiment of the present application provides a device for generating a bird's-eye view, and the device includes: an acquisition module, used to acquire images captured by each camera on a target object; a determination module, used to acquire the world coordinates of a calibration object in the image captured by each camera, and to acquire the image coordinates of the calibration object in the image captured by the camera by using a corner detection method; a processing module, used to determine a feature matrix corresponding to the camera based on the world coordinates and image coordinates of the calibration object in the image captured by the camera, and to perform a projection transformation on the feature matrix to obtain a target image corresponding to the camera; and a generation module, used to remove ghosting and then splice the target images corresponding to each camera to obtain a bird's-eye view of the target object.
[0146] In this way, the technical solution provided by the present application can automatically obtain high-accuracy image coordinates through the corner detection method, and can determine the accurate feature matrix when using the image coordinates for feature matching. The target image is obtained by performing perspective transformation according to the feature matrix, and each target image is de-ghosted and then spliced to obtain a bird's-eye view. The ghosting problem in the bird's-eye view is optimized, thereby improving the accuracy and clarity of the generated bird's-eye view.
[0147] See also Figure 5 , Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 5 As shown in , the electronic device 500 includes a processor 510 , a memory 520 and a bus 530 .
[0148] The memory 520 stores machine-readable instructions executable by the processor 510. When the electronic device 500 is running, the processor 510 communicates with the memory 520 via the bus 530. When the machine-readable instructions are executed by the processor 510, the above-mentioned Figure 1 to Figure 2 The steps of the method for generating a bird's-eye view in the method embodiment shown, and the specific implementation method can be found in the method embodiment, which will not be repeated here.
[0149] The present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the computer program can execute the above-mentioned Figure 1 to Figure 2 The steps of the method for generating a bird's-eye view in the method embodiment shown, and the specific implementation method can be found in the method embodiment, which will not be repeated here.
[0150] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0151] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0152] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0153] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0154] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application can essentially be embodied in the form of a software product, or in other words, the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0155] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A method for generating a bird's-eye view, characterized in that: The generation method comprises: Obtain images captured by each camera on the target object; For each camera's captured image, obtain the world coordinates of the calibration object in the camera's captured image, and obtain the image coordinates of the calibration object in the camera's captured image by using a corner point detection method; Based on the world coordinates and image coordinates of the calibration object in the image captured by the camera, determine the feature matrix corresponding to the camera, and perform perspective transformation on the feature matrix to obtain the target image corresponding to the camera; The target images corresponding to each camera are deghosted and then spliced to obtain a bird's-eye view of the target object.
2. The generation method according to claim 1, characterized in that: Obtain the image coordinates of the calibration object in the image captured by the camera through the following steps: Get the intrinsic parameters and distortion parameters of the camera; De-distorting the image captured by the camera using the internal parameters and distortion parameters of the camera to obtain a distorted image of the camera; The distorted image of the camera is converted into a grayscale image, and edge detection is performed on the calibration object in the grayscale image of the camera to obtain the contour of the calibration object; Based on the calibration object contour, determine the perimeter of the calibration object contour, and perform polygon fitting on the calibration object based on the perimeter of the calibration object contour to obtain vertex coordinates of the calibration object; Determining whether the number of vertex coordinates of the calibration object is a preset number; If so, the vertex coordinates of the calibration object are determined as the image coordinates of the calibration object in the image captured by the camera.
3. The generation method according to claim 1, characterized in that: The step of determining the feature matrix corresponding to the camera based on the world coordinates and the image coordinates of the calibration object in the image captured by the camera includes: The world coordinates and image coordinates of the calibration object in the image captured by the camera are input into the projection perspective transformation matrix function of the cross-platform computer vision library to obtain the feature matrix corresponding to the camera output by the projection perspective transformation matrix function.
4. The generation method according to claim 1, characterized in that: The step of performing perspective transformation on the feature matrix to obtain a target image corresponding to the camera includes: The feature matrix is input into the perspective transformation function of the cross-platform computer vision library to obtain the target image corresponding to the camera output by the perspective transformation function.
5. The generation method according to claim 1, characterized in that: The step of removing ghosting from the target images corresponding to each camera and then splicing them to obtain a bird's-eye view of the target object comprises: Based on the images captured by each camera, an overlapping area between every two captured images is obtained; The two target images corresponding to each overlapping area are cropped to obtain a residual image and a cropped image of each target image; wherein the residual image is an image after removing the overlapping area from the target image, and the cropped image is the overlapping area cropped from the target image; Convert each cropped image into an image type to obtain a converted image corresponding to each cropped image; Get the weight image corresponding to each overlapping area; For each overlapping area, based on the conversion image corresponding to the overlapping area and the weight image corresponding to the overlapping area, a processed image corresponding to the overlapping area is obtained; The processed image corresponding to each overlapping area is spliced with each remaining image to obtain a bird's-eye view of the target object.
6. The generation method according to claim 5, characterized in that: Obtain the weight image corresponding to each overlapping area through the following steps; Perform grayscale conversion on each overlapping area to obtain a grayscale area image corresponding to each overlapping area; Binarize the grayscale region image to obtain a binary image corresponding to each grayscale region image; Performing dilation processing on each binary image to determine the obstacle contour and obtain the perimeter of the obstacle contour; Based on the perimeter of the obstacle outline, polygon fitting is performed on the obstacle outline to obtain a target frame; For each overlapping area, each pixel in the overlapping area is traversed, and a weight matrix formed by a set of distances from each pixel to the target frame is determined as a weight image corresponding to the overlapping area.
7. The generation method according to claim 5, characterized in that: The step of obtaining a processed image corresponding to the overlapping area based on the two cropped images corresponding to the overlapping area and the weighted image corresponding to the overlapping area comprises: Based on the two cropped images corresponding to the overlapping area and the weight image corresponding to the overlapping area, a product of a first cropped image of the two cropped images and the weight image is determined as a first image; Subtracting the number one from the weight value of each pixel in the weight image to obtain a second image; Determine a third image by multiplying a second cropped image of the two cropped images and the second image; The sum of the first image and the third image is determined as a processed image corresponding to the overlapping area.
8. A device for generating a bird's-eye view, characterized in that: The generating device comprises: An acquisition module is used to acquire images captured by each camera on the target object; A determination module is used to obtain the world coordinates of the calibration object in the image taken by each camera, and obtain the image coordinates of the calibration object in the image taken by the camera by using a corner point detection method; A processing module, used to determine a feature matrix corresponding to the camera based on the world coordinates and image coordinates of the calibration object in the image captured by the camera, and perform a projection transformation on the feature matrix to obtain a target image corresponding to the camera; The generation module is used to remove ghosting from the target image corresponding to each camera and then splice it to obtain a bird's-eye view of the target object.
9. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and the machine-readable instructions are executed by the processor to execute the steps of the method for generating a bird's-eye view as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for generating a bird's-eye view according to any one of claims 1 to 7 are executed.
