Automobile rearview mirror image enhancement processing method, device and storage medium
By obtaining historical raindrop grayscale images to calculate the segmentation threshold and width threshold, and combining the real-time rear view for grayscale processing and search matrix adjustment, the problem of unutilized raindrop shape features in the existing technology is solved, and efficient recognition of raindrop parts and improved image clarity are achieved.
Patent Information
- Application Number
- CN202510728307.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-03
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2045-06-03
AI Technical Summary
Existing car rearview mirror image enhancement technology fails to perform image enhancement based on the shape characteristics of raindrops themselves on rainy days, resulting in poor image enhancement effect.
By obtaining historical raindrop grayscale images, calculating the first and second segmentation thresholds, obtaining historical width thresholds, and combining them with real-time back-views for grayscale processing, the clarity of the raindrop area is identified and optimized, and the search matrix is used to adjust the image to achieve image enhancement based on raindrop shape features.
The recognition of raindrops and image clarity are improved, and the image enhancement effect in rainy scenes is enhanced.
Smart Images

Figure CN120235767B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of automobile rearview mirror image enhancement, and in particular to an automobile rearview mirror image enhancement processing method, device and storage medium. Background Art
[0002] With the continuous development of intelligent driving, the safety and intelligence of automobiles are constantly improving. For example, traditional rearview mirrors have blind spots. Therefore, images captured by cameras are projected onto the rearview mirror to effectively eliminate blind spots and provide a wider field of view.
[0003] Then on rainy days, raindrops appearing in the rearview mirror image cause the image to be blurred, reducing driving safety. Therefore, the raindrop part can be identified. However, the existing raindrop recognition fails to identify the raindrop based on the shape characteristics of the raindrop itself, resulting in low recognition. At the same time, the existing clarity improvement method adjusts the clarity of the raindrop part through a square matrix. The square matrix fails to combine the raindrop shape clarity adjustment, resulting in poor clarity adjustment. For example, the patent application with publication number CN118644568A discloses a rearview mirror image generation method, device, vehicle-mounted equipment and readable storage medium. The solution proposes that the rearview mirror image generation method fails to perform image enhancement based on the shape characteristics of the raindrop itself on rainy days, resulting in poor imaging effect. The existing automobile rearview image enhancement technology fails to perform image enhancement based on the shape characteristics of the raindrop itself, resulting in poor image enhancement effect in rainy scenes. Summary of the Invention
[0004] The present invention aims to solve at least one of the technical problems in the prior art to a certain extent, by obtaining a first segmentation threshold and a second segmentation threshold based on a historical raindrop grayscale image; obtaining a historical width threshold based on the historical raindrop grayscale image, the first segmentation threshold and the second segmentation threshold; obtaining a real-time rear view of a car and marking it as a real-time rear view; gray-scaling the real-time rear view to obtain a real-time rear view grayscale image; obtaining an optimized area based on the real-time rear view grayscale image, the first segmentation threshold, the second segmentation threshold and the historical width threshold; and performing clarity optimization on the optimized area in the real-time rear view to obtain an optimized rear view; so as to solve the problem that the existing rear view image enhancement technology of a car fails to perform image enhancement based on the shape characteristics of the raindrops themselves, resulting in poor image enhancement effect in rainy scenes.
[0005] To achieve the above objectives, the present application provides a method for enhancing and processing a rearview mirror image, comprising the following steps:
[0006] Obtain images of a first number of raindrop portions in the rear view of the car and mark them as historical raindrop images;
[0007] Grayscale the historical raindrop image to obtain a historical raindrop grayscale image;
[0008] Obtaining a first segmentation threshold and a second segmentation threshold based on the historical raindrop grayscale image;
[0009] Obtaining a historical width threshold based on the historical raindrop grayscale image, the first segmentation threshold, and the second segmentation threshold;
[0010] Get a real-time rear view of the car, marked as real-time rear view;
[0011] Gray-scale the real-time rearview image to obtain a real-time rearview grayscale image; and obtain an optimized area based on the real-time rearview grayscale image, the first segmentation threshold, the second segmentation threshold, and the historical width threshold.
[0012] Optimize the clarity of the optimized area in the real-time rear view to obtain an optimized rear view;
[0013] The optimized view is displayed after geometric changes and visual adjustments.
[0014] Furthermore, grayscale processing is performed on the historical raindrop image to obtain the historical raindrop grayscale image, which includes the following sub-steps:
[0015] Get the RGB value of each pixel in the historical raindrop grayscale image and mark it as the historical raindrop RGB value;
[0016] The grayscale conversion formula is used to convert all the historical raindrop RGB values in the historical raindrop grayscale image into grayscale values to obtain the historical raindrop grayscale image.
[0017] Furthermore, obtaining the first segmentation threshold and the second segmentation threshold based on the historical raindrop grayscale image includes the following sub-steps:
[0018] Mark the grayscale value of each pixel in the historical raindrop grayscale image as the historical raindrop grayscale value;
[0019] Sort the historical raindrop grayscale values from small to large and mark them as Yd1 to Yd i ;
[0020] The number of historical raindrop grayscale values is obtained and marked as the historical raindrop grayscale number;
[0021] The first quantity ratio is obtained as: B1=o1*Sh, where B1 is the first quantity ratio, o1 is the first quantity coefficient, the range of o1 is: (0, 0.5), and Sh is the historical raindrop grayscale number;
[0022] If the first quantity ratio is an integer, Yd (B1) Mark it as the first position value; if the first quantity ratio is not an integer, get the integers on the left and right sides of B1, mark them as B1z and B1y respectively, and calculate Yd (B1z) With Yd (B1y) The mean of , marked as the first position value;
[0023] The second quantity coefficient is obtained as follows: o2=[(1 / o1)-1]*o1; where o2 is the second quantity coefficient;
[0024] The second quantity ratio is obtained as: B2=o2*Sh, where B2 is the second quantity ratio;
[0025] If the second quantity ratio is an integer, Yd (B2) Mark it as the second position value; if the second quantity ratio is not an integer, get the integers on the left and right sides of B2, mark them as B2z and B2y respectively, and calculate Yd (B2z) With Yd (B2y) The mean of , marked as the second position value;
[0026] If 0.5*B1 is an integer, then Yd (0.5*B1) Mark it as Dj; if 0.5*B1 is not an integer, get the integers on the left and right sides of 0.5*B1, mark them as Bzz and Bzy respectively, and calculate Yd (Bzz) With Yd (Bzy) The mean of , marked as Dj.
[0027] Furthermore, obtaining the first segmentation threshold and the second segmentation threshold based on the historical raindrop grayscale image further includes the following sub-steps:
[0028] The first segmentation threshold is obtained as: F1=Dj-(Dj-W1) / [(0.5-o1) / 0.5]; where F1 is the first segmentation threshold; W1 is the first position value;
[0029] The second segmentation threshold is obtained as: F2=Dj+(W2-Dj) / [(o2-0.5) / 0.5]; where F2 is the second segmentation threshold; W2 is the second position value.
[0030] Furthermore, obtaining the historical width threshold based on the historical raindrop grayscale image, the first segmentation threshold, and the second segmentation threshold includes the following sub-steps:
[0031] In the historical raindrop grayscale image, the grayscale values of historical raindrops that are greater than or equal to the first segmentation threshold and less than or equal to the second segmentation threshold are set to 0, and the grayscale values of historical raindrops that are less than the first segmentation threshold or greater than the second segmentation threshold are set to 255 to obtain a historical raindrop binary image.
[0032] The area where the grayscale value of the pixel in the historical raindrop binarization image is 0 is marked as the raindrop area;
[0033] Establish a plane rectangular coordinate system, marked as the historical interval coordinate system; place the raindrop area in the first quadrant of the historical interval coordinate system;
[0034] Obtain the coordinates of the pixel with the smallest horizontal coordinate in the raindrop area, mark it as the historical reference point, draw a straight line parallel to the Y axis through the historical reference point, mark it as the first straight line; rotate the first straight line 180° around the historical reference point as the rotation center, obtain the maximum distance from a point in the raindrop area to the first straight line during the rotation process, mark it as the historical rotation distance, and obtain the minimum value of the historical rotation distance, mark it as the historical width;
[0035] Get the historical width of all raindrop areas;
[0036] Get the maximum value of the history width, marked as the history threshold width.
[0037] Furthermore, obtaining the optimized area based on the real-time rearview grayscale image, the first segmentation threshold, the second segmentation threshold, and the historical width threshold includes the following sub-steps:
[0038] The grayscale values of historical raindrops in the real-time backview grayscale image that are greater than or equal to the first segmentation threshold and less than or equal to the second segmentation threshold are set to 0, and the grayscale values of historical raindrops in the historical raindrop grayscale image that are less than the first segmentation threshold or greater than the second segmentation threshold are set to 255 to obtain a real-time backview binary image;
[0039] Mark the area where the grayscale value of the pixel point in the real-time backview binarization image is 0 as the initial area;
[0040] Establish a plane rectangular coordinate system, marked as the real-time interval coordinate system; place the real-time rearview binary image in the first quadrant of the real-time interval coordinate system, and at the same time satisfy that the two sides of the real-time rearview binary image coincide with the horizontal axis and the vertical axis of the real-time interval coordinate system respectively;
[0041] Obtain the coordinates of a pixel with the smallest horizontal coordinate in the initial area, mark it as the real-time reference point, draw a straight line parallel to the Y axis through the real-time reference point, mark it as the second straight line; rotate the second straight line 180° with the real-time reference point as the rotation center, obtain the maximum distance from a point in the initial area to the second straight line during the rotation process, mark it as the real-time rotation distance, obtain the minimum value of the real-time rotation distance, mark it as the real-time width;
[0042] Determine whether the real-time width is less than or equal to the historical width threshold. If so, mark the initial area as the final area; and obtain the final area outline coordinates.
[0043] Furthermore, obtaining the optimized area based on the real-time rearview grayscale image, the first segmentation threshold, the second segmentation threshold, and the historical width threshold further includes the following sub-steps:
[0044] Establish a plane rectangular coordinate system, marked as the optimized coordinate system; place the real-time rear view in the first quadrant of the optimized coordinate system, and ensure that the two sides of the real-time rear view coincide with the horizontal axis and vertical axis of the optimized coordinate system respectively;
[0045] The final region position in the real-time rear view in the optimization coordinate system is obtained based on the final region outline coordinates, and the final region in the real-time rear view is marked as the optimization region.
[0046] Furthermore, performing clarity optimization on the optimized area in the real-time rear view to obtain the real-time rear view includes the following sub-steps:
[0047] Mark the pixels in the optimization area as optimized area pixels;
[0048] Mark the pixels on the optimized area contour as optimized contour pixels;
[0049] A 3*3 pixel matrix is established with each optimized contour pixel as the center, and is marked as a search matrix; pixels in the search matrix that are not optimized contour pixels are obtained and marked as first search pixels; a new search matrix is established with each first search pixel as the center, and pixels in the new search matrix that are not optimized area pixels and first search pixels are obtained and marked as second search pixels;
[0050] Calculate the mean of the RGB values of all the first search pixels and the second search pixels, and mark it as the search RGB mean;
[0051] The RGB value of each pixel in the optimized area in the real-time post-view is set to the corresponding search RGB mean value to obtain the optimized post-view.
[0052] The present application provides an electronic device, including a processor and a memory, wherein the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the steps in the above method are performed.
[0053] The present application provides a storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps in the above method are performed.
[0054] The beneficial effects of the present invention are as follows: the present invention obtains a first segmentation threshold and a second segmentation threshold based on a historical raindrop grayscale image; obtains a historical width threshold based on the historical raindrop grayscale image, the first segmentation threshold, and the second segmentation threshold; obtains a real-time rear view of a car and marks it as a real-time rear view; grayscales the real-time rear view to obtain a real-time rear view grayscale image; obtains an optimized area based on the real-time rear view grayscale image, the first segmentation threshold, the second segmentation threshold, and the historical width threshold; and optimizes the clarity of the optimized area in the real-time rear view to obtain an optimized rear view. The advantage of the present invention is that, based on the recognition of the shape features of the raindrops themselves, the recognition of the raindrop parts is improved, which facilitates the subsequent processing of the correct raindrop parts.
[0055] The present invention establishes a search matrix, which has the advantage that the search matrix can be adjusted based on the shape of raindrops, thereby improving image accuracy and clarity compared to adjustment using a square matrix. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 is a flow chart of the steps of the method of the present invention;
[0057] Figure 2 is a schematic diagram of the historical rotation distance of the present invention;
[0058] Figure 3 is a schematic diagram of the historical width of the present invention;
[0059] Figure 4 Schematic diagram of the search matrix of the present invention. DETAILED DESCRIPTION
[0060] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0061] Example 1, please refer to Figure 1 As shown, the present application provides a method for enhancing and processing an image of a vehicle rearview mirror, comprising the following steps:
[0062] Step S1, obtaining images of a first number of raindrop portions in a rear view of a car, and marking them as historical raindrop images; the first number is set to 10, and 10 historical raindrop images are obtained for extracting features of raindrops in the rear view of the car;
[0063] Step S2, grayscale processing is performed on the historical raindrop image to obtain a historical raindrop grayscale image; Step S2 includes the following sub-steps:
[0064] Step S201, obtaining the RGB value of each pixel in the historical raindrop grayscale image, and marking it as the historical raindrop RGB value;
[0065] Step S202: using a grayscale conversion formula to convert all the historical raindrop RGB values in the historical raindrop grayscale image into grayscale values to obtain a historical raindrop grayscale image;
[0066] In practical applications, the average grayscale conversion formula is: C=(R+G+B) / 3, where C is the grayscale value, and R, G, and B are the three channel values of the historical raindrop RGB value. For example, if the R, G, and B of a historical raindrop RGB value are 245, 235, and 234, then the grayscale value is: c=(245+235+234) / 3=238, and the calculation result is rounded to an integer.
[0067] Step S3, obtaining a first segmentation threshold and a second segmentation threshold based on the historical raindrop grayscale image; Step S3 includes the following sub-steps:
[0068] Step S301, marking the grayscale value of each pixel in the historical raindrop grayscale image as the historical raindrop grayscale value;
[0069] Step S302: sort the historical raindrop grayscale values from small to large and mark them as Yd1 to Yd i ;
[0070] Step S303, obtaining the number of historical raindrop grayscale values and marking it as the historical raindrop grayscale number;
[0071] Step S304: Calculate the first quantity ratio as follows: B1 = o1 * Sh, where B1 is the first quantity ratio, o1 is the first quantity coefficient, the range of o1 is (0, 0.5), and Sh is the historical raindrop grayscale count. The first position value is selected from the value within the smaller half-range. Therefore, o1 is set in the range of 0 to 0.5, and an intermediate value is selected to ensure that the selected first position value is representative of the smaller half-range. 0.25 is preferred.
[0072] Step S305: If the first quantity ratio is an integer, (B1) Mark it as the first position value; if the first quantity ratio is not an integer, get the integers on the left and right sides of B1, mark them as B1z and B1y respectively, and calculate Yd (B1z) With Yd (B1y) The mean of , marked as the first position value;
[0073] Step S306, obtaining the second quantity coefficient: o2=[(1 / o1)-1]*o1; wherein o2 is the second quantity coefficient; o2 is the symmetric value of o1 with 0.5 as the symmetric point; when o1 is 0.25, o2 is 0.75;
[0074] Step S307, obtaining the second quantity ratio: B2=o2*Sh, where B2 is the second quantity ratio;
[0075] Step S308: If the second quantity ratio is an integer, (B2) Mark it as the second position value; if the second quantity ratio is not an integer, get the integers on the left and right sides of B2, mark them as B2z and B2y respectively, and calculate Yd(B2z) With Yd (B2y) The mean of , marked as the second position value;
[0076] Step S309: If 0.5*B1 is an integer, set Yd (0.5*B1) Mark it as Dj; if 0.5*B1 is not an integer, get the integers on the left and right sides of 0.5*B1, mark them as Bzz and Bzy respectively, and calculate Yd (Bzz) With Yd (Bzy) The mean of , marked as Dj;
[0077] Step S310 , obtaining the first segmentation threshold value: F1=Dj-(Dj-W1) / [(0.5-o1) / 0.5]; wherein F1 is the first segmentation threshold value; W1 is the first position value;
[0078] Step S311: Calculate the second segmentation threshold as: F2 = Dj + (W2 - Dj) / [(o2 - 0.5) / 0.5]; where F2 is the second segmentation threshold; W2 is the second position value. Because raindrops are uniformly bright due to reflection and refraction from daylight and vehicle lights, the historical raindrop grayscale values can be considered uniformly distributed within a certain range. Based on the first position value, the first position value, and Dj, the minimum and maximum values of the historical raindrop grayscale values under an ideal uniform condition can be calculated. Based on the minimum and maximum values, abnormal historical raindrop grayscale values with larger or smaller areas can be screened out, thereby improving the accuracy of obtaining the raindrop grayscale value range.
[0079] In practical applications, for example, when the historical raindrop grayscale number is 10000, o1 is 0.25, o1 is 0.75, and the first quantity ratio is obtained as: B1=o1*Sh=0.25*10000=2500. If 2500 is an integer, Yd (2500) The corresponding specific value 212 is marked as the first position value, and the second quantity ratio is obtained as follows: B2=o2*Sh=0.75*10000=7500, 7500 is an integer, and Yd (2500) The corresponding specific value 237 is marked as the second position value. Since 0.5*B1=0.5*10000=5000 is an integer, Yd (5000) The corresponding specific value 224 is marked as Dj. The first segmentation threshold is: F1=224-(224-212) / [(0.5-0.25) / 0.5]=200, and the second segmentation threshold is: F2=224+(237-224) / [(0.75-0.5) / 0.5]=250.
[0080] Step S4, obtaining a historical width threshold based on the historical raindrop grayscale image, the first segmentation threshold, and the second segmentation threshold; Step S4 includes the following sub-steps:
[0081] Step S401: setting the grayscale values of historical raindrops in the historical raindrop grayscale image that are greater than or equal to the first segmentation threshold and less than or equal to the second segmentation threshold to 0, and setting the grayscale values of historical raindrops in the historical raindrop grayscale image that are less than the first segmentation threshold or greater than the second segmentation threshold to 255, thereby obtaining a binarized historical raindrop image;
[0082] Step S402, marking the area where the grayscale value of the pixel point in the historical raindrop binarization image is 0 as a raindrop area;
[0083] Step S403: Establish a plane rectangular coordinate system, marked as the historical interval coordinate system; place the raindrop area in the first quadrant of the historical interval coordinate system;
[0084] Step S404: Obtain the coordinates of a pixel point with the smallest horizontal coordinate in the raindrop region, mark it as a historical reference point, draw a straight line parallel to the Y axis through the historical reference point, mark it as a first straight line; rotate the first straight line 180° with the historical reference point as the rotation center, and obtain the maximum distance from a point in the raindrop region to the first straight line during the rotation process, mark it as the historical rotation distance; obtain the minimum value of the historical rotation distance, mark it as the historical width; when the image is acquired, the raindrop is in motion, so the acquired raindrop is usually circular or elongated. When the raindrop is elongated, the length distribution range of the raindrop is large, while the width of the raindrop is within a certain range. Therefore, the historical width is used to determine whether it is a raindrop;
[0085] Step S405, obtaining the historical width of all raindrop areas;
[0086] Step S406, obtaining the maximum value of the historical width and marking it as the historical threshold width;
[0087] In practical applications, the grayscale values of historical raindrops greater than or equal to 200 and less than or equal to 250 in the historical raindrop grayscale image are set to 0, and the grayscale values of historical raindrops less than the first segmentation threshold or greater than the second segmentation threshold in the historical raindrop grayscale image are set to 255 to obtain the historical raindrop binary image. Figure 2 and Figure 3 As shown, a history width is 1.5 mm. If the maximum value of all history widths is 6 mm, the history threshold width is 6 mm.
[0088] Step S5: Acquire a real-time rear view of the car, and mark it as a real-time rear view.
[0089] Step S6: grayscale the real-time rearview image to obtain a real-time rearview grayscale image; obtain an optimized area based on the real-time rearview grayscale image, the first segmentation threshold, the second segmentation threshold, and the historical width threshold; Step S6 includes the following sub-steps:
[0090] Step S601: setting the grayscale values of historical raindrops in the real-time rearview grayscale image that are greater than or equal to the first segmentation threshold and less than or equal to the second segmentation threshold to 0, and setting the grayscale values of historical raindrops in the historical raindrop grayscale image that are less than the first segmentation threshold or greater than the second segmentation threshold to 255, thereby obtaining a real-time rearview binary image;
[0091] Step S602, marking the area where the grayscale value of the pixel point in the real-time rearview binarization image is 0 as the initial area;
[0092] Step S603: Establish a plane rectangular coordinate system, marked as the real-time interval coordinate system; place the real-time rearview binary image in the first quadrant of the real-time interval coordinate system, and ensure that two sides of the real-time rearview binary image coincide with the horizontal axis and vertical axis of the real-time interval coordinate system respectively;
[0093] Step S604: Obtain the coordinates of a pixel point with the smallest horizontal coordinate in the initial area, mark it as the real-time reference point, draw a straight line parallel to the Y axis through the real-time reference point, mark it as the second straight line; rotate the second straight line 180° with the real-time reference point as the rotation center, obtain the maximum distance from a point in the initial area to the second straight line during the rotation process, mark it as the real-time rotation distance, and obtain the minimum value of the real-time rotation distance, mark it as the real-time width;
[0094] Step S605 , determining whether the real-time width is less than or equal to the historical width threshold, if so, marking the initial area as the final area; and obtaining the final area outline coordinates.
[0095] Step S606: Establish a plane rectangular coordinate system, marked as the optimized coordinate system; place the real-time rearview image in the first quadrant of the optimized coordinate system, and ensure that the two sides of the real-time rearview image coincide with the horizontal axis and vertical axis of the optimized coordinate system respectively; the real-time rearview image and the real-time rearview binary image have the same size so that the two images share position information. The optimized coordinate system and the real-time interval coordinate system have the same coordinates and are placed using the same method;
[0096] Step S607, obtaining the position of the final area in the real-time rear view in the optimized coordinate system based on the final area outline coordinates, and marking the final area in the real-time rear view as the optimized area;
[0097] In practical applications, if the real-time width is 3 mm, which is smaller than the historical width threshold of 6 mm, the initial area is marked as the final area. Since the real-time width is larger, it can be determined not to be a raindrop part and does not need to be optimized.
[0098] Step S7, optimizing the clarity of the optimized area in the real-time rear view to obtain an optimized rear view; Step S7 includes the following sub-steps:
[0099] Step S701, marking the pixels in the optimization area as optimization area pixels;
[0100] Step S702, marking the pixel points on the optimization area contour as optimization contour pixel points;
[0101] Step S703: Establish a 3*3 pixel matrix with each optimized contour pixel as the center, and mark it as a search matrix; obtain pixels in the search matrix that are not optimized contour pixels, and mark them as first search pixels; establish a new search matrix with each first search pixel as the center, and obtain pixels in the new search matrix that are not optimized area pixels and first search pixels, and mark them as second search pixels; this method can obtain pixels around the optimized area, and all first search pixels form a circle of pixels that spread outward from the optimized area;
[0102] Step S704: Calculate the average of the RGB values of all first search pixels and second search pixels, and mark it as the search RGB average;
[0103] Step S705 , setting the RGB value of each pixel point in the optimized area in the real-time rear view to the corresponding search RGB mean value to obtain the optimized rear view;
[0104] In actual application, please participate Figure 4 As shown, searching for the RGB mean is to calculate the R value, G value, and B value respectively. For example, the first search pixel point and the second search pixel point have three RGB values: (120, 130, 123), (123, 131, 124), and (125, 132, 125), respectively. Calculate 120+123+125≈123;
[0105] 130+131+132=131, and 123+124+125=124 is calculated. The calculation result is rounded to an integer, so the search RGB mean is (123, 131, 124). The corresponding RGB values of the pixels in the optimized area are all set to (123, 131, 124).
[0106] Step S8, displaying the optimized rear view after geometric changes and visual adjustments; the changes make the optimized rear view and the image of the visual rearview mirror consistent.
[0107] In a second embodiment, the present application further provides an electronic device, which may include: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus. The memory stores computer-readable instructions, and the processor can call the instructions in the memory. When the computer-readable instructions are executed by the processor, the processor performs the steps of a method for enhancing an image of an automobile rearview mirror to implement the following functions: obtaining images of a first number of raindrop portions in an automobile rearview view and marking them as historical raindrop images; grayscale processing the historical raindrop images to obtain historical raindrop grayscale images; obtaining a first segmentation threshold and a second segmentation threshold based on the historical raindrop grayscale images; obtaining a historical width threshold based on the historical raindrop grayscale images, the first segmentation threshold, and the second segmentation threshold; obtaining a real-time automobile rearview view and marking it as a real-time rearview view; grayscale processing the real-time rearview view to obtain a real-time rearview grayscale image; obtaining an optimized area based on the real-time rearview grayscale image, the first segmentation threshold, the second segmentation threshold, and the historical width threshold; optimizing the clarity of the optimized area in the real-time rearview view to obtain an optimized rearview view; and displaying the optimized rearview view after geometric changes and visual adjustments.
[0108] In addition, the logical instructions in the above-mentioned memory can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application, or the part that contributes to the existing technology, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program code.
[0109] Example 3. The present application also provides a computer program product, which includes a computer program stored on a computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute a method for enhancing the image of a car rearview mirror provided by the above methods, the method including: obtaining images of a first number of raindrop parts in the rear view of the car, marking them as historical raindrop images; gray-scaling the historical raindrop images to obtain historical raindrop grayscale images; obtaining a first segmentation threshold and a second segmentation threshold based on the historical raindrop grayscale images; obtaining a historical width threshold based on the historical raindrop grayscale images, the first segmentation threshold and the second segmentation threshold; obtaining a real-time rear view of the car, marking it as a real-time rear view; gray-scaling the real-time rear view to obtain a real-time rearview grayscale image; obtaining an optimized area based on the real-time rearview grayscale image, the first segmentation threshold, the second segmentation threshold and the historical width threshold; performing clarity optimization on the optimized area in the real-time rear view to obtain an optimized rear view; and displaying the optimized rear view after geometric changes and visual adjustments.
[0110] Example 4. The present application also provides a computer-readable storage medium. The present application provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method for enhancing the image processing of a rearview mirror of an automobile are executed to achieve the following functions: obtaining images of a first number of raindrop parts in the rear view of the automobile, and marking them as historical raindrop images; gray-scaling the historical raindrop images to obtain historical raindrop grayscale images; obtaining a first segmentation threshold and a second segmentation threshold based on the historical raindrop grayscale images; obtaining a historical width threshold based on the historical raindrop grayscale images, the first segmentation threshold, and the second segmentation threshold; obtaining a real-time rear view of the automobile, and marking it as a real-time rear view; gray-scaling the real-time rear view to obtain a real-time rearview grayscale image; obtaining an optimized area based on the real-time rearview grayscale image, the first segmentation threshold, the second segmentation threshold, and the historical width threshold; performing clarity optimization on the optimized area in the real-time rear view to obtain an optimized rear view; and displaying the optimized rear view after geometric changes and visual adjustments.
[0111] Through the description of the above embodiments, the embodiments of the present invention can be provided as methods, systems, or computer program products. Based on this understanding, the essence of the above technical solutions or the portion that contributes to the prior art can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, or an optical disk, and includes a number of instructions for enabling a computer device (such as a personal computer, server, or network device) to execute the methods described in various embodiments or certain portions of the embodiments.
[0112] In the embodiments provided in this application, it should be understood that the disclosed system or method can be implemented in other ways. The embodiments described above are merely illustrative. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or units 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 systems, modules and units can be electrical, mechanical or other forms.
[0113] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for enhancing the image of a rearview mirror of an automobile, characterized in that: The steps include: Obtain images of a first number of raindrop portions in the rear view of the car and mark them as historical raindrop images; Grayscale the historical raindrop image to obtain a historical raindrop grayscale image; Obtaining a first segmentation threshold and a second segmentation threshold based on the historical raindrop grayscale image; Obtaining a historical width threshold based on the historical raindrop grayscale image, the first segmentation threshold, and the second segmentation threshold; Get a real-time rear view of the car, marked as real-time rear view; Grayscale processing is performed on the real-time rear view to obtain a real-time rear view grayscale image; Obtaining an optimized area based on a real-time rearview grayscale image, a first segmentation threshold, a second segmentation threshold, and a historical width threshold; Optimize the clarity of the optimized area in the real-time rear view to obtain an optimized rear view; Display the optimized view after geometric changes and visual adjustments; Obtaining the historical width threshold based on the historical raindrop grayscale image, the first segmentation threshold, and the second segmentation threshold includes the following sub-steps: In the historical raindrop grayscale image, the grayscale values of historical raindrops that are greater than or equal to the first segmentation threshold and less than or equal to the second segmentation threshold are set to 0, and the grayscale values of historical raindrops that are less than the first segmentation threshold or greater than the second segmentation threshold are set to 255 to obtain a historical raindrop binary image. The area where the grayscale value of the pixel in the historical raindrop binarization image is 0 is marked as the raindrop area; Establish a plane rectangular coordinate system, marked as the historical interval coordinate system; place the raindrop area in the first quadrant of the historical interval coordinate system; Obtain the coordinates of the pixel with the smallest horizontal coordinate in the raindrop area, mark it as the historical reference point, draw a straight line parallel to the Y axis through the historical reference point, mark it as the first straight line; rotate the first straight line 180° around the historical reference point as the rotation center, obtain the maximum distance from a point in the raindrop area to the first straight line during the rotation process, mark it as the historical rotation distance, and obtain the minimum value of the historical rotation distance, mark it as the historical width; Get the historical width of all raindrop areas; Get the maximum value of the historical width and mark it as the historical threshold width; Acquiring the optimized area based on the real-time rearview grayscale image, the first segmentation threshold, the second segmentation threshold, and the historical width threshold includes the following sub-steps: The grayscale values of historical raindrops in the real-time backview grayscale image that are greater than or equal to the first segmentation threshold and less than or equal to the second segmentation threshold are set to 0, and the grayscale values of historical raindrops in the historical raindrop grayscale image that are less than the first segmentation threshold or greater than the second segmentation threshold are set to 255 to obtain a real-time backview binary image; Mark the area where the grayscale value of the pixel point in the real-time backview binarization image is 0 as the initial area; Establish a plane rectangular coordinate system, marked as the real-time interval coordinate system; place the real-time rearview binary image in the first quadrant of the real-time interval coordinate system, and at the same time satisfy that the two sides of the real-time rearview binary image coincide with the horizontal axis and the vertical axis of the real-time interval coordinate system respectively; Obtain the coordinates of a pixel with the smallest horizontal coordinate in the initial area, mark it as the real-time reference point, draw a straight line parallel to the Y axis through the real-time reference point, mark it as the second straight line; rotate the second straight line 180° with the real-time reference point as the rotation center, obtain the maximum distance from a point in the initial area to the second straight line during the rotation process, mark it as the real-time rotation distance, obtain the minimum value of the real-time rotation distance, mark it as the real-time width; Determine whether the real-time width is less than or equal to the historical width threshold. If so, mark the initial area as the final area; obtain the final area outline coordinates; Acquiring the optimized area based on the real-time rearview grayscale image, the first segmentation threshold, the second segmentation threshold, and the historical width threshold also includes the following sub-steps: Establish a plane rectangular coordinate system, marked as the optimized coordinate system; place the real-time rear view in the first quadrant of the optimized coordinate system, and ensure that the two sides of the real-time rear view coincide with the horizontal axis and vertical axis of the optimized coordinate system respectively; Acquire the position of the final area in the real-time rear view in the optimized coordinate system based on the final area outline coordinates, and mark the final area in the real-time rear view as the optimized area; Optimizing the clarity of the optimized area in the real-time rear view to obtain the real-time rear view includes the following sub-steps: Mark the pixels in the optimization area as optimized area pixels; Mark the pixels on the optimized area contour as optimized contour pixels; A 3*3 pixel matrix is established with each optimized contour pixel as the center, and is marked as a search matrix; pixels in the search matrix that are not optimized contour pixels are obtained and marked as first search pixels; a new search matrix is established with each first search pixel as the center, and pixels in the new search matrix that are not optimized area pixels and first search pixels are obtained and marked as second search pixels; Calculate the mean of the RGB values of all the first search pixels and the second search pixels, and mark it as the search RGB mean; The RGB value of each pixel in the optimized area in the real-time post-view is set to the corresponding search RGB mean value to obtain the optimized post-view.
2. The method for enhancing the image of a rearview mirror according to claim 1, wherein: Grayscale processing of the historical raindrop image to obtain the historical raindrop grayscale image includes the following sub-steps: Get the RGB value of each pixel in the historical raindrop grayscale image and mark it as the historical raindrop RGB value; The grayscale conversion formula is used to convert all the historical raindrop RGB values in the historical raindrop grayscale image into grayscale values to obtain the historical raindrop grayscale image.
3. The method for enhancing the image of a rearview mirror according to claim 2, wherein: Obtaining the first segmentation threshold and the second segmentation threshold based on the historical raindrop grayscale image includes the following sub-steps: Mark the grayscale value of each pixel in the historical raindrop grayscale image as the historical raindrop grayscale value; Sort the historical raindrop grayscale values from small to large and mark them as Yd1 to Yd i ; The number of historical raindrop grayscale values is obtained and marked as the historical raindrop grayscale number; The first quantity ratio is obtained as: B1=o1*Sh, where B1 is the first quantity ratio, o1 is the first quantity coefficient, the range of o1 is: (0, 0.5), and Sh is the historical raindrop grayscale number; If the first quantity ratio is an integer, Yd B1 Mark it as the first position value; if the first quantity ratio is not an integer, get the integers on the left and right sides of B1, mark them as B1z and B1y respectively, and calculate Yd B1z With Yd B1y The mean of , marked as the first position value; The second quantity coefficient is obtained as follows: o2=[(1 / o1)-1]*o1; where o2 is the second quantity coefficient; The second quantity ratio is obtained as: B2=o2*Sh, where B2 is the second quantity ratio; If the second quantity ratio is an integer, Yd B2 Mark it as the second position value; if the second quantity ratio is not an integer, get the integers on the left and right sides of B2, mark them as B2z and B2y respectively, and calculate Yd B2z With Yd B2y The mean of , marked as the second position value; If 0.5*B1 is an integer, then Yd 0.5*B1 Mark it as Dj; if 0.5*B1 is not an integer, get the integers on the left and right sides of 0.5*B1, mark them as Bzz and Bzy respectively, and calculate Yd Bzz With Yd Bzy The mean of , marked as Dj.
4. The method for enhancing the image of a rearview mirror according to claim 3, wherein: Acquiring the first segmentation threshold and the second segmentation threshold based on the historical raindrop grayscale image also includes the following sub-steps: The first segmentation threshold is obtained as: F1=Dj-(Dj-W1) / [(0.5-o1) / 0.5]; Where F1 is the first segmentation threshold; W1 is the first position value; The second segmentation threshold is obtained as: F2=Dj+(W2-Dj) / [(o2-0.5) / 0.5]; where F2 is the second segmentation threshold; W2 is the second position value.
5. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the method according to any one of claims 1 to 4 are executed.
6. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are executed.
Citation Information
Patent Citations
Rearview mirror image generation method and device, vehicle-mounted equipment and readable storage medium
CN118644568A
Self-adaptive threshold segmentation method for grayscale image
CN113129326A
OCC image decoding method based on connected domain centroid extraction
CN117459835A