Image processing method and device for suppressing pseudo information, and storage medium
By calculating and filtering direction information in image processing and optimizing the interpolation process, the problem of introducing pseudo-information by demosaic is solved, the image clarity is improved, and the pseudo-information suppression effect is achieved without increasing the calculation amount.
Patent Information
- Application Number
- CN202411587460.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-08
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2044-11-08
AI Technical Summary
The prior art introduces pseudo-information in the demosaic processing process, resulting in a decrease in image clarity and a lack of an effective calculation reduction scheme.
By acquiring the image to be processed, determining the target position and operation area, calculating the direction information of the original channel pixels, performing filtering and interpolation, updating the interpolated pixels, preferentially interpolated channels, reducing false colors, molar patterns and bad points, and improving image clarity.
Without increasing the calculation amount, the pseudo-information caused by demosaic is effectively suppressed, the image clarity is improved, and the molar patterns and bad points are reduced.
Smart Images

Figure CN119107226A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing, and in particular to an image processing method, device and storage medium for suppressing false information. Background Art
[0002] With the continuous improvement of medical surgery technology, the target part is often observed with the help of shooting and display systems during surgery. The quality of medical images and videos has become one of the concerns in medical systems. Medical equipment usually uses CMOS and other camera devices to collect Bayer-arranged image data, referred to as Bayer data. Bayer format data is composed of incomplete RGB data arranged at intervals. It is necessary to use the existing pixel values in the surrounding information to interpolate and complete the RGB three-channel data. This interpolation and completion process is also called de-mosaicing.
[0003] During the demosaicing process, the original Bayer image includes red pixel values, blue pixel values, and green pixel values. The two missing color components of each pixel are obtained by interpolation (for example, the blue component and red component of the green pixel are interpolated), so that each pixel includes red component, green component, and blue component, thereby converting the Bayer image into an RGB image. However, after the demosaicing process, additional pseudo information that does not exist in the original image will be introduced, such as false color, moiré, bad pixels, etc., thereby affecting the clarity of the image. In the related art, the false color, moiré, bad pixels, etc. generated by the demosaicing process are judged and removed after the interpolation is completed, which adds additional judgment and elimination processes and increases the amount of calculation.
[0004] At present, no effective solution has been proposed for the problem that removing false information from images requires a large amount of computation in related technologies. Summary of the invention
[0005] Based on this, it is necessary to provide an image processing method, device and storage medium that can suppress false information without increasing the amount of calculation in order to solve the above technical problems.
[0006] In a first aspect, the present application provides an image processing method for suppressing false information, comprising: Acquire a first image to be processed, determine a target position in the first image where first channel interpolation is to be performed, and determine an operation area with the target position as the center; wherein the number of pixels in the first channel in the first image is not less than the number of pixels in the second channel; Calculate first direction information of original second channel pixels in the target position based on the operation area; filtering the first direction information to obtain second direction information; inserting a first interpolation pixel at the target position according to the first direction information; updating the first interpolation pixel according to the second direction information; Based on the first channel pixels obtained after updating the first interpolation pixels, the second channel is interpolated to obtain a second image.
[0007] In one embodiment, calculating the first direction information of the original second channel pixel in the target position based on the operation area includes: In the horizontal direction of the rows of the operation area, a first mean value of the absolute values of the differences between adjacent pixels of the first channel is calculated, and in the horizontal direction of the rows of the operation area, a second mean value of the absolute values of the differences between adjacent pixels of the second channel is calculated; Adding the first mean value and the second mean value to obtain first horizontal direction information; Calculating a third mean of absolute values of differences between adjacent pixels of the first channel in the vertical direction of the columns of the operation area, and calculating a fourth mean of absolute values of differences between adjacent pixels of the second channel in the vertical direction of the columns of the operation area; Adding the third mean value and the fourth mean value to obtain first vertical direction information; The first direction information is obtained according to the first horizontal direction information and the first vertical direction information.
[0008] In one embodiment, inserting a first interpolation pixel at the target position according to the first direction information includes: comparing the first horizontal direction information with the first vertical direction information; If the first horizontal direction information is less than the first vertical direction information, calculating the value of the first interpolated pixel along the row direction of the target position; If the horizontal direction information of the first direction information is greater than the vertical direction information, calculating the value of the first interpolation pixel along the column direction of the target position; If the horizontal direction information of the first direction information is equal to the vertical direction information, the value of the first interpolation pixel is calculated along the row direction and the column direction of the target position.
[0009] In one embodiment, filtering the first direction information to obtain the second direction information includes: Dividing the operating area into a plurality of sub-areas; In each sub-region, a first pixel having the same channel attribute as an original pixel at the target position and a second pixel having a different channel attribute from the original pixel are identified; wherein the second pixel does not include the first channel pixel; In a specific direction corresponding to the sub-region, calculating a sum of the direction information of the first pixels, and calculating a mean of the direction information of the second pixels; The sum of the direction information of the first interpolated pixels and the mean of the direction information of the second pixels are added to obtain the second direction information of each sub-region.
[0010] In one of the embodiments, it is characterized in that the second direction information includes: second horizontal left direction information, second horizontal right direction information, second vertical upper direction information, and second vertical lower direction information.
[0011] In one of the embodiments, the sub-region includes a left sub-region, a right sub-region, an upper sub-region, and a lower sub-region of the operating region, and filtering the first direction information to obtain the second direction information includes: For the left half sub-region: on the central row where the target position is located, the first horizontal direction information of the first pixels is added to obtain a first value; on the neighboring row adjacent to the central row, the mean values of the first horizontal direction information of the second pixels are added to obtain a second value; the first value and the second value are added to obtain the second horizontal left direction information; For the right half sub-region: on the central row, add the first horizontal direction information of the first pixels to obtain a third value; on a neighboring row adjacent to the central row, add the mean values of the first horizontal direction information of the second pixels to obtain a fourth value; add the third value and the fourth value to obtain the second horizontal right direction information; For the upper sub-region: on the central column where the target position is located, the first vertical direction information of the first pixels is added to obtain a fifth value; on the neighboring column adjacent to the central column, the mean values of the first vertical direction information of the second pixels are added to obtain a sixth value; and the fifth value and the sixth value are added to obtain the second vertical upper direction information; For the lower half sub-area: on the central column, add the first vertical direction information of the first pixels to obtain a seventh value; on the neighboring column adjacent to the central column, add the mean values of the first vertical direction information of the second pixels to obtain an eighth value; add the seventh value and the eighth value to obtain the second vertical downward direction information.
[0012] In one embodiment, updating the first interpolation pixel according to the second direction information includes: Determining pixel update information of the target position; Determining pixel update information of a non-target position in the operation area according to the second direction information; The first interpolation pixel is updated according to the pixel update information of the target position and the pixel update information of the non-target position to obtain a first interpolation pixel update value.
[0013] In one embodiment, after updating the first interpolated pixel according to the pixel update information of the target position and the pixel update information of the non-target position to obtain the first interpolated pixel update value, the method further includes: comparing the first interpolated pixel update value of the target position with the first interpolated pixel update value adjacent to the target position; If the first interpolation pixel update value of the target position is greater than the maximum value of the first interpolation pixel update values adjacent to the target position, inserting the maximum value of the first interpolation pixel update values adjacent to the target position into the target position; If the first interpolation pixel update value of the target position is smaller than a minimum value of the first interpolation pixel update values adjacent to the target position, the minimum value of the first interpolation pixel update values adjacent to the target position is inserted into the target position.
[0014] In one embodiment, interpolating the second channel based on the first channel pixels obtained after updating the first interpolated pixels to obtain the second image includes: Determine a second channel pixel that is adjacent to the position to be interpolated and has the same channel attribute as the second interpolation pixel to be inserted; The second interpolation pixel is calculated based on the determined second channel pixel, the original pixel at the position to be interpolated, and the first interpolation pixel adjacent to the position to be interpolated and updated, and the second interpolation pixel is inserted into the position to be interpolated.
[0015] In a second aspect, the present application provides an image processing device for suppressing false information, the device comprising: an acquisition module, used for acquiring a first image to be processed, determining a target position in the first image for first channel interpolation, and determining an operation area with the target position as the center; wherein the number of pixels in the first channel in the first image is not less than the number of pixels in the second channel; A first direction information calculation module, used for calculating the first direction information of the original second channel pixel in the target position based on the operation area; A second direction information calculation module, used for filtering the first direction information to obtain second direction information; A first interpolation module, configured to insert a first interpolation pixel at the target position according to the first direction information; An updating module, configured to update the first interpolation pixel according to the second direction information; The second interpolation module is used to interpolate the second channel based on the first channel pixels obtained after updating the first interpolation pixels to obtain a second image.
[0016] In a third aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.
[0017] The above-mentioned image processing method, device and storage medium for suppressing false information determine the channel interpolation priority according to the amount of channel information in the RGB channel. For the priority interpolation channel, the initial first interpolation pixel is obtained by introducing the first direction information into the first channel interpolation process, and the false color, moiré and bad pixel problems are preliminarily eliminated. Then, the first direction information is filtered to obtain the second direction information, and the first interpolation pixel is updated based on the second direction, so that the interpolation result can be more consistent with the surrounding texture direction information, further reducing moiré and bad pixels; finally, the interpolation of the second channel is completed based on the updated first interpolation pixel. In this way, without increasing the calculation area, the false information caused by de-mosaicing is effectively suppressed, and the false information is suppressed in the process of de-mosaicing, and the clarity of the image is improved without increasing the amount of calculation. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 A hardware structure block diagram of a terminal of an image processing method for suppressing false information in an embodiment; Figure 2 is a flowchart of an image processing method for suppressing false information in one embodiment; Figure 3 Schematic diagram of input and output of de-mosaicing in one embodiment; Figure 4 is a schematic diagram of interpolation for demosaicing in one embodiment; Figure 5 is a schematic diagram of a first image in one embodiment; Figure 6 is a schematic diagram of a first image in another embodiment; Figure 7 is a schematic diagram of a first image in another embodiment; Figure 8 is a flowchart of an image processing method for suppressing false information in another embodiment; Fig. 9 FIG. 4 is a structural block diagram of an image processing device for suppressing false information in an embodiment. DETAILED DESCRIPTION
[0019] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0020] Unless otherwise defined, the technical terms or scientific terms involved in this application shall have the general meaning understood by people with general skills in the technical field to which this application belongs. The words "one", "a", "the", "these" and the like in this application do not indicate a quantitative limitation, and they may be singular or plural. The terms "include", "comprise", "have" and any variants thereof involved in this application are intended to cover non-exclusive inclusions; for example, a process, method and system, product or device comprising a series of steps or modules (units) is not limited to the listed steps or modules (units), but may include unlisted steps or modules (units), or may include other steps or modules (units) inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" may mean: A exists alone, A and B exist at the same time, and B exists alone. Generally, the character " / " indicates that the objects associated with each other are in an "or" relationship. The terms "first", "second", "third", etc. in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.
[0021] The method embodiment provided in this embodiment can be executed in a terminal, a computer or a similar computing device. For example, running on a terminal, Figure 1 FIG. 1 is a hardware structure block diagram of a terminal of an image processing method for suppressing false information according to an embodiment of the present application. Figure 1 As shown, the terminal may include one or more ( Figure 1 Only one is shown in the figure) processor 101 and memory 102 for storing data, wherein processor 101 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA. The above terminal may also include a transmission device 103 and an input and output device 104 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0022] The memory 102 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the image processing method for suppressing false information in this embodiment. The processor 101 executes various functional applications and data processing by running the computer program stored in the memory 102, that is, to implement the above method. The memory 102 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 102 may further include a memory remotely arranged relative to the processor 101, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0023] The transmission device 103 is used to receive or send data via a network. The above network includes a wireless network provided by a communication provider of the terminal. In one example, the transmission device 103 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 103 can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly.
[0024] Related technologies provide the following image false information removal methods: One is to divide the image into different areas by the information entropy of the image area, and use different false color removal methods for different areas to achieve the purpose of false color removal. This method performs false color removal after demosaicing, which increases the image processing process and calculation amount.
[0025] The other method is to select the pixels that meet the preset moiré color and direction characteristics as moiré pixels in the image to be processed, count the regional interpolation direction of the pixels, and re-interpolate to suppress the generation of moiré. This solution also determines whether the pixels after the interpolation are moiré pixels after the demosaicing process, and then re-interpolates.
[0026] Based on the analysis of the above situation, in this embodiment, an image processing method for suppressing false information is provided to solve image quality problems such as false color, moiré, bad pixels, etc. that occur in the de-mosaic processing in the ISP (Image Signal Processor) process. Figure 2 is a flow chart of the image processing method for suppressing false information, such as Figure 2 As shown, the process includes the following steps: Step S101, obtaining a first image to be processed, determining a target position in the first image for first channel interpolation, and determining an operation area with the target position as the center; wherein the number of pixels in the first channel in the first image is not less than the number of pixels in the second channel.
[0027] Figure 3 This is a schematic diagram of the input and output of demosaicing, such as Figure 3 As shown, the de-mosaicing process is to convert the input Bayer format data into the output data in RGB format. The conversion process is to supplement the missing data information, that is, to interpolate the R, G, and B channel information respectively. Bayer images can have four formats: RGGB, BGGR, GRGB, and GBGR, depending on the order of pixel position arrangement. This embodiment can input a Bayer image in any format and output an RGB image. For ease of understanding, this embodiment is described using the RGGB format. For the first image in RGGB format, the first channel is the G channel, and the second channel is the R or B channel (referred to as the R / B channel). It can be found that the number of pixels in the G channel is twice the number of pixels in the R / B channel.
[0028] Figure 4 is a schematic diagram of interpolation for demosaicing, such as Figure 4 As shown, in this process, the missing g data is interpolated in the G channel, the missing r data is interpolated in the R channel, and the missing b data is interpolated in the B channel. For the RGGB format, the G channel needs to be newly expanded by 1 times the amount of original data, and the R and B channels need to be newly expanded by 2 times the amount of original data. In this process, since the amount of information in the R and B channels is small, and the spectral response intensity of the R and B channels is not as strong as the spectral response intensity of the G channel, if the R / B channels are interpolated first and the G channel is interpolated later, the R / B channels are very prone to interpolation errors and color mutations, regional interference and other problems, and affect the processing of the subsequent ISP process, and ultimately appear on the display end. Image quality problems such as false colors, moiré patterns, and bad pixels that do not conform to the laws of reality. To solve the above problems, this embodiment interpolates the G channel first and then the R / B channels.
[0029] Figure 5 is a schematic diagram of the first image in this embodiment, such as Figure 5 As shown, red represents R channel pixels, green represents G channel pixels, blue represents B channel pixels, and the numbers represent the numbers of the corresponding channel pixels. Assuming that R0 is currently determined to be the target position for G channel interpolation, the N×N neighborhood information around R0 can be obtained to obtain a small operation area, where N can be 5, 7, 9, etc. As an example, N is 5.
[0030] Step S102: calculating first direction information of original second channel pixels in the target position based on the operation area.
[0031] The first direction information of the original second channel pixel is the first direction information of R0. When calculating the first direction information, the direction information of the G channel and the R / B channel around R0 can be used in the operation area to calculate the first direction information of R0. The first direction information includes the first horizontal direction information and the first vertical direction information.
[0032] Step S103: filter the first direction information to obtain second direction information.
[0033] When calculating the second direction information, the first direction information of the R / B channel may be filtered several times (eg, twice) in the operation area to calculate the second direction information of the target position, wherein the second direction information includes the second horizontal direction information and the second vertical direction information.
[0034] Step S104: inserting a first interpolation pixel at the target position according to the first direction information.
[0035] According to the first direction information of R0 and the pixels around R0, the initial first interpolation pixel (g pixel) is calculated. The same operation is performed for other target positions to be interpolated for the first channel. The G channel is interpolated once according to the first direction information to fill in all the missing data in the G channel and obtain the full-resolution G pixel.
[0036] Step S105: update the first interpolation pixel according to the second direction information.
[0037] According to the second direction information of the target position and the pixels in the area around the target position, a new first interpolation pixel (g' pixel) is calculated. It should be noted that the causes of moiré and bad pixels include high-frequency noise interference. The second direction information is the low-frequency information obtained after filtering the first direction information. The low-frequency information is subsequently used to update the first interpolation pixel, which can make the interpolation result more consistent with the surrounding texture direction information, thereby reducing moiré and bad pixels.
[0038] Step S106, interpolating the second channel based on the first channel pixels obtained after updating the first interpolated pixels to obtain a second image.
[0039] Interpolation of the second channel is to insert r pixels into the R channel and b pixels into the B channel to complete the missing data in the R / B channel. The color difference interpolation method can be used to interpolate the r and b pixels at the G channel position, and the pixels at the surrounding R / B channel positions are used to calculate.
[0040] In the above steps S101 to 106, the channel interpolation priority is determined according to the amount of channel information in the RGB channel. For the priority interpolation channel, the initial first interpolation pixel is obtained by introducing the first direction information into the first channel interpolation process, and the false color, moiré and bad pixel problems are preliminarily eliminated. Then, the first direction information is filtered to obtain the second direction information, and the first interpolation pixel is updated based on the second direction, so that the interpolation result can be more consistent with the surrounding texture direction information, further reducing moiré and bad pixels; finally, the interpolation of the second channel is completed based on the updated first interpolation pixel. In this way, without increasing the calculation area, the pseudo information caused by de-mosaicing is effectively suppressed, and the pseudo information is suppressed in the process of de-mosaicing, and the clarity of the image is improved without increasing the amount of calculation.
[0041] In one embodiment, the above step S102, calculating the first direction information of the original second channel pixel in the target position based on the operation area, can be implemented by the following method: (1) First horizontal direction information: In the horizontal direction of the rows of the operation area, calculate the first mean of the absolute values of the differences between adjacent first channel pixels, and, in the horizontal direction of the rows of the operation area, calculate the second mean of the absolute values of the differences between adjacent second channel pixels; add the first mean and the second mean to obtain the first horizontal direction information. Figure 5 , the specific calculation formula is as follows:
[0042] Among them, H1 represents the first horizontal direction information, h1 represents the first mean value, and h2 represents the second mean value.
[0043] (2) First vertical direction information: In the vertical direction of the columns of the operation area, calculate the third mean of the absolute values of the differences between adjacent first channel pixels, and, in the vertical direction of the columns of the operation area, calculate the fourth mean of the absolute values of the differences between adjacent second channel pixels; add the third mean and the fourth mean to obtain the first vertical direction information. Figure 5 , the specific calculation formula is as follows:
[0044] Among them, V1 represents the first vertical direction information, v1 represents the third mean, and v2 represents the fourth mean.
[0045] This embodiment combines the direction information of the first channel and the second channel when calculating the first direction information, so that the initial first direction information is more accurate.
[0046] In one embodiment, in the above step S103, filtering the first direction information to obtain the second direction information can be achieved by the following method: An operation area is divided into a plurality of sub-areas; in each sub-area, a first pixel having the same channel attribute as an original pixel at a target position and a second pixel having a different channel attribute from the original pixel are identified; wherein the second pixel does not include the first channel pixel; in a specific direction corresponding to the sub-area, the sum of the direction information of the first pixels is calculated, and the mean of the direction information of the second pixels is calculated; the sum of the direction information of the first pixels and the mean of the direction information of the second pixels are added to obtain the second direction information of each sub-area.
[0047] In this embodiment, the second direction information includes: second horizontal left direction information, second horizontal right direction information, second vertical upper direction information, and second vertical lower direction information. Figure 5 , the sub-regions include the left sub-region, the right sub-region, the upper sub-region and the lower sub-region of the operation region, filtering the first direction information to obtain the second direction information can be achieved by the following method: (1) For the left half sub-region: on the center row where the target position is located, add the first horizontal direction information of the first pixel to obtain the first value; on the neighboring row adjacent to the center row, add the mean of the first horizontal direction information of the second pixel to obtain the second value; add the first value and the second value to obtain the second horizontal left direction information. The calculation formula is as follows:
[0048] (2) For the right half sub-region: on the center row, add the first horizontal direction information of the first pixel to obtain the third value; on the neighboring row adjacent to the center row, add the mean of the first horizontal direction information of the second pixel to obtain the fourth value; add the third value and the fourth value to obtain the second horizontal right direction information. The calculation formula is as follows:
[0049] (3) For the upper sub-region: in the center column where the target position is located, add the first vertical direction information of the first pixel to obtain the fifth value; in the neighboring column adjacent to the center column, add the mean of the first vertical direction information of the second pixel to obtain the sixth value; add the fifth value and the sixth value to obtain the second vertical upper direction information. The calculation formula is as follows:
[0050] (4) For the lower half of the sub-area: on the central column, add the first vertical direction information of the first pixel to obtain the seventh value; on the neighboring column adjacent to the central column, add the average of the first vertical direction information of the second pixel to obtain the eighth value; add the seventh value and the eighth value to obtain the second vertical downward direction information. The calculation formula is as follows:
[0051] In calculating the second direction information, this embodiment further subdivides the first horizontal direction information into second horizontal left direction information and second horizontal right direction information, and further subdivides the first vertical direction information into second vertical upper direction information and second vertical lower direction information, based on the first direction information, so that the direction information is more accurate, thereby refining the interpolation result of the first channel and further suppressing false information.
[0052] In one embodiment, the above step S104, inserting the first interpolation pixel at the target position according to the first direction information, can be implemented by the following method: The first horizontal direction information and the first vertical direction information are compared, and a corresponding interpolation method is selected according to the comparison result. Figure 6 is a schematic diagram of the first image in this embodiment, such as Figure 6 As shown, the results are divided into the following three cases: (1) If the first horizontal direction information is less than the first vertical direction information, the value of the first interpolated pixel is calculated along the row direction of the target position. Exemplarily, the first interpolated pixel (g pixel) is the sum of the following two parts:
[0053] (2) If the horizontal direction information of the first direction information is greater than the vertical direction information, the value of the first interpolated pixel is calculated along the column direction of the target position. Exemplarily, the first interpolated pixel (g pixel) is the sum of the following two parts:
[0054] (3) If the horizontal direction information of the first direction information is equal to the vertical direction information, the value of the first interpolated pixel is calculated along the row direction and the column direction of the target position. Exemplarily, the first interpolated pixel (g pixel) is the sum of the following two parts:
[0055] In this embodiment, the edge and texture of the image are taken into consideration during interpolation. By judging the size of the first horizontal direction information and the first vertical direction information, interpolation is performed preferentially along the smaller direction information. This can play the role of interpolation along the image texture and edge direction, and ultimately achieve a better effect of removing moiré patterns.
[0056] In one embodiment, the above step S105, updating the first interpolation pixel according to the second direction information, can be implemented by the following method: Determine pixel update information of the target position; determine pixel update information of the non-target position in the operation area according to the second direction information; update the first interpolation pixel according to the pixel update information of the target position and the pixel update information of the non-target position to obtain a first interpolation pixel update value.
[0057] Figure 7 is a schematic diagram of the first image in this embodiment, such as Figure 7 As shown, the updating process includes updating pixels at target locations and updating pixels at non-target locations.
[0058] Pixel update at target location:
[0059] Pixel updates at non-target locations:
[0060] The final updated result is the weighted sum of the above two parts:
[0061] Wherein, α represents an update weight parameter, and its value range is [0, 1]. Exemplarily, in this embodiment, the value of α is 0.3.
[0062] In one embodiment, after updating the first interpolated pixel according to the pixel update information of the target position and the pixel update information of the non-target position to obtain the first interpolated pixel update value, the method further includes: The first interpolation pixel update value of the target position is compared with the first interpolation pixel update value adjacent to the target position; if the first interpolation pixel update value of the target position is greater than the maximum value of the first interpolation pixel update value adjacent to the target position, the maximum value of the first interpolation pixel update value adjacent to the target position is inserted into the target position; if the first interpolation pixel update value of the target position is less than the minimum value of the first interpolation pixel update value adjacent to the target position, the minimum value of the first interpolation pixel update value adjacent to the target position is inserted into the target position.
[0063] After obtaining the g' pixels at all positions, this embodiment performs clipping processing based on the g pixels above, below, left, and right of each g' pixel. R0 For example, calculate the surrounding g' G4 、g' G6 、g' G7 、g' G9 The maximum and minimum values of g' R0 If it is greater than the maximum value, replace g' with the maximum value. R0 ; if g' R0 If it is less than the minimum value, replace g' with the minimum value. R0 ; if g'R0 When updating the G channel, this embodiment generates a weight value according to the second direction information, updates the center position and the non-center position, and uses the surrounding information for clipping, effectively suppressing the generation of false colors, moiré patterns, and bad pixels, and improving image clarity.
[0064] In one embodiment, the above step S106, interpolating the second channel based on the first channel pixels obtained after updating the first interpolated pixels to obtain the second image, can be implemented by the following method: A second channel pixel adjacent to the position to be interpolated and having the same channel attribute as the second interpolation pixel to be inserted is determined; a second interpolation pixel is calculated based on the determined second channel pixel, the original pixel at the position to be interpolated, and the first interpolation pixel adjacent to the position to be interpolated and updated, and the second interpolation pixel is inserted into the position to be interpolated.
[0065] In this embodiment, a color difference interpolation method can be used. When interpolating the r pixel and the b pixel at the G channel position, the pixels at the surrounding R / B channel positions are used to calculate. refer to Figure 6 When interpolating the r pixel of the G channel, the neighboring R pixel and the g' pixel at the corresponding position are used for processing. The specific interpolation calculation formulas are given below.
[0066] Interpolation r G6 Pixels:
[0067] Interpolation r G9 Pixels:
[0068] When interpolating the b pixel of the G channel, the neighboring B pixel and the g' pixel at the corresponding position are used for processing. The specific interpolation calculation formulas are given below.
[0069] Interpolation b G6 Pixels:
[0070] Interpolation b G9 Pixels:
[0071] When interpolating the b pixel of the R channel, use the neighboring B pixels and the g' pixels at the corresponding position. R0 Pixels:
[0072] When interpolating the r pixel of the B channel, use the neighboring R pixels and the g' pixels at the corresponding position. B1 Pixels:
[0073] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0074] In one embodiment, Figure 8 A flowchart of another image processing method for suppressing false information is provided, such as Figure 8 As shown, the process includes the following steps: Step S201, calculating first direction information corresponding to each pixel position in the Bayer image; Step S202, calculating and obtaining second direction information according to the first direction information; Step S203, performing a first interpolation on the G channel according to the first direction information to obtain full-resolution g channel information; Step S204, updating the full-resolution g channel information after the first interpolation according to the second direction information to obtain new g' channel information; Step S205: interpolate the full-resolution r channel and b channel information respectively according to the g' channel information to obtain the final ro, go, and bo channel information.
[0075] This embodiment suppresses the generation of problem pixels such as false color and moiré during the de-mosaicing process. By introducing the first direction information and the second direction information into the G channel interpolation process, the interpolation G channel is further refined according to the different direction information of the neighborhood area of the interpolation point to be interpolated. Without increasing the calculation area, the false color, moiré, bad pixel and other problems caused by de-mosaicing are effectively suppressed, and the clarity of the image is improved. Specifically, when calculating the first direction information, the direction information of the G channel and the non-G channel is combined to make the initial vertical and horizontal direction information more accurate. When calculating the second direction information, the first horizontal direction information is subdivided into left horizontal and right horizontal, and the first vertical direction information is subdivided into upper vertical and lower vertical, so that the direction information is more accurate. When initially interpolating the G channel, according to the different sizes of the first vertical and horizontal direction information, the pixel values of different direction positions are used for interpolation. When updating the G channel, the weight value generated according to the refined second direction information is divided into the center position and the non-center position for updating, and the surrounding information is used for limiting, which effectively suppresses the generation of false color, moiré, and bad pixel, and improves the clarity of the image.
[0076] In one embodiment, an image processing device for suppressing false information is provided, and the device is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made are not repeated. The terms "module", "unit", "subunit", etc. used below can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0077] Fig. 9 is a structural block diagram of the image processing device for suppressing false information in this embodiment. Fig. 9 As shown, the device comprises: An acquisition module is used to acquire a first image to be processed, determine a target position in the first image where first channel interpolation is to be performed, and determine an operation area with the target position as the center; wherein the number of pixels in the first channel in the first image is not less than the number of pixels in the second channel; A first direction information calculation module, used to calculate the first direction information of the original second channel pixel in the target position based on the operation area; A second direction information calculation module, used for filtering the first direction information to obtain second direction information; A first interpolation module, used for inserting a first interpolation pixel at a target position according to first direction information; An updating module, used for updating the first interpolation pixel according to the second direction information; The second interpolation module is used to interpolate the second channel based on the first channel pixels obtained after updating the first interpolation pixels to obtain a second image.
[0078] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated in this embodiment. The above modules can be functional modules or program modules, which can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0079] In addition, in combination with the image processing method for suppressing false information provided in the above embodiments, a storage medium may be provided in this embodiment to implement the method. The storage medium stores a computer program; when the computer program is executed by a processor, any image processing method for suppressing false information in the above embodiments is implemented.
[0080] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0081] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0082] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0083] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. An image processing method for suppressing false information, characterized in that: include: Acquire a first image to be processed, determine a target position in the first image where first channel interpolation is to be performed, and determine an operation area with the target position as the center; wherein the number of pixels in the first channel in the first image is not less than the number of pixels in the second channel; Calculate first direction information of original second channel pixels in the target position based on the operation area; filtering the first direction information to obtain second direction information; inserting a first interpolation pixel at the target position according to the first direction information; updating the first interpolation pixel according to the second direction information; Based on the first channel pixels obtained after updating the first interpolation pixels, the second channel is interpolated to obtain a second image.
2. The image processing method for suppressing false information according to claim 1, characterized in that: Calculating first direction information of original second channel pixels in the target position based on the operation area includes: In the horizontal direction of the rows of the operation area, a first mean value of the absolute values of the differences between adjacent pixels of the first channel is calculated, and in the horizontal direction of the rows of the operation area, a second mean value of the absolute values of the differences between adjacent pixels of the second channel is calculated; Adding the first mean value and the second mean value to obtain first horizontal direction information; Calculating a third mean of absolute values of differences between adjacent pixels of the first channel in a vertical direction of a column of the operation area, and calculating a fourth mean of absolute values of differences between adjacent pixels of the second channel in a vertical direction of a column of the operation area; Adding the third mean value and the fourth mean value to obtain first vertical direction information; The first direction information is obtained according to the first horizontal direction information and the first vertical direction information.
3. The image processing method for suppressing false information according to claim 2, characterized in that: Inserting a first interpolation pixel at the target position according to the first direction information includes: comparing the first horizontal direction information with the first vertical direction information; If the first horizontal direction information is less than the first vertical direction information, calculating the value of the first interpolated pixel along the row direction of the target position; If the horizontal direction information of the first direction information is greater than the vertical direction information, calculating the value of the first interpolation pixel along the column direction of the target position; If the horizontal direction information of the first direction information is equal to the vertical direction information, the value of the first interpolation pixel is calculated along the row direction and the column direction of the target position.
4. The image processing method for suppressing false information according to claim 2, characterized in that: Filtering the first direction information to obtain second direction information includes: Dividing the operating area into a plurality of sub-areas; In each sub-region, a first pixel having the same channel attribute as an original pixel at the target position and a second pixel having a different channel attribute from the original pixel are identified; wherein the second pixel does not include the first channel pixel; In a specific direction corresponding to the sub-region, calculating a sum of the direction information of the first pixels, and calculating a mean of the direction information of the second pixels; The sum of the direction information of the first pixels and the mean of the direction information of the second pixels are added to obtain the second direction information of each sub-region.
5. The image processing method for suppressing false information according to any one of claims 1 to 4, characterized in that: The second direction information includes: second horizontal left direction information, second horizontal right direction information, second vertical upper direction information, and second vertical lower direction information.
6. The image processing method for suppressing false information according to claim 5, characterized in that: The sub-regions of the operation region include a left half sub-region, a right half sub-region, an upper half sub-region, and a lower half sub-region, and filtering the first direction information to obtain second direction information includes: For the left half sub-region: on the central row where the target position is located, the first horizontal direction information of the first pixel is added to obtain a first value; on the neighboring row adjacent to the central row, the mean value of the first horizontal direction information of the second pixel is added to obtain a second value; the first value and the second value are added to obtain the second horizontal left direction information; For the right half sub-region: on the central row, add the first horizontal direction information of the first pixels to obtain a third value; on a neighboring row adjacent to the central row, add the mean values of the first horizontal direction information of the second pixels to obtain a fourth value; add the third value and the fourth value to obtain the second horizontal right direction information; For the upper sub-region: on the central column where the target position is located, the first vertical direction information of the first pixels is added to obtain a fifth value; on the neighboring column adjacent to the central column, the mean values of the first vertical direction information of the second pixels are added to obtain a sixth value; and the fifth value and the sixth value are added to obtain the second vertical upper direction information; For the lower half sub-area: on the central column, add the first vertical direction information of the first pixels to obtain a seventh value; on the neighboring column adjacent to the central column, add the mean values of the first vertical direction information of the second pixels to obtain an eighth value; add the seventh value and the eighth value to obtain the second vertical downward direction information.
7. The image processing method for suppressing false information according to claim 1, characterized in that: Updating the first interpolation pixel according to the second direction information includes: Determining pixel update information of the target position; Determine pixel update information of a non-target position in the operation area according to the second direction information; The first interpolation pixel is updated according to the pixel update information of the target position and the pixel update information of the non-target position to obtain a first interpolation pixel update value.
8. The image processing method for suppressing false information according to claim 7, characterized in that: After updating the first interpolated pixel according to the pixel update information of the target position and the pixel update information of the non-target position to obtain a first interpolated pixel update value, the method further includes: comparing the first interpolated pixel update value of the target position with the first interpolated pixel update value adjacent to the target position; If the first interpolation pixel update value of the target position is greater than the maximum value of the first interpolation pixel update values adjacent to the target position, inserting the maximum value of the first interpolation pixel update values adjacent to the target position into the target position; If the first interpolation pixel update value of the target position is smaller than a minimum value of the first interpolation pixel update values adjacent to the target position, the minimum value of the first interpolation pixel update values adjacent to the target position is inserted into the target position.
9. The image processing method for suppressing false information according to claim 1, characterized in that: Interpolating the second channel based on the first channel pixels obtained after updating the first interpolation pixels to obtain a second image includes: Determine a second channel pixel that is adjacent to the position to be interpolated and has the same channel attribute as the second interpolation pixel to be inserted; The second interpolation pixel is calculated based on the determined second channel pixel, the original pixel at the position to be interpolated, and the first interpolation pixel adjacent to the position to be interpolated and updated, and the second interpolation pixel is inserted into the position to be interpolated.
10. An image processing device for suppressing false information, characterized in that: The device comprises: an acquisition module, used for acquiring a first image to be processed, determining a target position in the first image for first channel interpolation, and determining an operation area with the target position as the center; wherein the number of pixels in the first channel in the first image is not less than the number of pixels in the second channel; A first direction information calculation module, used for calculating the first direction information of the original second channel pixel in the target position based on the operation area; A second direction information calculation module, used to filter the first direction information to obtain second direction information; A first interpolation module, configured to insert a first interpolation pixel at the target position according to the first direction information; An updating module, configured to update the first interpolation pixel according to the second direction information; The second interpolation module is used to interpolate the second channel based on the first channel pixels obtained after updating the first interpolation pixels to obtain a second image.
11. A computer-readable 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 9 are implemented.
Citation Information
Patent Citations
Image processing method, image processing device, electronic equipment and readable storage medium
CN112738493A
Image processing method and device, electronic device and storage medium
CN116051406A
Mosaic removing method and device for eliminating moire patterns, electronic equipment and medium
CN117495721A
Image processing method and device, computer equipment and storage medium
CN117876284A
Demosaicing method and demosaicing equipment
CN118200752A
