IPM image generation method, device, equipment and computer-readable storage medium
By using buffer objects and hardware parallel processing in parking space detection, and using predetermined mapping relationships to generate IPM images, the problem of long time-consuming IPM image generation is solved and the real-time performance and efficiency of parking space detection are improved.
Patent Information
- Application Number
- CN202410951589.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-16
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2044-07-16
AI Technical Summary
In the existing technology, the generation of IPM images in visual parking space detection takes a long time, resulting in poor real-time performance of parking space detection.
By importing buffer objects, using specific application programming interfaces and hardware parallel processing, IPM images are generated, using predetermined mapping relationships to reduce repeated calculations, and combining OpenCL or OpenGL for hardware acceleration to reduce CPU usage.
It improves the efficiency of IPM image generation, improves the real-time performance of parking space detection, and effectively reduces CPU usage.
Smart Images

Figure CN118485738B
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent parking technology, and in particular to an IPM image generation method, device, equipment and computer-readable storage medium. Background Art
[0002] During the parking process, parking space detection is required, among which visual parking space detection is a common parking space detection method. In visual parking space detection, the most commonly used method is through IPM transformation, that is, transforming the original four-way AVM camera fisheye image into a bird's-eye view effect image, which is often called a BEV view or an IPM view.
[0003] Since IPM view generation is required for each frame of the image used for parking space detection, it is time-consuming and has become an important factor limiting the real-time requirements of parking space detection. Summary of the invention
[0004] The present application provides an IPM image generation method, device, equipment and computer-readable storage medium, which can solve the technical problem of poor real-time parking space detection in the prior art.
[0005] In a first aspect, an embodiment of the present application provides an IPM image generation method, the IPM image generation method comprising:
[0006] Importing a first file descriptor corresponding to the first buffer, a second file descriptor corresponding to the second buffer, and a third file descriptor corresponding to the third buffer into the context of a specific application programming interface to obtain a buffer object, wherein the first buffer is used to store a first mapping relationship, which is a mapping map between a camera image and an IPM image, the second buffer is used to store the camera image, and the third buffer is used to store the IPM image;
[0007] The buffer object is passed to the kernel so that the kernel uses a specific application programming interface plus specific hardware parallel processing to obtain an IPM image based on the buffer object and store it in a third buffer. The specific hardware is a GPU or a DSP.
[0008] In combination with the first aspect, in one implementation, before the step of importing the first file descriptor corresponding to the first buffer, the second file descriptor corresponding to the second buffer, and the third file descriptor corresponding to the third buffer into the context of a specific application programming interface to obtain a buffer object, the method further includes:
[0009] A first mapping relationship is generated and stored in a first buffer.
[0010] In combination with the first aspect, in one implementation, the step of generating the first mapping relationship includes:
[0011] Calibrate camera internal parameters and camera external parameters;
[0012] Establishing a second mapping relationship, where the second mapping relationship is a mapping relationship between a BEV map and a standard IPM image, the BEV map is a rectangular area in a vehicle body coordinate system, the center of the rectangular area is the coordinate of the center of the vehicle in the vehicle body coordinate system, and the rectangular area is within the field of view of the camera;
[0013] According to the camera's field of view, the corresponding relationship between the camera and the mapping area in the BEV map is determined. The mapping area includes a non-overlapping area and an overlapping area. The non-overlapping area has only one camera's field of view, and the overlapping area has two cameras' fields of view.
[0014] For any pixel point to be mapped in the standard IPM image, determine, based on the second mapping relationship, a first coordinate corresponding to the pixel point to be mapped in the BEV map and a second coordinate of the pixel point to be mapped in the vehicle body coordinate system;
[0015] Determine the fusion weight corresponding to the pixel to be mapped based on the mapping area where the first coordinate is located;
[0016] Determine a sub-mapping relationship between the pixel point to be mapped and the image pixel point based on the camera intrinsic parameter, the camera extrinsic parameter, the fusion weight and the second coordinate, wherein the image pixel point is a pixel point in the standard camera image;
[0017] By analogy, the sub-mapping relationship between each pixel point to be mapped and the image pixel point in the standard IPM image is determined;
[0018] All sub-mapping relationships are combined to obtain the first mapping relationship.
[0019] In combination with the first aspect, in one implementation, the resolution of the mapping map is in the form of m×n, where m and n are both positive integers greater than 1, and the step of obtaining the IPM image based on the buffer object is:
[0020] For the pixel points in the IPM image, based on the first mapping relationship, mapping is performed once every (m-1) pixel spacing in the horizontal direction, and mapping is performed once every (n-1) pixel spacing in the vertical direction, to obtain a preliminary IPM image;
[0021] The blank pixels in the preliminary IPM image are interpolated to obtain the IPM image.
[0022] In combination with the first aspect, in one implementation, after the step of importing the first file descriptor corresponding to the first buffer, the second file descriptor corresponding to the second buffer, and the third file descriptor corresponding to the third buffer into the context of a specific application programming interface to obtain a buffer object, the method further includes:
[0023] The parameters and buffer objects used for normalization processing are passed to the kernel, so that the kernel uses a specific application programming interface plus a specific hardware parallel processing method to obtain an IPM image based on the parameters and buffer objects used for normalization processing and store it in a third buffer.
[0024] In combination with the first aspect, in one implementation, the step of obtaining the IPM image based on the parameters for normalization processing and the buffer object includes:
[0025] Mapping the camera image based on the first mapping relationship to obtain a mapping result;
[0026] The mapping results are converted into color space, separated into color channels and normalized to obtain the IPM image.
[0027] In combination with the first aspect, in one implementation, the specific application programming interface is OpenCL or OpenGL.
[0028] In a second aspect, an embodiment of the present application provides an IPM image generation device, the IPM image generation device comprising:
[0029] An import module, used for importing a first file descriptor corresponding to the first buffer, a second file descriptor corresponding to the second buffer, and a third file descriptor corresponding to the third buffer into the context of a specific application programming interface to obtain a buffer object, wherein the first buffer is used to store a first mapping relationship, the first mapping relationship being a mapping map between a camera image and an IPM image, the second buffer is used to store the camera image, and the third buffer is used to store the IPM image;
[0030] The processing module is used to pass the buffer object to the kernel, so that the kernel uses a specific application programming interface plus specific hardware parallel processing to obtain an IPM image based on the buffer object and store it in a third buffer. The specific hardware is a GPU or a DSP.
[0031] In a third aspect, an embodiment of the present application provides an IPM image generating device, comprising a processor, a memory, and an IPM image generating program stored in the memory and executable by the processor, wherein when the IPM image generating program is executed by the processor, the steps of the IPM image generating method described in the first aspect are implemented.
[0032] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which an IPM image generation program is stored, wherein when the IPM image generation program is executed by a processor, the steps of the IPM image generation method described in the first aspect are implemented.
[0033] The beneficial effects brought by the technical solution provided in the embodiments of the present application include:
[0034] In an embodiment of the present application, a first file descriptor corresponding to the first buffer, a second file descriptor corresponding to the second buffer, and a third file descriptor corresponding to the third buffer are imported into the context of a specific application programming interface to obtain a buffer object, wherein the first buffer is used to store a first mapping relationship, the first mapping relationship being a mapping map between a camera image and an IPM image, the second buffer is used to store camera images, and the third buffer is used to store IPM images; the buffer object is passed to the kernel so that the kernel uses a specific application programming interface plus specific hardware parallel processing to obtain an IPM image based on the buffer object and store it in the third buffer, wherein the specific hardware is a GPU or a DSP. Through an embodiment of the present application, each time an IPM image is generated, the stored mapping map is used, and there is no need to repeatedly determine the mapping map, thereby improving the efficiency of IPM image generation, thereby improving the real-time performance of parking space detection, and using a specific application programming interface plus specific hardware parallel processing to perform mapping can effectively reduce CPU occupancy. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 This is a flow chart of an embodiment of an IPM image generation method of the present application;
[0036] Figure 2 A schematic diagram of a scenario for dividing the mapping area of a BEV map;
[0037] Figure 3 Schematic diagram of the fusion weight calculation scene;
[0038] Figure 4 is a schematic diagram of the preliminary IPM image;
[0039] Figure 5 This is a functional module diagram of an embodiment of an IPM image generating device of the present application;
[0040] Figure 6 This is a schematic diagram of the hardware structure of the IPM image generation device involved in the embodiment of the present application. DETAILED DESCRIPTION
[0041] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution 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. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0042] First, some technical terms in the present application are explained to facilitate those skilled in the art to understand the present application.
[0043] GPU: Graphics Processing Unit, graphics processor;
[0044] AVM: Around View Monitor, vehicle-mounted 360-degree panoramic system;
[0045] IPM: Inverse Perspective Mapping, a computer vision technique used to convert a perspective image into a bird's-eye view;
[0046] APA, Automatic Parking Assist, automatic parking assistance technology;
[0047] OpenCL, Open Computing Language, is an open standard API released by the Khronos Group for writing cross-platform, parallel computing programs.
[0048] DMA, Direct Memory Access, can effectively reduce CPU load;
[0049] Normalization: In order to eliminate data bias, enhance model generalization ability, accelerate convergence, etc., the input data of the model generally needs to be limited to a fixed range (achieved through parameters such as the mean, standard deviation, and zero bias of the data).
[0050] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0051] In a first aspect, an embodiment of the present application provides an IPM image generation method.
[0052] In one embodiment, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the IPM image generation method of the present application. Figure 1 As shown, the IPM image generation method includes:
[0053] Step S10, importing a first file descriptor corresponding to the first buffer, a second file descriptor corresponding to the second buffer, and a third file descriptor corresponding to the third buffer into the context of a specific application programming interface to obtain a buffer object, wherein the first buffer is used to store a first mapping relationship, the first mapping relationship being a mapping map between a camera image and an IPM image, the second buffer is used to store the camera image, and the third buffer is used to store the IPM image;
[0054] In this embodiment, a mapping map between the camera image and the IPM image is generated by a pre-calibrated manner and stored in a pre-allocated DMA buffer (ie, the first buffer), and then the first file descriptor dma_map_fd corresponding to the first buffer can be obtained.
[0055] The camera images include images taken by four fisheye cameras, which are stored in corresponding buffers, collectively referred to as the second buffer. The DMA file descriptors dam_fd1, dam_fd2, dam_fd3, and dam_fd4 of the buffers corresponding to the four fisheye cameras are exported through the v4l2_exportbuffer structure in the v4l2 library, collectively referred to as the second file descriptor.
[0056] A buffer is allocated for the IPM image, namely, the third buffer, which is used to store the IPM image in the third buffer after the IPM image is generated. Then, the file descriptor dma_out_fd of the third buffer can be exported.
[0057] On the basis of the above, taking the specific application programming interface OpenCL as an example, dam_fd1, dam_fd2, dam_fd3, dam_fd4, dma_map_fd and dma_out_fd are respectively imported into the context contex of OpenCL, and 6 buffer objects cl_mem corresponding to the 6 fds (dam_fd1, dam_fd2, dam_fd3, dam_fd4, dma_map_fd, dma_out_fd) are obtained. For the convenience of description, they are recorded as cl_mem_1~cl_mem_6.
[0058] It should be noted that, taking the specific application programming interface as OpenCL as an example, before step S10, an initialization action needs to be performed:
[0059] Initialize camera-related configurations to prepare for subsequent reading of camera data.
[0060] Initialize the OpenCL-related environment, including cl_platform, cl_device, cl_context, cl_command_queue, cl_event, etc. Then build cl_program according to the input and output image formats, and compile the corresponding cl_kernel.
[0061] Step S20, passing the buffer object to the kernel, so that the kernel uses a specific application programming interface plus specific hardware parallel processing to obtain an IPM image based on the buffer object and store it in a third buffer, wherein the specific hardware is a GPU or a DSP.
[0062] In this embodiment, combined with the description of step S10, the specific application programming interface is taken as OpenCL as an example. The six buffer objects cl_mem are passed to the kernel cl_kernel, and the kernel cl_kernel uses OpenCL plus specific hardware parallel processing to read the images captured by the four fisheye cameras based on the four buffer objects cl_mem_1~cl_mem_4 corresponding to dam_fd1, dam_fd2, dam_fd3, and dam_fd4, and then map the images captured by the four fisheye cameras through the mapping map read based on the buffer object cl_mem_5 corresponding to dma_map_fd to obtain the IPM image, and finally store the IPM image in the third buffer based on the buffer object cl_mem6 corresponding to dma_out_fd.
[0063] Among them, specific hardware selects platforms suitable for parallel computing, such as GPU or DSP, to effectively reduce CPU occupancy.
[0064] It should be noted that the OpenCL in the above embodiment can be replaced by OpenGL, and the calculation process uses ComputeShader to replace the kernel function in OpenCL. OpenGL also supports input and output using DMA zero-copy mode.
[0065] In an embodiment of the present application, a first file descriptor corresponding to the first buffer, a second file descriptor corresponding to the second buffer, and a third file descriptor corresponding to the third buffer are imported into the context of a specific application programming interface to obtain a buffer object, wherein the first buffer is used to store a first mapping relationship, the first mapping relationship being a mapping map between a camera image and an IPM image, the second buffer is used to store camera images, and the third buffer is used to store IPM images; the buffer object is passed to the kernel so that the kernel uses a specific application programming interface plus specific hardware parallel processing to obtain an IPM image based on the buffer object and store it in the third buffer, wherein the specific hardware is a GPU or a DSP. Through an embodiment of the present application, each time an IPM image is generated, the stored mapping map is used, and there is no need to repeatedly determine the mapping map, thereby improving the efficiency of IPM image generation, thereby improving the real-time performance of parking space detection, and using a specific application programming interface plus specific hardware parallel processing to perform mapping can effectively reduce CPU occupancy.
[0066] Furthermore, in one embodiment, before step S10, the method further includes:
[0067] Step S00: Generate a first mapping relationship and store it in a first buffer.
[0068] In this embodiment, there are multiple ways to generate the mapping map between the camera image and the IPM image, and the method used here can be selected to generate it. On this basis, the first mapping relationship is stored in the first buffer, so that when the mapping process is performed later, there is no need to repeatedly determine the mapping map, thereby improving the mapping efficiency.
[0069] Furthermore, in one embodiment, step S00 includes:
[0070] Step S01, calibrating camera internal parameters and camera external parameters;
[0071] In this embodiment, the camera internal parameters generally include the focal length of the camera lens , , lens principal point coordinates ( , ), fisheye lens distortion coefficients (k1, k2, k3, k4). The camera intrinsic parameter model matrix used in this embodiment is as follows:
[0072]
[0073] The fisheye camera distortion model uses the Kannala-Brandt8 polynomial model (fisheye model in the OpenCV library), as follows:
[0074]
[0075] in: represents the angle of incidence, Represents the distortion angle.
[0076] There are other ways to calibrate camera intrinsic parameters, and there are many open source libraries or toolboxes, which will not be discussed here.
[0077] The camera's external parameters refer to the camera's installation parameters, which are used to represent the relationship between the camera coordinate system and the vehicle coordinate system. They are related to the camera's actual installation position and installation angle, including the three-degree-of-freedom installation position information and the three-degree-of-freedom installation angle information. Compared with the constant nature of the camera's internal parameters, the camera's external parameters change with changes in the camera's installation position and the vehicle's coordinate system selection.
[0078] Definition of vehicle coordinate system: The projection point of the vehicle center point on the ground is taken as the origin, and the right-front-up coordinate system is adopted, that is, the right direction of the vehicle is the X-axis, the front direction is the Y-axis, and the upward direction is the Z-axis.
[0079] In the AVM / APA system, four cameras are usually fixed on the vehicle body, for example, the front camera is fixed on the front grille or the front bumper, the rear camera is fixed on the trunk door or the rear bumper, and the left and right cameras are respectively fixed on the left and right rearview mirrors.
[0080] The camera extrinsic parameters include the rotation information (installation angle information) and translation information (installation position information) between the two coordinate systems. There are many common ways to represent rotation information, such as rotation vector, rotation matrix, quaternion, Euler angle, Lie group / Lie algebra, etc. Among them, rotation vector and rotation matrix are more commonly used representation methods. In this embodiment, the rotation vector / rotation matrix form is used to represent the camera extrinsic rotation information:
[0081]
[0082] In the formula, is the rotation matrix, is the translation vector. The physical meaning of R is the rotation transformation from the vehicle coordinate system to the camera coordinate system. Indicates the coordinate value of the origin of the vehicle coordinate system in the camera coordinate system.
[0083] The calibration of camera extrinsic parameters is to fix the vehicle on a station with a pre-laid calibration pattern, collect four fisheye images through the camera, and obtain the extrinsic parameter values through corner point extraction, corner point dedistortion, extrinsic parameter calculation, nonlinear optimization, etc. There are many methods for calculating extrinsic parameters, which will not be described here.
[0084] Step S02, establishing a second mapping relationship, wherein the second mapping relationship is a mapping relationship between a BEV map and a standard IPM image, wherein the BEV map is a rectangular area in a vehicle body coordinate system, the center of the rectangular area is the coordinate of the center of the vehicle in the vehicle body coordinate system, and the rectangular area is within the field of view of the camera;
[0085] In this embodiment, before establishing the second mapping relationship, it is necessary to design a BEV map in the vehicle body coordinate system. The BEV map refers to a rectangular area defined in the vehicle body coordinate system, for example, a rectangular range of 8m in front, back, left and right, with the projection point of the center point of the vehicle on the ground as the origin. The AVM camera field of view can cover the area (excluding the vehicle body itself). At the same time, the design of the BEV map must also meet the parking space detection range requirements.
[0086] Since the input of the detection model is generally image data, the BEV map needs to be mapped into an image format, that is, the corresponding standard IPM image. The standard IPM image is a rectangular image, which can be understood as a virtual camera shooting the BEV map from top to bottom, and the field of view is exactly the same as the BEV map range. Therefore, there is a mapping relationship from the BEV map to the standard IPM image, which is explained as follows:
[0087] The BEV map is a top-down view, a two-dimensional plane based on the vehicle coordinate system, and its unit is meter; the standard IPM image is a top-down view, which is essentially an image, and its unit is pixel. For example, the mapping relationship from the BEV map to the standard IPM image is: a 16x16m area is mapped to a 512x512 resolution image. This relationship can be obtained through the homography matrix Description. Usually It is determined by four parameters, and its representation is consistent with the camera's intrinsic parameter matrix (which can be understood as the intrinsic parameter of the IPM imaging virtual camera):
[0088]
[0089] in, The scale in the x direction, that is, the physical size represented by each pixel in the x direction, for example, 0.02m / pixl; The scale in the y direction, that is, the physical size represented by each pixel in the y direction, usually = ; , is the offset of the origin coordinates, the position of the origin of the vehicle coordinate system in the standard IPM image, usually the center of the standard IPM image.
[0090] Similarly, the mapping relationship from the standard IPM image to the BEV map can be expressed as The inverse matrix representation of .
[0091] Step S03, determining the correspondence between the camera and the mapping area in the BEV map according to the camera's field of view, wherein the mapping area includes a non-overlapping area and an overlapping area, wherein the non-overlapping area has only one camera's field of view, and the overlapping area has two cameras' fields of view;
[0092] In this embodiment, since the standard IPM image is a 360° image around the vehicle body formed by stitching together the original images from four cameras, it is necessary to divide the mapping area of each camera on the BEV map. Figure 2 , Figure 2 Schematic diagram of the scenario of dividing the BEV map into mapping areas. Figure 2 As shown in the figure, the rectangular box in the middle is the vehicle body coverage area, which belongs to the camera blind area and does not perform camera image mapping. The periphery is divided into 8 areas, of which mapping area 2 corresponds to the front camera, mapping area 4 corresponds to the left camera, mapping area 6 corresponds to the rear camera, and mapping area 0 corresponds to the right camera. Mapping areas 0, 2, 4 and 6 are non-overlapping areas; mapping area 1 corresponds to the front camera and the right camera, mapping area 3 corresponds to the front camera and the left camera, mapping area 5 corresponds to the rear camera and the left camera, and mapping area 7 corresponds to the rear camera and the right camera. Mapping areas 1, 3, 5 and 7 are overlapping areas.
[0093] Step S04, for any pixel to be mapped in the standard IPM image, determining a first coordinate corresponding to the pixel to be mapped in the BEV map and a second coordinate of the pixel to be mapped in the vehicle body coordinate system based on a second mapping relationship;
[0094] In this embodiment, all pixels in the standard IPM image are used as pixels to be mapped, and the resolution of the finally obtained mapping map is in the form of 1×1.
[0095] Alternatively, for all pixels in the standard IPM image, in the horizontal direction, one pixel is taken as a pixel to be mapped every (m-1) pixel spacing, and in the vertical direction, one pixel is taken as a pixel to be mapped every (n-1) pixel spacing, then the resolution of the final mapping map is in the form of m×n.
[0096] For any pixel to be mapped in the standard IPM image , determined by the above , it can be determined The corresponding first coordinate in the BEV map Since the BEV map is in the vehicle coordinate system, based on the first coordinate, we can also determine The second coordinate in the vehicle coordinate system .
[0097] Step S05, determining the fusion weight corresponding to the pixel to be mapped based on the mapping area where the first coordinate is located;
[0098] In this embodiment, refer to Figure 3 , Figure 3 This is a schematic diagram of the fusion weight calculation scene. Figure 3 As shown, if the mapping area where the first coordinate (as shown by point P) is located is the overlap area, L1 and L2 are the boundary lines of the overlap area, d1 and d2 are the distances from P to the two boundary lines respectively, then the fusion weight calculation formula is as follows:
[0099] The right camera image sampling weight W1=d1 / (d1+d2).
[0100] Front camera image sampling weight W2=d2 / (d1+d2).
[0101] Obviously, W1+ W2=1.0. The closer point P is to the border of the mapping area corresponding to a camera, the higher its weight is; on the border, the weight of its single camera becomes 1.0. It should be noted that if point P is in a non-overlapping area, the weight of the camera corresponding to the non-overlapping area is 1.0.
[0102] This fusion weight calculation method has a comparable fusion effect to the method of calculating weights by calculating the fan-shaped area angle, but the amount of calculation is smaller and the final fusion effect is good.
[0103] Step S06, determining the sub-mapping relationship between the pixel to be mapped and the image pixel based on the camera intrinsic parameter, the camera extrinsic parameter, the fusion weight and the second coordinate, wherein the image pixel is a pixel in the standard camera image; and so on, determining the sub-mapping relationship between each pixel to be mapped and the image pixel in the standard IPM image;
[0104] Step S07: synthesize all sub-mapping relationships to obtain a first mapping relationship.
[0105] In this embodiment, after determining the camera intrinsic parameters, camera extrinsic parameters, fusion weights and second coordinates, the texture coordinate points on the fisheye image can be projected directly using cv::fisheye::projectPoints() in OpenCV, that is, the sub-mapping relationship between the pixel points to be mapped and the image pixel points can be determined.
[0106] By analogy, the sub-mapping relationship between each pixel to be mapped and the image pixel in the standard IPM image is determined, so as to integrate all sub-mapping relationships to obtain the first mapping relationship, that is, the mapping map between the camera image and the IPM image.
[0107] Furthermore, in one embodiment, the resolution of the mapping map is in the form of m×n, where m and n are both positive integers greater than 1, and the step of obtaining the IPM image based on the buffer object is:
[0108] For the pixel points in the IPM image, based on the first mapping relationship, mapping is performed every (m-1) pixel spacing in the horizontal direction and every (n-1) pixel spacing in the vertical direction to obtain a preliminary IPM image; the blank pixel points in the preliminary IPM image are interpolated to obtain the IPM image.
[0109] In this embodiment, the corresponding data can be read from each buffer based on the buffer object. The ultimate goal is to obtain an IPM image. The IPM image is composed of pixels, so it is necessary to clarify the pixel of each pixel. On this basis, taking the resolution of the mapping map as 4×4 as an example, in the horizontal direction, mapping is performed every 3 pixel spacings, that is, for the pixels in a row, the pixel value of the pixel in the first column is determined according to the first mapping relationship, and the pixel value of the pixel in the fourth column is determined according to the first mapping relationship, and so on; in the vertical direction, mapping is performed every 3 pixel spacings, that is, for the pixels in a column, the pixel value of the pixel in the first row is determined according to the first mapping relationship, and the pixel value of the pixel in the fourth row is determined according to the first mapping relationship, and so on. In this way, a preliminary IPM image can be obtained. Refer to Figure 4 , Figure 4 Figure 1 is a schematic diagram of a preliminary IPM image. Figure 4 As shown, in the horizontal and vertical directions, between every two pixels with determined pixel values, there are two pixels with unknown pixel values, i.e., blank pixels. Here, the blank pixels are assigned values by interpolation processing, thereby obtaining an IPM image.
[0110] There are many interpolation methods, such as nearest neighbor interpolation or bilinear interpolation. Figure 4 For example, if pixel point P11 has no corresponding mapping texture coordinates, then P11 needs to use the texture coordinates of four pixel points P00, P03, P30 and P33 to interpolate, find the corresponding camera image texture coordinate point, and then find the corresponding pixel point on the camera image for pixel interpolation filling, so as to assign a pixel value to pixel point P11.
[0111] In the same way, all blank pixels are interpolated, which will not be described in detail here.
[0112] When a commonly used mapping map with a resolution of 1×1 is used for mapping processing, the large amount of mapping map data leads to high loading time and bandwidth occupancy, which also increases the time consumption of IPM image generation. In the embodiment of the present application, the resolution of the mapping map is in the form of m×n, where m and n are both positive integers greater than 1, which can effectively reduce the amount of mapping map data, thereby reducing loading time and bandwidth occupancy, and combined with interpolation processing, it also effectively ensures the mapping effect.
[0113] Furthermore, in one embodiment, after step S10, the method further includes:
[0114] The parameters and buffer objects used for normalization processing are passed to the kernel, so that the kernel uses a specific application programming interface plus a specific hardware parallel processing method to obtain an IPM image based on the parameters and buffer objects used for normalization processing and store it in a third buffer.
[0115] In this embodiment, considering that the IPM image is ultimately input into the parking space detection model as the image to be detected, generally speaking, the parking space detection model requires the input to be normalized. Therefore, in this embodiment, the parameters used for normalization processing and the buffer object are passed to the kernel together, so that the normalization processing is included in the mapping process, which reduces the data transmission steps required in the entire parking space detection process, thereby further improving the real-time performance of parking space detection.
[0116] Further, in one embodiment, the step of obtaining the IPM image based on the parameters for normalization processing and the buffer object includes:
[0117] Mapping the camera image based on the first mapping relationship to obtain a mapping result;
[0118] The mapping results are converted into color space, separated into color channels and normalized to obtain the IPM image.
[0119] In this embodiment, in combination with the above description, the first mapping relationship and the camera image can be loaded from the corresponding buffer based on the buffer object, so that the camera image is mapped based on the first mapping relationship to obtain a mapping result.
[0120] And considering that the input image format of the parking space detection model is generally NCHW, that is, an RGB image after channel separation, and the original image of the vehicle camera is generally in YUV format, it needs to be converted into color space and separated into color channels. Therefore, in this embodiment, the color space conversion, color channel separation and normalization processing are integrated into the mapping process of the IPM image to reduce pipeline steps, thereby further improving the real-time performance of parking space detection.
[0121] In a second aspect, an embodiment of the present application also provides an IPM image generating device.
[0122] In one embodiment, referring to Figure 5 , Figure 5 This is a functional module diagram of an embodiment of the IPM image generation device of the present application. Figure 5 As shown, the IPM image generating device comprises:
[0123] An import module 10 is used to import a first file descriptor corresponding to the first buffer, a second file descriptor corresponding to the second buffer, and a third file descriptor corresponding to the third buffer into the context of a specific application programming interface to obtain a buffer object, wherein the first buffer is used to store a first mapping relationship, the first mapping relationship is a mapping map between a camera image and an IPM image, the second buffer is used to store the camera image, and the third buffer is used to store the IPM image;
[0124] The processing module 20 is used to pass the buffer object to the kernel, so that the kernel uses a specific application programming interface plus specific hardware parallel processing to obtain an IPM image based on the buffer object and store it in a third buffer. The specific hardware is a GPU or a DSP.
[0125] Furthermore, in one embodiment, the IPM image generating apparatus further includes a generating module, which is used to:
[0126] A first mapping relationship is generated and stored in a first buffer.
[0127] Furthermore, in one embodiment, the generating module is used to:
[0128] Calibrate camera internal parameters and camera external parameters;
[0129] Establishing a second mapping relationship, where the second mapping relationship is a mapping relationship between a BEV map and a standard IPM image, the BEV map is a rectangular area in a vehicle body coordinate system, the center of the rectangular area is the coordinate of the center of the vehicle in the vehicle body coordinate system, and the rectangular area is within the field of view of the camera;
[0130] According to the camera's field of view, the corresponding relationship between the camera and the mapping area in the BEV map is determined. The mapping area includes a non-overlapping area and an overlapping area. The non-overlapping area has only one camera's field of view, and the overlapping area has two cameras' fields of view.
[0131] For any pixel point to be mapped in the standard IPM image, determine, based on the second mapping relationship, a first coordinate corresponding to the pixel point to be mapped in the BEV map and a second coordinate of the pixel point to be mapped in the vehicle body coordinate system;
[0132] Determine the fusion weight corresponding to the pixel to be mapped based on the mapping area where the first coordinate is located;
[0133] Determine a sub-mapping relationship between the pixel point to be mapped and the image pixel point based on the camera intrinsic parameter, the camera extrinsic parameter, the fusion weight and the second coordinate, wherein the image pixel point is a pixel point in the standard camera image;
[0134] By analogy, the sub-mapping relationship between each pixel point to be mapped and the image pixel point in the standard IPM image is determined;
[0135] All sub-mapping relationships are combined to obtain the first mapping relationship.
[0136] Furthermore, in one embodiment, the resolution of the map is in the form of m×n, where m and n are both positive integers greater than 1, and the processing module is used to:
[0137] For the pixel points in the IPM image, based on the first mapping relationship, mapping is performed once every (m-1) pixel spacing in the horizontal direction, and mapping is performed once every (n-1) pixel spacing in the vertical direction, to obtain a preliminary IPM image;
[0138] The blank pixels in the preliminary IPM image are interpolated to obtain the IPM image.
[0139] Furthermore, in one embodiment, the processing module 20 is used to:
[0140] The parameters and buffer objects used for normalization processing are passed to the kernel, so that the kernel uses a specific application programming interface plus a specific hardware parallel processing method to obtain an IPM image based on the parameters and buffer objects used for normalization processing and store it in a third buffer.
[0141] Furthermore, in one embodiment, the processing module 20 is used to:
[0142] Mapping the camera image based on the first mapping relationship to obtain a mapping result;
[0143] The mapping results are converted into color space, separated into color channels and normalized to obtain the IPM image.
[0144] Furthermore, in one embodiment, the specific application programming interface is OpenCL or OpenGL.
[0145] Among them, the functional implementation of each module in the above-mentioned IPM image generation device corresponds to each step in the above-mentioned IPM image generation method embodiment, and its functions and implementation processes are no longer repeated here.
[0146] In a third aspect, an embodiment of the present application provides an IPM image generating device, which may be a device having a data processing function, such as a personal computer (PC), a notebook computer, or a server.
[0147] Reference Figure 6 , Figure 6 Schematic diagram of the hardware structure of the IPM image generation device involved in the embodiment of the present application. In the embodiment of the present application, the IPM image generation device may include a processor, a memory, a communication interface and a communication bus.
[0148] The communication bus may be of any type and is used to interconnect the processor, the memory, and the communication interface.
[0149] The communication interface includes input / output (I / O) interface, physical interface and logical interface, etc., which are used to realize the interconnection of devices inside the IPM image generation device, and the interface used to realize the interconnection between the IPM image generation device and other devices (such as other computing devices or user devices). The physical interface can be an Ethernet interface, a fiber optic interface, an ATM interface, etc.; the user device can be a display, a keyboard, etc.
[0150] The memory can be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile RAM (NVRAM), flash memory, optical storage, hard disk, programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), etc.
[0151] The processor may be a general-purpose processor, and the general-purpose processor may call the IPM image generation program stored in the memory and execute the IPM image generation method provided in the embodiment of the present application. For example, the general-purpose processor may be a central processing unit (CPU). The method executed when the IPM image generation program is called may refer to the various embodiments of the IPM image generation method of the present application, and will not be described in detail here.
[0152] Those skilled in the art will understand that Figure 6The hardware structure shown in the figure does not constitute a limitation on the present application, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0153] In a fourth aspect, an embodiment of the present application also provides a computer-readable storage medium.
[0154] The computer-readable storage medium of the present application stores an IPM image generation program, wherein when the IPM image generation program is executed by a processor, the steps of the above-mentioned IPM image generation method are implemented.
[0155] Among them, the method implemented when the IPM image generation program is executed can refer to the various embodiments of the IPM image generation method of the present application, and will not be repeated here.
[0156] It should be noted that the serial numbers of the above-mentioned embodiments of the present application are only for description and do not represent the advantages or disadvantages of the embodiments.
[0157] The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices. The terms "first", "second" and "third" are used to distinguish different objects, etc., and do not represent a sequence, nor do they limit "first", "second" and "third" to different types.
[0158] In the description of the embodiments of the present application, "exemplary", "for example" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary", "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary", "for example" or "for example" is intended to present related concepts in a specific way.
[0159] In the description of the embodiments of the present application, unless otherwise specified, “ / ” means or, for example, A / B can mean A or B; the “and / or” in the text is merely a description of the association relationship of associated objects, indicating that three relationships may exist, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, “multiple” refers to two or more than two.
[0160] In some processes described in the embodiments of the present application, multiple operations or steps that appear in a specific order are included, but it should be understood that these operations or steps may not be executed in the order in which they appear in the embodiments of the present application or in parallel, and the sequence number of the operation is only used to distinguish the different operations, and the sequence number itself does not represent any execution order. In addition, these processes may include more or fewer operations, and these operations or steps may be executed in sequence or in parallel, and these operations or steps may be combined.
[0161] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, disk, CD) as described above, and includes a number of instructions for a terminal device to execute the methods described in each embodiment of the present application.
[0162] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. An IPM image generation method, characterized in that: The IPM image generation method comprises: Importing a first file descriptor corresponding to the first buffer, a second file descriptor corresponding to the second buffer, and a third file descriptor corresponding to the third buffer into the context of a specific application programming interface to obtain a buffer object, wherein the first buffer is used to store a first mapping relationship, which is a mapping map between a camera image and an IPM image, the second buffer is used to store the camera image, and the third buffer is used to store the IPM image; The buffer object is passed to the kernel so that the kernel uses a specific application programming interface plus specific hardware parallel processing to obtain an IPM image based on the buffer object and store it in a third buffer. The specific hardware is a GPU or a DSP.
2. The IPM image generation method according to claim 1, characterized in that: Before the step of importing the first file descriptor corresponding to the first buffer, the second file descriptor corresponding to the second buffer, and the third file descriptor corresponding to the third buffer into the context of the specific application programming interface to obtain the buffer object, the method further includes: A first mapping relationship is generated and stored in a first buffer.
3. The IPM image generation method according to claim 2, characterized in that: The step of generating a first mapping relationship comprises: Calibrate camera internal parameters and camera external parameters; Establishing a second mapping relationship, where the second mapping relationship is a mapping relationship between a BEV map and a standard IPM image, the BEV map is a rectangular area in a vehicle body coordinate system, the center of the rectangular area is the coordinate of the center of the vehicle in the vehicle body coordinate system, and the rectangular area is within the field of view of the camera; According to the camera's field of view, the corresponding relationship between the camera and the mapping area in the BEV map is determined. The mapping area includes a non-overlapping area and an overlapping area. The non-overlapping area has only one camera's field of view, and the overlapping area has two cameras' fields of view. For any pixel point to be mapped in the standard IPM image, determine, based on the second mapping relationship, a first coordinate corresponding to the pixel point to be mapped in the BEV map and a second coordinate of the pixel point to be mapped in the vehicle body coordinate system; Determine the fusion weight corresponding to the pixel to be mapped based on the mapping area where the first coordinate is located; Determine a sub-mapping relationship between the pixel point to be mapped and the image pixel point based on the camera intrinsic parameter, the camera extrinsic parameter, the fusion weight and the second coordinate, wherein the image pixel point is a pixel point in the standard camera image; By analogy, the sub-mapping relationship between each pixel point to be mapped and the image pixel point in the standard IPM image is determined; All sub-mapping relationships are combined to obtain the first mapping relationship.
4. The IPM image generation method according to claim 2, characterized in that: The resolution of the mapping map is in the form of m×n, where m and n are both positive integers greater than 1. The steps of obtaining the IPM image based on the buffer object are as follows: For the pixel points in the IPM image, based on the first mapping relationship, mapping is performed once every (m-1) pixel spacing in the horizontal direction, and mapping is performed once every (n-1) pixel spacing in the vertical direction, to obtain a preliminary IPM image; The blank pixels in the preliminary IPM image are interpolated to obtain the IPM image.
5. The IPM image generation method according to claim 1, characterized in that: After the step of importing the first file descriptor corresponding to the first buffer, the second file descriptor corresponding to the second buffer, and the third file descriptor corresponding to the third buffer into the context of the specific application programming interface to obtain the buffer object, the method further includes: The parameters and buffer objects used for normalization processing are passed to the kernel, so that the kernel uses a specific application programming interface plus a specific hardware parallel processing method to obtain an IPM image based on the parameters and buffer objects used for normalization processing and store it in a third buffer.
6. The IPM image generation method according to claim 5, characterized in that: The steps of obtaining an IPM image based on the parameters for normalization processing and the buffer object include: Mapping the camera image based on the first mapping relationship to obtain a mapping result; The mapping results are converted into color space, separated into color channels and normalized to obtain the IPM image.
7. The IPM image generation method according to any one of claims 1 to 6, characterized in that: The specific application programming interface is OpenCL or OpenGL.
8. An IPM image generating device, characterized in that: The IPM image generating device comprises: An import module, used for importing a first file descriptor corresponding to the first buffer, a second file descriptor corresponding to the second buffer, and a third file descriptor corresponding to the third buffer into the context of a specific application programming interface to obtain a buffer object, wherein the first buffer is used to store a first mapping relationship, the first mapping relationship being a mapping map between a camera image and an IPM image, the second buffer is used to store the camera image, and the third buffer is used to store the IPM image; The processing module is used to pass the buffer object to the kernel, so that the kernel uses a specific application programming interface plus specific hardware parallel processing to obtain an IPM image based on the buffer object and store it in a third buffer. The specific hardware is a GPU or a DSP.
9. An IPM image generation device, characterized in that: The IPM image generating device comprises a processor, a memory, and an IPM image generating program stored in the memory and executable by the processor, wherein when the IPM image generating program is executed by the processor, the steps of the IPM image generating method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores an IPM image generation program, wherein when the IPM image generation program is executed by a processor, the steps of the IPM image generation method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
A straight line and arc combined lane line detection method
CN109886175A
Method and device for generating inverse perspective IPM image
CN115761164A
Method and device for synthesizing ground identification based on BEV image
CN117078800A
Image processing method and device, electronic equipment and computer readable storage medium
CN118096492A
Systems and methods for lane-marker detection
US20180189577A1
