Image processing method, device, equipment and storage medium

By identifying the boundaries of the imaging area in the ultra-wide-angle camera image and correcting the pixel values ​​of the dark area, the problem of image abnormality caused by excessive correction coefficient in the prior art is solved, and a more stable image correction effect is achieved.

CN113902644BActive Publication Date: 2025-03-28AXERA TECH (BEIJING) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111245876.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-26
Publication Date
2025-03-28
Estimated Expiration
2041-10-26

AI Technical Summary

Technical Problem

In the prior art, black areas often appear in images captured by ultra-wide-angle cameras. The correction coefficient obtained by directly calculating the difference between the image center and the black areas may be too large, resulting in abnormalities in the corrected image.

Method used

By identifying the boundaries of the imaging area in the image to be processed, the pixel values ​​of the pixels on the boundary are corrected to obtain the processed image, and then the correction coefficient is calculated based on the processed image to reduce the size of the correction coefficient and reduce the possibility of abnormality after correction.

Benefits of technology

By correcting the pixel value of the dark area and making it close to the pixel value of the imaging area, the size of the correction coefficient is reduced and the possibility of corrected image abnormalities occur.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113902644B_ABST
    Figure CN113902644B_ABST
Patent Text Reader

Abstract

The present application provides an image processing method, apparatus, device and storage medium, the image processing method comprising: obtaining an image to be processed; identifying an imaging area in the image to be processed to obtain a boundary of the imaging area; using the pixel values ​​of the pixels located on the boundary, correcting the pixel values ​​of the pixels located in the dark area of ​​the image to be processed to obtain a processed image of the image to be processed. The possibility of abnormality after image correction is reduced to a certain extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to an image processing method, apparatus, device and storage medium. Background Art

[0002] Recently, ultra-wide-angle cameras have become the new favorite in the mobile phone, security, automotive imaging, sports camera and other industries. Ultra-wide-angle cameras have a wide viewing angle and can capture as much of the scene in front of the lens as possible in one photo. However, in actual imaging, images taken by ultra-wide-angle cameras usually have black areas, such as Figure 1 Therefore, the black area needs to be corrected.

[0003] The traditional correction method is to calculate the brightness (or color) of the image center and the brightness (or color) of the image edge, and then obtain the correction coefficient of each pixel in the image based on the difference between the image center and the image edge, thereby achieving correction of the black area.

[0004] However, there is a large difference in brightness (or color) between the black area and the central area of ​​the image. If the correction coefficient of each pixel in the image is directly obtained based on the difference between the central area of ​​the image and the black area, the calculated correction coefficient may be very large. Correction with a large correction coefficient is likely to cause abnormalities in the corrected image area. Summary of the invention

[0005] Based on this, an image processing method, device, equipment and storage medium are proposed to solve the technical problem in the prior art that a large correction coefficient leads to abnormalities after correction.

[0006] In a first aspect, an image processing method is provided, comprising:

[0007] Get the image to be processed;

[0008] Identifying an imaging area in the image to be processed to obtain a boundary of the imaging area;

[0009] The pixel values ​​of the pixel points located on the boundary are used to correct the pixel values ​​of the pixel points located in the dark area of ​​the image to be processed, so as to obtain a processed image of the image to be processed.

[0010] The above-mentioned image processing method first obtains an image to be processed, wherein the image to be processed includes an imaging area and a dark area; then the imaging area in the image to be processed is identified to obtain the boundary of the imaging area; finally, the pixel values ​​of the pixels located in the dark area are corrected using the pixel values ​​of the pixels located on the boundary to obtain a processed image of the image to be processed. It can be seen that the above-mentioned image processing method corrects the pixel values ​​of the pixels located in the dark area by the pixel values ​​of the pixels located on the boundary. Through the correction, the pixel values ​​of the pixels in the dark area of ​​the processed image can be made close to the pixel values ​​of the pixels in the imaging area, and then the correction coefficient is calculated according to the processed image, so that the correction coefficient calculated according to the processed image is reduced compared to the correction coefficient calculated directly according to the image to be processed, thereby reducing the possibility of abnormality in the corrected dark area to a certain extent.

[0011] In one embodiment, the imaging area is a circular area; the identifying the imaging area in the image to be processed to obtain the boundary of the imaging area includes: binarizing the image to be processed to obtain a binary image; and performing circle detection on the binary image to obtain the boundary of the imaging area.

[0012] The above embodiment provides a detection method, that is, when the imaging area is a circular area, the image to be processed is first binarized to obtain a binary image, and then the circle detection method is used to detect the boundary of the imaging area.

[0013] In one embodiment, the pixel values ​​of the pixel points located in the dark area of ​​the image to be processed are corrected by using the pixel values ​​of the pixel points located on the boundary, including: calculating the distance between the target pixel point in the image to be processed and the circle dot of the imaging area to obtain the line distance; if the line distance is less than or equal to the radius of the boundary of the imaging area, keeping the pixel value of the target pixel point unchanged; if the line distance is greater than the radius of the boundary of the imaging area, determining the intersection of the line constructed by the target pixel point and the circle dot of the imaging area and the boundary of the imaging area; in the image to be processed, correcting the pixel value of the target pixel point to the pixel value of the intersection to obtain a processed image of the image to be processed.

[0014] The above embodiment provides a method for correcting the pixel values ​​of the pixel points in the dark area based on the pixel points in the imaging area. Since the intersection point and the dark area are relatively close in position, the pixel values ​​of the pixel points in the dark area on the connecting line are corrected using the pixel values ​​of the intersection point, which can make the correction effect more realistic to a certain extent.

[0015] In one embodiment, the image processing method further includes: dividing the processed image into a first number of image regions; determining endpoints of the first number of image regions; obtaining the maximum brightness of the processed image in a candidate channel; and calculating the brightness mean of each image region in the candidate channel;

[0016] According to the maximum brightness of the processed image in the candidate channel and the average brightness of each image area in the candidate channel, a brightness ratio matrix corresponding to the candidate channel is obtained, and the brightness ratio matrix records the brightness ratio of each endpoint in the candidate channel, and the brightness ratio reflects the brightness of the endpoint; according to the brightness ratio matrix corresponding to the candidate channel, a brightness correction coefficient matrix of the image to be processed in the candidate channel is obtained, and the brightness correction coefficient matrix records the brightness correction coefficient of each endpoint in the candidate channel.

[0017] In the above embodiment, the brightness correction coefficient matrix is ​​obtained by block calculation, so as to correct the brightness of the image to be processed by the brightness correction coefficient matrix.

[0018] In one embodiment, the endpoints include outer endpoints located at the outer boundary of the processed image and inner endpoints not located at the outer boundary; the brightness ratio matrix corresponding to the candidate channel is obtained according to the maximum brightness of the processed image in the candidate channel and the average brightness of each image area in the candidate channel, including: obtaining the brightness ratio of each inner endpoint in the candidate channel according to the maximum brightness of the processed image in the candidate channel and the average brightness of each image area in the candidate channel; obtaining an endpoint distance matrix according to the coordinate position of the pixel point corresponding to the maximum brightness of the candidate channel in the image to be processed and the coordinate position of each endpoint in the image to be processed; obtaining the brightness ratio of each outer endpoint in the candidate channel according to the endpoint distance matrix and the brightness ratio of each inner endpoint in the candidate channel.

[0019] In the above embodiment, when calculating the brightness ratio of the inner endpoint in the candidate channel, the brightness ratio of the inner endpoint in the candidate channel can be obtained according to the brightness ratio of the four image areas surrounding the inner endpoint; when calculating the brightness ratio of the outer endpoint in the candidate channel, the calculation can be performed according to the brightness ratio of the inner endpoint in the candidate channel, thereby realizing the calculation of the brightness ratios of all endpoints in the candidate channels.

[0020] In one embodiment, the brightness correction coefficient matrix of the image to be processed in the candidate channel is obtained according to the brightness ratio matrix corresponding to the candidate channel, including: constructing a mask image corresponding to the image to be processed according to the boundary of the imaging area; dividing the mask image into the first number of mask areas; calculating the average pixel value of each mask area, and obtaining a second number of mask areas and area positions of target mask areas whose average pixel values ​​are less than a preset pixel value according to the average pixel value of each mask area; constructing a regional mask according to the second number of mask areas, in which the pixel value of each area position is a first pixel value; in the regional mask, setting the pixel value of the area position of the target mask area to a second pixel value to obtain a target regional mask; obtaining the brightness correction coefficient matrix of the image to be processed in the candidate channel according to the brightness ratio matrix corresponding to the candidate channel and the target regional mask.

[0021] The above embodiment illustrates how to obtain the brightness correction coefficient matrix.

[0022] In one embodiment, the candidate channels include: an R channel, a GR channel, a GB channel and a B channel; the image processing method further includes: calculating the mean of the brightness correction coefficient matrix of the image to be processed in the GR channel and the brightness correction coefficient matrix of the GB channel to obtain a correction mean matrix; dividing the brightness correction coefficient matrix of the image to be processed in the target channel by the correction mean matrix to obtain a color correction coefficient matrix of the image to be processed in the target channel, wherein the target channel is one of the candidate channels; calculating the mean of the brightness correction coefficient matrix of the GR channel and the brightness correction coefficient matrix of the GB channel of the image to be processed at a standard color temperature to obtain a color temperature correction mean matrix; obtaining a color brightness correction coefficient matrix of the image to be processed in the target channel according to the color correction coefficient matrix of the image to be processed in the target channel and the color temperature correction mean matrix.

[0023] The above embodiment illustrates how to obtain the color brightness correction coefficient matrix of the target channel, so as to use the color brightness correction coefficient matrix of the target channel to correct the color and brightness of the image. Compared with the method of separately calculating the brightness correction coefficient and the color correction coefficient, and then using the brightness correction coefficient and the color correction coefficient to correct the image, this method can correct the color and brightness at the same time with only one correction, which improves the correction efficiency to a certain extent.

[0024] In a second aspect, an image processing device is provided, comprising:

[0025] An acquisition module, used for acquiring an image to be processed;

[0026] A boundary module, used for identifying an imaging area in the image to be processed to obtain a boundary of the imaging area;

[0027] The correction module is used to correct the pixel values ​​of the pixel points located in the dark area of ​​the image to be processed by using the pixel values ​​of the pixel points located on the boundary to obtain a processed image of the image to be processed.

[0028] In one embodiment, the imaging area is a circular area; the boundary module is specifically used to: perform binarization processing on the image to be processed to obtain a binary image; and perform circle detection on the binary image to obtain the boundary of the imaging area.

[0029] In one embodiment, the correction module is specifically used to: calculate the distance between the target pixel point in the image to be processed and the dot of the imaging area to obtain the line distance; if the line distance is less than or equal to the radius of the boundary of the imaging area, keep the pixel value of the target pixel point unchanged; if the line distance is greater than the radius of the boundary of the imaging area, determine the intersection of the line constructed by the target pixel point and the dot of the imaging area and the boundary of the imaging area; in the image to be processed, correct the pixel value of the target pixel point to the pixel value of the intersection to obtain a processed image of the image to be processed.

[0030] In one embodiment, the image processing device further includes: a correction coefficient module, which is used to divide the processed image into a first number of image areas; determine the endpoints of the first number of image areas; obtain the maximum brightness of the processed image in the candidate channel; calculate the average brightness of each image area in the candidate channel; obtain a brightness ratio matrix corresponding to the candidate channel based on the maximum brightness of the processed image in the candidate channel and the average brightness of each image area in the candidate channel, wherein the brightness ratio matrix records the brightness ratio of each endpoint in the candidate channel, and the brightness ratio reflects the brightness of the endpoint; obtain a brightness correction coefficient matrix of the image to be processed in the candidate channel based on the brightness ratio matrix corresponding to the candidate channel, wherein the brightness correction coefficient matrix records the brightness correction coefficient of each endpoint in the candidate channel.

[0031] In one embodiment, the endpoints include outer endpoints located at the outer boundary of the processed image and inner endpoints not located at the outer boundary; the correction coefficient module is specifically used to: obtain the brightness ratio of each inner endpoint in the candidate channel according to the maximum brightness of the processed image in the candidate channel and the average brightness of each image area in the candidate channel; obtain an endpoint distance matrix according to the coordinate position of the pixel point corresponding to the maximum brightness of the candidate channel in the image to be processed and the coordinate position of each endpoint in the image to be processed; obtain the brightness ratio of each outer endpoint in the candidate channel according to the endpoint distance matrix and the brightness ratio of each inner endpoint in the candidate channel.

[0032] In one embodiment, the correction coefficient module is specifically used to: construct a mask image corresponding to the image to be processed according to the boundary of the imaging area; divide the mask image into the first number of mask areas; calculate the average pixel value of each mask area, and obtain a second number of mask areas and regional positions of target mask areas whose average pixel values ​​are less than a preset pixel value according to the average pixel value of each mask area; construct a regional mask according to the second number of mask areas, in which the pixel value of each regional position is a first pixel value; in the regional mask, the pixel value of the regional position of the target mask area is set to a second pixel value to obtain a target regional mask; and obtain a brightness correction coefficient matrix of the image to be processed in the candidate channel according to the brightness ratio matrix corresponding to the candidate channel and the target regional mask.

[0033] In one embodiment, the candidate channels include: an R channel, a GR channel, a GB channel and a B channel; the image processing device also includes: a correction module, which is used to: calculate the mean of the brightness correction coefficient matrix of the image to be processed in the GR channel and the brightness correction coefficient matrix of the GB channel to obtain a correction mean matrix; divide the brightness correction coefficient matrix of the image to be processed in the target channel by the correction mean matrix to obtain a color correction coefficient matrix of the image to be processed in the target channel, and the target channel is one of the candidate channels; calculate the mean of the brightness correction coefficient matrix of the GR channel and the brightness correction coefficient matrix of the GB channel of the image to be processed at a standard color temperature to obtain a color temperature correction mean matrix; obtain the color brightness correction coefficient matrix of the image to be processed in the target channel according to the color correction coefficient matrix of the image to be processed in the target channel and the color temperature correction mean matrix.

[0034] According to a third aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the image processing method described above when executing the computer program.

[0035] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer program instructions, and when the computer program instructions are read and executed by a processor, the steps of the image processing method described above are executed. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0037] Figure 1 A schematic diagram of an imaging area and a dark area in an embodiment of the present application;

[0038] Figure 2 Schematic diagram of the implementation process of the image processing method in the embodiment of the present application;

[0039] Figure 3 Schematic diagram of a left image area, a left border, a right image area, and a right border in an embodiment of the present application;

[0040] Figure 4 In the embodiment of this application, detect Schematic diagram of

[0041] Figure 5 Schematic diagram of line t in an embodiment of the present application;

[0042] Figure 6 This is a revised schematic diagram in the embodiment of the present application;

[0043] Figure 7 A schematic diagram of endpoints in an embodiment of the present application;

[0044] Figure 8 A schematic diagram of an image area, inner endpoints, and outer endpoints in an embodiment of the present application;

[0045] Fig. 9 A schematic diagram of a mask area in an embodiment of the present application;

[0046] Fig.10 It is an exemplary result display in the examples of this application;

[0047] Fig.11 This is a schematic diagram of the composition structure of the image processing device in the embodiment of the present application;

[0048] Fig.12 This is a block diagram of the internal structure of a computer device in an embodiment of the present application. DETAILED DESCRIPTION

[0049] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. 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 creative work are within the scope of protection of the present invention.

[0050] In one embodiment, an image processing method is provided. The execution subject of the image processing method described in the embodiment of the present invention is a computer device capable of implementing the image processing method described in the embodiment of the present invention, and the computer device may include but is not limited to a terminal and a server. Among them, the terminal includes a desktop terminal and a mobile terminal, and the desktop terminal includes but is not limited to a desktop computer and a car computer; the mobile terminal includes but is not limited to a mobile phone, a tablet, a laptop computer and a smart watch. The server includes a high-performance computer and a high-performance computer cluster.

[0051] In one embodiment, Figure 2 As shown, an image processing method is provided, comprising:

[0052] Step 100: Obtain an image to be processed.

[0053] The image to be processed may be an image taken by an ultra-wide-angle camera, wherein the ultra-wide-angle camera includes a fisheye camera. The image taken by the ultra-wide-angle camera may be an original image taken by an image sensor in the ultra-wide-angle camera. The format of the original image is RAW format. For the original image in RAW format, there are a total of 4 channels, namely, R channel, GR channel, GB channel and B channel.

[0054] Step 200: Identify the imaging area in the image to be processed to obtain the boundary of the imaging area.

[0055] The image to be processed includes an imaging area and a dark area. The imaging area is an area in the image to be processed where a normal image is displayed. The shape of the imaging area includes but is not limited to a circle. For example, the shape of the imaging area can also be an ellipse. The dark area is a dark area in the image to be processed where the image cannot be displayed normally. For example, the dark area is a black area. The imaging area and the dark area can be as follows: Figure 1 In the image to be processed, there is a brightness difference between the imaging area and the dark area, and the brightness of the imaging area is higher than that of the dark area.

[0056] Since there is a brightness difference between the imaging area and the dark area, the imaging area in the image to be processed can be identified based on the brightness difference between the imaging area and the dark area, thereby obtaining the boundary of the imaging area. For example, the imaging area in the image to be processed can be identified by setting a brightness threshold based on the brightness difference between the imaging area and the dark area.

[0057] Step 300: Using the pixel values ​​of the pixel points located on the boundary, the pixel values ​​of the pixel points located in the dark area of ​​the image to be processed are corrected to obtain a processed image of the image to be processed.

[0058] For example Figure 3 As shown, the image to be processed is divided into two image areas, left and right. For channel i (channel i can be R channel, GR channel, GB channel or B channel), the mean of the pixel values ​​of the pixels on the left boundary (the pixel values ​​of channel i) is calculated, and the mean is used as the pixel values ​​of some pixels in the dark area of ​​the left image area in channel i; similarly, the mean of the pixel values ​​of the pixels on the right boundary (the pixel values ​​of channel i) is calculated, and the mean is used as the pixel values ​​of some pixels in the dark area of ​​the right image area in channel i.

[0059] The above-mentioned image processing method first obtains an image to be processed, wherein the image to be processed includes an imaging area and a dark area; then the imaging area in the image to be processed is identified to obtain the boundary of the imaging area; finally, the pixel values ​​of the pixels located in the dark area are corrected using the pixel values ​​of the pixels located on the boundary to obtain a processed image of the image to be processed. It can be seen that the above-mentioned image processing method corrects the pixel values ​​of the pixels located in the dark area by the pixel values ​​of the pixels located on the boundary. Through the correction, the pixel values ​​of the pixels in the dark area of ​​the processed image can be made close to the pixel values ​​of the pixels in the imaging area, and then the correction coefficient is calculated according to the processed image, so that the correction coefficient calculated according to the processed image is reduced compared to the correction coefficient calculated directly according to the image to be processed, thereby reducing the possibility of abnormality in the corrected dark area to a certain extent.

[0060] In one embodiment, the imaging area is a circular area; the step 200 of identifying the imaging area in the image to be processed to obtain the boundary of the imaging area includes:

[0061] Step 201, binarization is performed on the image to be processed to obtain a binarized image.

[0062] For example, a preset threshold is obtained, and the image to be processed is binarized according to the preset threshold to obtain a binarized image; for another example, the image to be processed is processed according to an adaptive threshold binarization algorithm to obtain a binarized image.

[0063] Step 202: Perform circle detection on the binary image to obtain the boundary of the imaging area.

[0064] Since the imaging area is a circular area, after obtaining the binary image, the radius of the imaging area (r boundary ), thereby realizing the detection of the imaging area, and then determining the boundary of the imaging area according to the radius and center of the imaging area.

[0065] In one example, if Figure 4 As shown, firstly, the radius of the imaging area is obtained by the circle detection method. Assuming that the radius of the imaging area is r detect , in order to prevent r detect Detection failure and out-of-bounds, set an offset value (r offset ) and two thresholds (r_thresshold low and r_thresshold high ), so r detect -r offset Assume that the radius of the boundary of the imaging area is r boundary Furthermore, the radius of the boundary needs to satisfy r_thresshold low <=r boundary <= r_thresshold high , thus preventing crossing the boundary. Since the radius r of the boundary of the imaging area boundary , therefore, according to the radius r of the boundary of the imaging area boundary and the center of the circle, the boundary of the imaging area can be determined.

[0066] The above embodiment provides a detection method, that is, when the imaging area is a circular area, the image to be processed is first binarized to obtain a binary image, and then the circle detection method is used to detect the boundary of the imaging area.

[0067] In one embodiment, the step 300 uses the pixel values ​​of the pixel points located on the boundary to correct the pixel values ​​of the pixel points located in the dark area of ​​the image to be processed to obtain the processed image of the image to be processed, including:

[0068] Step 301 , calculating the distance between the target pixel point in the image to be processed and the circular point in the imaging area to obtain the line distance.

[0069] The target pixel is a pixel in the image to be processed whose distance from the dot has not yet been determined.

[0070] like Figure 5 As shown in the figure, assuming that p1 is the target pixel, the circle is O, the coordinates of p1 are (j, i), and the coordinates of the circle O are (b, a), then the distance between p1 and the circle O (dist 连线 ): dist 连线 =((ai) 2 +(bj) 2 ) 0.5 .

[0071] Step 302: If the line distance is less than or equal to the radius of the boundary of the imaging area, the pixel value of the target pixel point is kept unchanged.

[0072] If the line distance dist 连线 If the radius is less than or equal to the boundary of the imaging area, the target pixel is considered to be located within the circular imaging area, and thus the pixel value of the target pixel is kept unchanged.

[0073] Step 303: If the line distance is greater than the radius of the boundary of the imaging area, determine the intersection of the line constructed by the target pixel point and the circle point of the imaging area and the boundary of the imaging area; in the image to be processed, correct the pixel value of the target pixel point to the pixel value of the intersection to obtain a processed image of the image to be processed.

[0074] If the line distance dist 连线 If the radius is greater than the boundary of the imaging area, the target pixel is considered to be outside the circular imaging area, and the pixel value of the target pixel is processed, that is, the pixel value of the target pixel is corrected to the pixel value of the intersection. Figure 5 As shown, the line formed by p1 and the point O is the line t, and the intersection of the line t and the boundary of the imaging area is p2. According to the coordinates of p1, the coordinates of the point O, and the line distance dist 连线 , we can find the coordinates of p2. Assuming the coordinates of p2 are (n, m), then:

[0075] m=ar boundary ×(ai) / dist 连线 , n = br boundary ×(bj) / dist 连线 .

[0076] After obtaining the coordinates of the intersection point p2, the pixel values ​​of the four channels of p2 are assigned to the target pixel point p1 respectively. The processed image after the above processing can be shown as Figure 6As shown, it can be seen that many divergent lines appear in the dark area, and the pixel values ​​of the pixels on these lines are corrected.

[0077] The above embodiment provides a method for correcting the pixel values ​​of the pixel points in the dark area based on the pixel points in the imaging area. Since the intersection point and the dark area are relatively close in position, the pixel values ​​of the pixel points in the dark area on the connecting line are corrected using the pixel values ​​of the intersection point, which can make the correction effect more realistic to a certain extent.

[0078] In one embodiment, the image processing method further includes: steps 400 to 900 .

[0079] Step 400: Divide the processed image into a first number of image regions.

[0080] The first number is a preset number, for example, the first number is m (rows) × n (columns), that is, the processed image is divided into m × n image regions, such as Figure 7 shown.

[0081] Step 500: Determine endpoints of the first number of image regions.

[0082] like Figure 7 As shown, since there are m×n image areas, there are a total of (m+1)×(n+1) endpoints, that is, a total of the second number of endpoints, where the second number is: (m+1)×(n+1).

[0083] Step 600, obtaining the maximum brightness of the processed image in the candidate channel.

[0084] The candidate channel is one of the R channel, the GR channel, the GB channel and the B channel.

[0085] The maximum brightness is the maximum pixel value of the processed image in the candidate channel. For example, if the candidate channel is the R channel, the pixel value of each pixel in the processed image in the R channel can be traversed. If it is found that the pixel value of pixel y in the R channel is the largest, the pixel value of pixel y in the R channel is set to the maximum brightness of the processed image in the candidate channel. Since the image captured by the image sensor is brighter closer to the center of the image and darker closer to the edge of the image, the maximum brightness of the processed image in each channel is usually located in the center of the processed image.

[0086] Step 700, calculating the brightness mean of each image region in the candidate channel.

[0087] like Figure 7As shown in FIG. 1 , for image region h, the pixel values ​​of each pixel in image region h in the candidate channel are added together to obtain the sum of the pixel values, and then the sum of the pixel values ​​is divided by the total number of pixels in image region h to obtain the brightness mean of image region h in the candidate channel. In this way, the brightness mean of each image region in the processed image in the candidate channel can be obtained.

[0088] Step 800, based on the maximum brightness of the processed image in the candidate channel and the average brightness of each image area in the candidate channel, obtain a brightness ratio matrix corresponding to the candidate channel, wherein the brightness ratio matrix records the brightness ratio of each endpoint in the candidate channel, and the brightness ratio reflects the brightness of the endpoint.

[0089] Since the maximum brightness of the candidate channel is known, that is, the brightness of the central area of ​​the processed image is known, and the average brightness of each image area in the candidate channel is known, that is, the brightness of each image area is known, therefore, according to the maximum brightness of the candidate channel and the average brightness of each image area in the candidate channel, the brightness ratio of each endpoint in the candidate channel can be calculated, thereby obtaining the brightness of each endpoint. Since the brightness ratio matrix records the brightness ratio of the endpoint in the candidate channel, the size of the brightness ratio matrix is ​​also: (m+1)×(n+1).

[0090] Step 900, obtaining a brightness correction coefficient matrix of the image to be processed in the candidate channel according to the brightness ratio matrix corresponding to the candidate channel, wherein the brightness correction coefficient matrix records the brightness correction coefficient of each endpoint in the candidate channel.

[0091] Since the brightness of each endpoint is obtained, the brightness correction coefficient matrix of the image to be processed in the candidate channel can be obtained according to the brightness ratio matrix corresponding to the candidate channel, that is, according to the brightness ratio of each endpoint in the candidate channel. For example, the larger the brightness ratio of the endpoint in the candidate channel, the larger the brightness correction coefficient of the endpoint in the candidate channel; the smaller the brightness ratio of the endpoint in the candidate channel, the smaller the brightness correction coefficient of the endpoint in the candidate channel, thereby obtaining the brightness correction coefficient matrix. After obtaining the brightness correction coefficient matrix, the brightness of the image to be processed can be corrected by the brightness correction coefficient matrix.

[0092] In the above embodiment, the brightness correction coefficient matrix is ​​obtained by block calculation, so as to correct the brightness of the image to be processed by the brightness correction coefficient matrix.

[0093] In one embodiment, the endpoints include an outer endpoint located at the outer boundary of the processed image and an inner endpoint not located at the outer boundary (the inner endpoint is located inside the image, such as Figure 8The white dots in the image have their outer endpoints located at the outer boundaries of the image, such as Figure 8 ); accordingly, in step 800, according to the maximum brightness of the processed image in the candidate channel and the brightness mean of each image area in the candidate channel, a brightness ratio matrix corresponding to the candidate channel is obtained, including:

[0094] Step 801 , obtaining a brightness ratio of each inner endpoint in the candidate channel according to the maximum brightness of the processed image in the candidate channel and the average brightness of each image region in the candidate channel.

[0095] First, the maximum brightness of the processed image in the candidate channel is divided by the average brightness of the image area in the candidate channel to obtain the brightness ratio of the image area in the candidate channel. For example, for image area t m,n , using y_t m,n Represents the image region t m,n The mean brightness of the candidate channel, luma_max is used to represent the maximum brightness of the processed image in the candidate channel, and gain_y_t is used m,n Represents the brightness ratio of the image area in the candidate channel, so gain_y_t m,n =luma_max / y_t m,n ; Then, the brightness ratio of the inner endpoint in the candidate channel is obtained according to the brightness ratio of the four image areas around the inner endpoint, for example Figure 8 , for the inner endpoint f i,j , using gain_inner_f i,j represents the inner endpoint f i,j The brightness ratio of the candidate channels, so gain_inner_f i,j =gain_y_t i-1,j-1 +gain_y_t i-1,j +gain_y_t i,j-1 +gain_y_t i,j .

[0096] Step 802 , obtaining an endpoint distance matrix according to the coordinate position of the pixel point corresponding to the maximum brightness of the candidate channel in the image to be processed and the coordinate position of each endpoint in the image to be processed.

[0097] For example, assuming that the pixel point corresponding to the maximum brightness of the candidate channel has a coordinate position (x1, y1) in the image to be processed, and the coordinate position of a certain endpoint in the image to be processed is (x2, y2), then the distance between the endpoint and the pixel point corresponding to the maximum brightness is: (x1-x2) 2 +(y1-y2) 2According to this calculation method, the distance between each endpoint and the pixel corresponding to the maximum brightness of the candidate channel can be calculated, thereby obtaining the endpoint distance matrix.

[0098] It should be noted that if only the coordinate positions of the pixel point and the endpoint corresponding to the maximum brightness of the candidate channel in the image area are known, then when calculating the distance between the endpoint and the pixel point corresponding to the maximum brightness of the candidate channel, the coordinate positions of the pixel point and the endpoint corresponding to the maximum brightness of the candidate channel in the image area need to be converted.

[0099] For example, the coordinate position of the pixel point corresponding to the maximum brightness of the candidate channel in the image area is (center_row, center_col), the image width of the image to be processed is image_width, and the image height of the image to be processed is image_height. Since the image to be processed is divided into m (rows) × n (columns), the number of horizontal pixels in each image area H_blocks = image_width / n, and the number of vertical pixels in each image area V_blocks = image_height / m. Assume that center_point_x is used to represent the horizontal coordinate of the pixel point corresponding to the maximum brightness of the candidate channel in the image to be processed, and center_point_y is used to represent the vertical coordinate of the pixel point corresponding to the maximum brightness of the candidate channel in the image to be processed, so:

[0100] center_point_x=center_col×H_blocks+H_blocks / 2

[0101] center_point_y=center_row*V_blocks+V_blocks / 2.

[0102] By using the above method, the coordinate position of the endpoint in the image area can also be converted into the coordinate position of the endpoint in the image to be processed.

[0103] Step 803: Obtain the brightness ratio of each outer endpoint in the candidate channel according to the endpoint distance matrix and the brightness ratio of each inner endpoint in the candidate channel.

[0104] First, k first inner endpoints are selected from all inner endpoints, and the brightness ratios of the k first inner endpoints in the candidate channel are obtained. K-1 second inner endpoints are selected from the remaining inner endpoints, and the distances between the k first inner endpoints and the pixels corresponding to the maximum brightness of the candidate channel are obtained according to the endpoint distance matrix. The brightness ratio of the i-th first inner endpoint in the k first inner endpoints in the candidate channel is expressed as gain_neiJD_i, and the distance between the i-th first inner endpoint in the k first inner endpoints and the pixel corresponding to the maximum brightness of the candidate channel is expressed as dist i , the distance between the jth second inner endpoint among the k-1 second inner endpoints and the pixel corresponding to the maximum brightness of the candidate channel is expressed as dist j ,then:

[0105] gain_neiJD_i=a1×dist1+a2×dist2+…+a j ×dist j +a k-1 ×dist k-1 +b×dist i .

[0106] Since there are k first inner endpoints, we can construct k of the above equations to solve: a1, a2, ..., a k-1 and b. Since a1, a2, …, a k-1 Therefore, when it is necessary to obtain the brightness ratio of the outer endpoint in the candidate channel, first obtain the distance between the outer endpoint and the pixel corresponding to the maximum brightness of the candidate channel from the endpoint distance matrix, and then use this distance as dist i , the brightness ratio of the outer endpoint in the candidate channel can be solved.

[0107] In the above embodiment, when calculating the brightness ratio of the inner endpoint in the candidate channel, the brightness ratio of the inner endpoint in the candidate channel can be obtained according to the brightness ratio of the four image areas surrounding the inner endpoint; when calculating the brightness ratio of the outer endpoint in the candidate channel, the calculation can be performed according to the brightness ratio of the inner endpoint in the candidate channel, thereby realizing the calculation of the brightness ratios of all endpoints in the candidate channels.

[0108] In one embodiment, the step 900 of obtaining the brightness correction coefficient matrix of the image to be processed in the candidate channel according to the brightness ratio matrix corresponding to the candidate channel includes:

[0109] Step 901: construct a mask image corresponding to the image to be processed according to the boundary of the imaging area.

[0110] According to the boundary of the imaging area, the value of the pixel point within the boundary is set to A, for example, A=1, and the value of the pixel point outside the boundary is set to B, for example, B=0, so as to obtain a mask image. In a specific example, when the imaging area is a circular area, according to the radius and the center of the imaging area, the value of the pixel point within the boundary is set to 1, and the value of the pixel point outside the boundary is set to 0, so as to obtain a mask image corresponding to the image to be processed, such as Fig. 9 As shown, that is, in the mask image, the pixel value of the pixel is 0 or 1.

[0111] Step 902: Divide the mask image into the first number of mask regions.

[0112] The mask image is divided into mask regions of m (rows) × n (columns).

[0113] Step 903, calculating the average pixel value of each mask area, and obtaining a second number of mask areas and area positions of target mask areas whose average pixel values ​​are less than a preset pixel value according to the average pixel value of each mask area.

[0114] For mask area d, the pixel values ​​of each pixel in mask area d are added to obtain the sum of the pixel values, and then the sum of the pixel values ​​is divided by the total number of pixels in mask area d to obtain the average pixel value of mask area d. In this way, the average pixel value of each mask area in the mask image can be obtained. Since the number of mask areas is m×n, in order to adapt to the number of endpoints for comparison, it is also necessary to copy the boundaries to obtain the second number, i.e., (m+1)×(n+1) mask areas. Boundary copying is essentially copying the average pixel value of the boundary, thereby obtaining (m+1)×(n+1) average pixel values.

[0115] The preset pixel value is a preset average pixel value. Since the average pixel values ​​of (m+1)×(n+1) mask areas have been obtained, the average pixel values ​​of (m+1)×(n+1) mask areas are compared with the preset pixel values ​​respectively, and the target mask area whose average pixel value is less than the preset pixel value and the area position of the target mask area can be obtained.

[0116] Step 904: construct a regional mask according to the second number of mask regions, in which the pixel value of each regional position is a first pixel value.

[0117] The second number = (m+1)×(n+1), so the size of the region mask is (m+1)×(n+1), and in the region mask, the pixel value of each region position (each region position corresponds to a pixel point) is the first pixel value, for example, the first pixel value is 1.

[0118] Step 905: In the regional mask, the pixel value of the regional position of the target mask region is set to a second pixel value to obtain a target regional mask.

[0119] For example, the second pixel value is 0.

[0120] Step 906: Obtain a brightness correction coefficient matrix of the image to be processed in the candidate channel according to the brightness ratio matrix corresponding to the candidate channel and the target area mask.

[0121] Multiply the brightness ratio matrix corresponding to the candidate channel by the target area mask. For example, the brightness ratio matrix corresponding to the candidate channel is gain_corner_all, and the target area mask is N. Therefore, the brightness correction coefficient matrix gain_lut of the candidate channel of the image to be processed is: gain_lut=gain_corner_all×N. It should be noted that the × here means multiplying the values ​​of the same position (for example, position A) to obtain a result, and then putting the result into the corresponding position (position A) in gain_lut.

[0122] In one example, in order to adjust the correction strength, a proportional coefficient ratio may be set, and gain_lut is updated by the proportional coefficient ratio. Thus, the updated brightness correction coefficient matrix gain_lut_final is: gain_lut_final=(1-gain_lut)*ratio+1.

[0123] It should be noted that, since there are four channels, namely, R channel, GR channel, GB channel and B channel, the updated brightness correction coefficient matrices of the four channels can be respectively expressed as: R_gain_lut, GR_gain_lut, GB_gain_lut and B_gain_lut.

[0124] The above embodiment illustrates how to obtain the brightness correction coefficient matrix.

[0125] In one embodiment, the candidate channels include: an R channel, a GR channel, a GB channel and a B channel; the image processing method further includes:

[0126] Step 1000, calculating the mean of the brightness correction coefficient matrix of the image to be processed in the GR channel and the brightness correction coefficient matrix of the GB channel to obtain a correction mean matrix.

[0127] For example, assuming that the brightness correction coefficient matrix of the image to be processed in the GR channel is: GR_gain_lut, and the brightness correction coefficient matrix of the image to be processed in the GB channel is: GB_gain_lut, then the correction mean matrix H is: H=(GR_gain_lut+GB_gain_lut) / 2.

[0128] Step 1001: Divide the brightness correction coefficient matrix of the image to be processed in the target channel by the correction mean matrix to obtain the color correction coefficient matrix of the image to be processed in the target channel, where the target channel is one of the candidate channels.

[0129] For example, the target channel is the R channel, and the brightness correction coefficient matrix of the image to be processed in the R channel is: R_gain_lut, so the color correction coefficient matrix of the image to be processed in the R channel is R_gain_lut / H; for another example, the target channel is the GR channel, and the brightness correction coefficient matrix of the image to be processed in the GR channel is: GR_gain_lut, so the color correction coefficient matrix of the image to be processed in the GR channel is GR_gain_lut / H; for another example, the target channel is the GB channel, and the brightness correction coefficient matrix of the image to be processed in the GB channel is: GB_gain_lut, so the color correction coefficient matrix of the image to be processed in the GB channel is GB_gain_lut / H; for another example, the target channel is the B channel, and the brightness correction coefficient matrix of the image to be processed in the B channel is: B_gain_lut, so the color correction coefficient matrix of the image to be processed in the B channel is B_gain_lut / H.

[0130] Step 1002, calculating the mean of the brightness correction coefficient matrix of the GR channel and the brightness correction coefficient matrix of the GB channel of the image to be processed at the standard color temperature, and obtaining a color temperature correction mean matrix.

[0131] Among them, the standard color temperature is D50. Assuming that the brightness correction coefficient matrix of the GR channel of the image to be processed at D50 is: D50_GR_gain_lut, and the brightness correction coefficient matrix of the GB channel of the image to be processed at D50 is: D50_GB_gain_lut, then the color temperature correction mean matrix W is: (D50_GR_gain_lut+D50_GB_gain_lut) / 2. The calculation of the brightness correction coefficient matrix of the GR channel and the brightness correction coefficient matrix of the GB channel under the standard color temperature can refer to steps 901 to 906, which will not be described in detail here.

[0132] Step 1003, obtaining a color brightness correction coefficient matrix of the image to be processed in the target channel according to the color correction coefficient matrix of the image to be processed in the target channel and the color temperature correction mean matrix.

[0133] For example, if the target channel is the R channel, the color brightness correction coefficient matrix of the R channel is: R_gain_lut / H×W; for another example, if the target channel is the GR channel, the color brightness correction coefficient matrix of the GR channel is: GR_gain_lut / H×W; for another example, if the target channel is the GB channel, the color brightness correction coefficient matrix of the GB channel is: GB_gain_lut / H×W; for another example, if the target channel is the B channel, the color brightness correction coefficient matrix of the B channel is: B_gain_lut / H×W. The size of the color brightness correction coefficient matrix is ​​(m+1)×(n+1).

[0134] Since the color brightness correction coefficient matrix has been obtained, the color brightness correction coefficient matrix can be used to correct the image to be processed. Specifically, the pixel points of each image area in the image to be processed need to be corrected according to the four values ​​in the color brightness correction coefficient matrix. For example, if the image to be processed has a total of m×n image areas, when the pixel values ​​of the pixels in the first image area in the image to be processed need to be corrected, the first image area (such as Figure 3 ) is corrected. For example, when the second image area in the processed image (such as Figure 4 ), the pixel values ​​of the pixels in the second image area are corrected according to the four values ​​at the positions (1,2), (1,3), (2,2), and (2,3) in the color brightness correction coefficient matrix, and so on, thereby achieving correction of all the pixels in the image to be processed.

[0135] like Fig.10 As shown (a horizontal row and a vertical column of pixels in the corrected image corresponding to the image to be processed are intercepted for display), the effect of correcting the image to be processed using the color brightness correction coefficient matrix is ​​demonstrated. Each line covered with dots represents the correction effect of a channel. It can be seen that after correction, the brightness around and in the center of the channel is balanced.

[0136] The above embodiment illustrates how to obtain the color brightness correction coefficient matrix of the target channel, so as to use the color brightness correction coefficient matrix of the target channel to correct the color and brightness of the image. Compared with the method of separately calculating the brightness correction coefficient and the color correction coefficient, and then using the brightness correction coefficient and the color correction coefficient to correct the image, this method can correct the color and brightness at the same time with only one correction, which improves the correction efficiency to a certain extent.

[0137] In one embodiment, Fig.11 As shown, an image processing device 1100 is provided, comprising:

[0138] An acquisition module 1101 is used to acquire an image to be processed;

[0139] A boundary module 1102 is used to identify an imaging area in the image to be processed to obtain a boundary of the imaging area;

[0140] The correction module 1103 is used to correct the pixel values ​​of the pixel points located in the dark area of ​​the image to be processed by using the pixel values ​​of the pixel points located on the boundary, so as to obtain a processed image of the image to be processed.

[0141] In one embodiment, the imaging area is a circular area; the boundary module 1102 is specifically used to: perform binarization processing on the image to be processed to obtain a binarized image; perform circle detection on the binarized image to obtain the boundary of the imaging area.

[0142] In one embodiment, the correction module 1103 is specifically used to: calculate the distance between the target pixel point in the image to be processed and the dot of the imaging area to obtain the line distance; if the line distance is less than or equal to the radius of the boundary of the imaging area, keep the pixel value of the target pixel point unchanged; if the line distance is greater than the radius of the boundary of the imaging area, determine the intersection of the line constructed by the target pixel point and the dot of the imaging area and the boundary of the imaging area; in the image to be processed, correct the pixel value of the target pixel point to the pixel value of the intersection to obtain a processed image of the image to be processed.

[0143] In one embodiment, the image processing device 1100 further includes: a correction coefficient module, which is used to divide the processed image into a first number of image areas; determine the endpoints of the first number of image areas; obtain the maximum brightness of the processed image in the candidate channel; calculate the average brightness of each image area in the candidate channel; obtain a brightness ratio matrix corresponding to the candidate channel based on the maximum brightness of the processed image in the candidate channel and the average brightness of each image area in the candidate channel, wherein the brightness ratio matrix records the brightness ratio of each endpoint in the candidate channel, and the brightness ratio reflects the brightness of the endpoint; obtain a brightness correction coefficient matrix of the image to be processed in the candidate channel based on the brightness ratio matrix corresponding to the candidate channel, wherein the brightness correction coefficient matrix records the brightness correction coefficient of each endpoint in the candidate channel.

[0144] In one embodiment, the endpoints include outer endpoints located at the outer boundary of the processed image and inner endpoints not located at the outer boundary; the correction coefficient module is specifically used to: obtain the brightness ratio of each inner endpoint in the candidate channel according to the maximum brightness of the processed image in the candidate channel and the average brightness of each image area in the candidate channel; obtain an endpoint distance matrix according to the coordinate position of the pixel point corresponding to the maximum brightness of the candidate channel in the image to be processed and the coordinate position of each endpoint in the image to be processed; obtain the brightness ratio of each outer endpoint in the candidate channel according to the endpoint distance matrix and the brightness ratio of each inner endpoint in the candidate channel.

[0145] In one embodiment, the correction coefficient module is specifically used to: construct a mask image corresponding to the image to be processed according to the boundary of the imaging area; divide the mask image into the first number of mask areas; calculate the average pixel value of each mask area, and obtain a second number of mask areas and regional positions of target mask areas whose average pixel values ​​are less than a preset pixel value according to the average pixel value of each mask area; construct a regional mask according to the second number of mask areas, in which the pixel value of each regional position is a first pixel value; in the regional mask, the pixel value of the regional position of the target mask area is set to a second pixel value to obtain a target regional mask; and obtain a brightness correction coefficient matrix of the image to be processed in the candidate channel according to the brightness ratio matrix corresponding to the candidate channel and the target regional mask.

[0146] In one embodiment, the candidate channels include: an R channel, a GR channel, a GB channel and a B channel; the image processing device also includes: a correction module, which is used to: calculate the mean of the brightness correction coefficient matrix of the image to be processed in the GR channel and the brightness correction coefficient matrix of the GB channel to obtain a correction mean matrix; divide the brightness correction coefficient matrix of the image to be processed in the target channel by the correction mean matrix to obtain a color correction coefficient matrix of the image to be processed in the target channel, and the target channel is one of the candidate channels; calculate the mean of the brightness correction coefficient matrix of the GR channel and the brightness correction coefficient matrix of the GB channel of the image to be processed at a standard color temperature to obtain a color temperature correction mean matrix; obtain the color brightness correction coefficient matrix of the image to be processed in the target channel according to the color correction coefficient matrix of the image to be processed in the target channel and the color temperature correction mean matrix.

[0147] In one embodiment, Fig.12As shown, a computer device is provided, which can be a terminal or a server. The computer device includes a processor, a memory and a network interface connected by a system bus, and the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and can also store a computer program. When the computer program is executed by the processor, the processor can implement the image processing method. The non-volatile memory may include a read-only memory (ROM), a programmable ROM (PROM), an electrically programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM) or a flash memory. The volatile memory may include a random access memory (RAM) or an external cache memory. As an illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM). The internal memory may also store a computer program, which, when executed by the processor, enables the processor to execute the image processing method. Fig.12 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0148] The image processing method provided in the present application can be implemented in the form of a computer program. The computer program can be Fig.12 The computer device shown in the figure is run. The memory of the computer device can store various program templates constituting the image processing device, such as the acquisition module 1101 and the boundary module 1102.

[0149] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the following steps:

[0150] Get the image to be processed;

[0151] Identifying an imaging area in the image to be processed to obtain a boundary of the imaging area;

[0152] The pixel values ​​of the pixel points located on the boundary are used to correct the pixel values ​​of the pixel points located in the dark area of ​​the image to be processed, so as to obtain a processed image of the image to be processed.

[0153] In one embodiment, a computer-readable storage medium is provided, storing a computer program, and when the computer program is executed by a processor, the processor performs the following steps:

[0154] Get the image to be processed;

[0155] Identifying an imaging area in the image to be processed to obtain a boundary of the imaging area;

[0156] The pixel values ​​of the pixel points located on the boundary are used to correct the pixel values ​​of the pixel points located in the dark area of ​​the image to be processed, so as to obtain a processed image of the image to be processed.

[0157] It should be noted that the above-mentioned image processing method, image processing device, computer equipment and computer-readable storage medium belong to a general inventive concept, and the contents in the embodiments of the image processing method, image processing device, computer equipment and computer-readable storage medium are applicable to each other.

[0158] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0159] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0160] Furthermore, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.

[0161] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.

[0162] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. An image processing method, characterized in that: include: Get the image to be processed; Identifying an imaging area in the image to be processed to obtain a boundary of the imaging area; Using the pixel values ​​of the pixel points located on the boundary, the pixel values ​​of the pixel points located in the dark area of ​​the image to be processed are corrected to obtain a processed image of the image to be processed; The imaging area is a circular area; The step of identifying the imaging area in the image to be processed to obtain the boundary of the imaging area includes: performing binarization processing on the image to be processed to obtain a binarized image; performing circle detection on the binarized image to obtain the boundary of the imaging area; The method uses the pixel values ​​of the pixel points located on the boundary to correct the pixel values ​​of the pixel points located in the dark area of ​​the image to be processed, including: calculating the distance between the target pixel point in the image to be processed and the circle dot in the imaging area to obtain the line distance; if the line distance is less than or equal to the radius of the boundary of the imaging area, keeping the pixel value of the target pixel point unchanged; if the line distance is greater than the radius of the boundary of the imaging area, determining the intersection of the line constructed by the target pixel point and the circle dot in the imaging area and the boundary of the imaging area; in the image to be processed, correcting the pixel value of the target pixel point to the pixel value of the intersection to obtain a processed image of the image to be processed.

2. The image processing method according to claim 1, characterized in that: Also includes: dividing the processed image into a first number of image regions; determining endpoints of said first number of image regions; Obtaining the maximum brightness of the processed image in the candidate channel; Calculate the brightness mean of each image area in the candidate channel; According to the maximum brightness of the processed image in the candidate channel and the average brightness of each image area in the candidate channel, a brightness ratio matrix corresponding to the candidate channel is obtained, wherein the brightness ratio matrix records the brightness ratio of each endpoint in the candidate channel, and the brightness ratio reflects the brightness of the endpoint; According to the brightness ratio matrix corresponding to the candidate channel, a brightness correction coefficient matrix of the image to be processed in the candidate channel is obtained, and the brightness correction coefficient matrix records the brightness correction coefficient of each endpoint in the candidate channel.

3. The image processing method according to claim 2, characterized in that: The endpoints include an outer endpoint located at an outer boundary of the processed image and an inner endpoint not located at the outer boundary; The step of obtaining a brightness ratio matrix corresponding to the candidate channel according to the maximum brightness of the processed image in the candidate channel and the average brightness of each image area in the candidate channel comprises: Obtaining a brightness ratio of each inner endpoint in the candidate channel according to the maximum brightness of the processed image in the candidate channel and the average brightness of each image area in the candidate channel; Obtain an endpoint distance matrix according to the coordinate position of the pixel point corresponding to the maximum brightness of the candidate channel in the image to be processed and the coordinate position of each endpoint in the image to be processed; The brightness ratio of each outer endpoint in the candidate channel is obtained according to the endpoint distance matrix and the brightness ratio of each inner endpoint in the candidate channel.

4. The image processing method according to claim 2, wherein: The step of obtaining a brightness correction coefficient matrix of the image to be processed in the candidate channel according to the brightness ratio matrix corresponding to the candidate channel includes: Constructing a mask image corresponding to the image to be processed according to the boundary of the imaging area; dividing the mask image into the first number of mask regions; Calculating an average pixel value of each mask area, and obtaining a second number of mask areas and area positions of target mask areas whose average pixel values ​​are less than a preset pixel value according to the average pixel value of each mask area; constructing a regional mask according to the second number of mask regions, wherein a pixel value at each regional position in the regional mask is a first pixel value; In the regional mask, the pixel value of the regional position of the target mask region is set to a second pixel value to obtain a target regional mask; According to the brightness ratio matrix corresponding to the candidate channel and the target area mask, a brightness correction coefficient matrix of the image to be processed in the candidate channel is obtained.

5. The image processing method according to claim 2, characterized in that: The candidate channels include: R channel, GR channel, GB channel and B channel; The image processing method further includes: Calculating the mean of the brightness correction coefficient matrix of the GR channel and the brightness correction coefficient matrix of the GB channel of the image to be processed to obtain a correction mean matrix; Dividing the brightness correction coefficient matrix of the image to be processed in the target channel by the correction mean matrix to obtain a color correction coefficient matrix of the image to be processed in the target channel, where the target channel is one of the candidate channels; Calculating the mean of the brightness correction coefficient matrix of the GR channel and the brightness correction coefficient matrix of the GB channel of the image to be processed at the standard color temperature to obtain a color temperature correction mean matrix; A color brightness correction coefficient matrix of the image to be processed in the target channel is obtained according to the color correction coefficient matrix of the image to be processed in the target channel and the color temperature correction mean matrix.

6. An image processing device, characterized in that: include: An acquisition module, used for acquiring an image to be processed; A boundary module, used for identifying an imaging area in the image to be processed to obtain a boundary of the imaging area; A correction module, used to correct the pixel values ​​of the pixel points located in the dark area of ​​the image to be processed by using the pixel values ​​of the pixel points located on the boundary, so as to obtain a processed image of the image to be processed; The imaging area is a circular area; the boundary module is specifically used to: perform binarization processing on the image to be processed to obtain a binarized image; perform circle detection on the binarized image to obtain the boundary of the imaging area; The correction module is specifically used to: calculate the distance between the target pixel point in the image to be processed and the dot of the imaging area to obtain a line distance; if the line distance is less than or equal to the radius of the boundary of the imaging area, keep the pixel value of the target pixel point unchanged; if the line distance is greater than the radius of the boundary of the imaging area, determine the intersection of the line constructed by the target pixel point and the dot of the imaging area and the boundary of the imaging area; In the image to be processed, the pixel value of the target pixel point is corrected to the pixel value of the intersection point to obtain a processed image of the image to be processed.

7. A computer device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the image processing method according to any one of claims 1 to 5 when executing the computer program.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are read and executed by a processor, the steps of the image processing method according to any one of claims 1 to 5 are executed.

Citation Information

Patent Citations

  • Panoramic image vignetting phenomenon compensation method

    CN106101588A

  • Shading correction method and device in imaging apparatus

    JP2008113236A