A method for image bad pixel correction based on FPGA

Through the FPGA-based image bad point correction method, the area marking and storage of bad point positions are divided by exposure gain value, and the bad point positions are judged and repaired in real time, solving the problem of uncertainty in dynamic bad point correction in the prior art and improving image quality.

CN119485052BActive Publication Date: 2025-04-18YUANTU ARTIFICIAL INTELLIGENCE (HANGZHOU) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510042454.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-10
Publication Date
2025-04-18
Estimated Expiration
2045-01-10

AI Technical Summary

Technical Problem

The prior art has uncertainty in the correction of dynamic bad points in image sensors, and static bad points correction depends on a pre-constructed bad point table and cannot be detected and corrected in real time.

Method used

The image bad point correction method based on FPGA is adopted to divide the exposure gain area by reading the exposure gain value of the current frame register, mark and store the bad point positions, and judge and repair the bad point in real-time frame.

Benefits of technology

Effective detection and correction of dynamic bad points is realized, image quality is improved, and uncertainty of static bad points correction in the prior art is overcome.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119485052B_ABST
    Figure CN119485052B_ABST
Patent Text Reader

Abstract

The invention discloses an image bad pixel correction method based on FPGA, comprising the following steps: S1: aligning a black body so that the black body fills the screen, obtaining a Bayer format image, and obtaining the coordinate position of the image pixel point; S2: a bad pixel marking part: reading the value of a current frame register as an exposure gain value; S3: marking the bad pixel position by the exposure gain value, storing it in a mobile storage medium, and entering a bad pixel correction part after marking the bad pixel; S4: a bad pixel correction part: reading the bad pixel position from the mobile storage medium into a cache according to the exposure gain value of the current frame register; S5: judging whether the pixel point position of the current frame is the bad pixel position; if so, repairing the bad pixel; otherwise, skipping; S6: outputting the Bayer format image after all the bad pixels are repaired.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to an image bad pixel correction method based on FPGA. Background Art

[0002] If there are defects in the array process formed by each light collection point on the sensor in the image sensor, or errors occur in the process of converting the light signal, the information of some pixels in the image will be incorrect, resulting in inaccurate pixel values ​​in the image. These defective pixels are called bad pixels in the image.

[0003] The correction of static bad pixels is based on the existing static bad pixel table. The coordinates of the current point are compared to see if they are consistent with a certain coordinate in the static bad pixel table. If they are consistent, it is determined to be a bad pixel, and then the correction result is calculated to correct it. The correction of dynamic bad pixels can detect and correct the bright and dark spots of the sensor in real time, and the number of bad pixels that can be corrected is not limited. Dynamic bad pixel correction has greater uncertainty than static bad pixel correction. Summary of the invention

[0004] The purpose of the present invention is to provide an image bad pixel correction method based on FPGA to overcome the deficiencies in the prior art.

[0005] To achieve the above object, the present invention provides the following technical solutions:

[0006] The present application discloses an image bad pixel correction method based on FPGA, comprising the following steps:

[0007] S1: Aim the black body so that it fills the screen, obtain the Bayer format image, and obtain the coordinate position of the image pixel point;

[0008] S2: Bad pixel marking part: read the value of the current frame register as the exposure gain value;

[0009] S3: Mark the bad pixel position by the exposure gain value and store it in a mobile storage medium, and enter the bad pixel correction part after marking the bad pixel;

[0010] S4: bad pixel correction part: read the bad pixel position from the mobile storage medium into the cache according to the exposure gain value of the current frame register;

[0011] S5: Determine whether the pixel position of the current frame is the bad pixel position; if so, repair the bad pixel; otherwise, skip;

[0012] S6: After all bad pixels are repaired, a Bayer format image is output.

[0013] The S3 comprises the following sub-steps:

[0014] S31: dividing a plurality of exposure gain areas according to the exposure gain value;

[0015] S32: opening up a number of address spaces in a mobile storage medium according to the exposure gain region;

[0016] S33: Mark the bad pixel position of the current frame according to the exposure gain value of the current frame register and store it in the corresponding address space.

[0017] The bad pixel position marking in S3 includes the following sub-steps:

[0018] A31: Divide the 3*3 neighborhood according to the color component corresponding to the pixel;

[0019] A32: Get the 8 pixel values ​​in the neighborhood and add them up to get the average;

[0020] A33: If the pixel value of the pixel is greater than the mean value, it is determined to be a bad pixel; otherwise, it is determined to be normal.

[0021] The S4 also includes the following contents: based on the exposure gain value of the current frame register, reading the bad pixel position from the corresponding address space and storing it in the cache.

[0022] The S4 also includes the following content: when it is identified that the exposure gain value of the current frame register is not in the same exposure gain region as the exposure gain value of the previous frame register, the following sub-steps are executed:

[0023] S41: Clear the cache;

[0024] S42: Obtaining the exposure gain region where the current frame register is located according to the exposure gain value of the current frame register;

[0025] S43: Loading the bad pixel position of the address space corresponding to the exposure gain area; wherein the bad pixel position is the bad pixel position marked in S3.

[0026] In S5, whether the pixel position of the current frame is the bad pixel position is determined, including the following contents: comparing the bad pixel position obtained in S4 with the pixel position of the current frame; if they are equal, determining that the pixel of the current frame is a bad pixel, refreshing the cache data, and reading the next bad pixel position into the cache; otherwise, skipping.

[0027] In S5, repairing the bad pixel includes the following sub-steps:

[0028] S51: Divide the neighborhood according to the color component corresponding to the pixel;

[0029] S52: Obtain several pixel values ​​in the neighborhood, and take the median and mean;

[0030] S53: pre-set a threshold range, and when the mean value is within the threshold range, replace the pixel value of the bad pixel with the mean value; otherwise, replace the pixel value of the bad pixel with the median value.

[0031] The present application also discloses an FPGA-based image bad pixel correction device, including an on-chip system bus controller, a bad pixel correction circuit, an on-chip system bus, an HDMI interface, a MIPI interface, a memory and a non-volatile memory, wherein the memory stores executable code, and when the one or more processors execute the executable code, they are used to implement the above-mentioned FPGA-based image bad pixel correction method.

[0032] Beneficial effects of the present invention:

[0033] (1) By marking the bad pixels in different exposure gain ranges with different bad pixel positions, the dynamic bad pixels caused by the exposure gain are effectively detected and corrected, and the image quality of the overall image is improved.

[0034] The features and advantages of the present invention will be described in detail through embodiments in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 It is a flowchart of the steps of an image bad pixel correction method based on FPGA of the present invention;

[0036] Figure 2 It is a schematic diagram of the device of the present invention. DETAILED DESCRIPTION

[0037] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention is further described in detail below through the accompanying drawings and embodiments. However, it should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the scope of the present invention. In addition, in the following description, the description of known structures and technologies is omitted to avoid unnecessary confusion of the concept of the present invention.

[0038] See also Figure 1 The embodiment of the present invention provides an image bad pixel correction method based on FPGA, comprising the following steps:

[0039] S1: Aim the black body so that it fills the screen, obtain the Bayer format image, and obtain the coordinate position of the image pixel point;

[0040] S2: Bad pixel marking part: read the value of the current frame register as the exposure gain value;

[0041] S3: Mark the bad pixel position by the exposure gain value and store it in a mobile storage medium, and enter the bad pixel correction part after marking the bad pixel;

[0042] S4: bad pixel correction part: read the bad pixel position from the mobile storage medium into the cache according to the exposure gain value of the current frame register;

[0043] S5: Determine whether the pixel position of the current frame is the bad pixel position; if so, repair the bad pixel; otherwise, skip;

[0044] S6: After all bad pixels are repaired, a Bayer format image is output.

[0045] The S3 comprises the following sub-steps:

[0046] S31: dividing a plurality of exposure gain areas according to the exposure gain value;

[0047] S32: opening up a number of address spaces in a mobile storage medium according to the exposure gain region;

[0048] S33: Mark the bad pixel position of the current frame according to the exposure gain value of the current frame register and store it in the corresponding address space.

[0049] The bad pixel position marking in S3 includes the following sub-steps:

[0050] A31: Divide the 3*3 neighborhood according to the color component corresponding to the pixel;

[0051] A32: Get the 8 pixel values ​​in the neighborhood and add them up to get the average;

[0052] A33: If the pixel value of the pixel is greater than the mean value, it is determined to be a bad pixel; otherwise, it is determined to be normal.

[0053] The S4 also includes the following contents: based on the exposure gain value of the current frame register, reading the bad pixel position from the corresponding address space and storing it in the cache.

[0054] The S4 also includes the following content: when it is identified that the exposure gain value of the current frame register is not in the same exposure gain region as the exposure gain value of the previous frame register, the following sub-steps are executed:

[0055] S41: Clear the cache;

[0056] S42: Obtaining the exposure gain region where the current frame register is located according to the exposure gain value of the current frame register;

[0057] S43: Loading the bad pixel position of the address space corresponding to the exposure gain area; wherein the bad pixel position is the bad pixel position marked in S3.

[0058] In S5, whether the pixel position of the current frame is the bad pixel position is determined, including the following contents: comparing the bad pixel position obtained in S4 with the pixel position of the current frame; if they are equal, determining that the pixel of the current frame is a bad pixel, refreshing the cache data, and reading the next bad pixel position into the cache; otherwise, skipping.

[0059] In S5, repairing the bad pixel includes the following sub-steps:

[0060] S51: Divide the neighborhood according to the color component corresponding to the pixel;

[0061] S52: Obtain several pixel values ​​in the neighborhood, and take the median and mean;

[0062] S53: pre-set a threshold range, and when the mean value is within the threshold range, replace the pixel value of the bad pixel with the mean value; otherwise, replace the pixel value of the bad pixel with the median value.

[0063] Example:

[0064] Step S1: Get the Bayer image and align it with the black body.

[0065] Step S2: Turn on the bad pixel marking function.

[0066] Step S3: marking the bad pixel position according to the exposure gain value of the current frame register and storing it in the corresponding address space of the mobile storage medium.

[0067] Specifically, all the exposure gain values ​​are divided into 8 exposure gain areas, and the exposure gain areas open up 8 address spaces in the mobile storage medium. The exposure gain of the current frame register marks the position of the bad pixel in the current frame and stores it in the corresponding address space. The eight pixel values ​​in the neighborhood of the color component corresponding to the pixel are added and the average is taken. If the pixel is greater than the average, it is considered to be a bad pixel. At the end of this frame, all bad pixels will be written to the corresponding address space.

[0068] Among them, a maximum of 2048 bad pixels can be stored, and the data packet stored in the removable storage medium is a 2-byte data packet size plus the number of bytes.

[0069] Step S4: Turn on the bad pixel correction function.

[0070] Step S5: Read the corresponding bad pixel position from the mobile storage medium to the cache according to the exposure gain value of the current frame register.

[0071] Specifically, the exposure gain area where the exposure gain value of the current frame register is located reads the bad pixel position from the corresponding address space. When the exposure gain value of the current frame register is not in the same exposure gain area as the exposure gain value of the previous frame register, the cache is cleared and the bad pixel position of the address space corresponding to the exposure gain area of ​​the current frame is loaded.

[0072] The data packet read from the removable storage medium is a 2-byte data packet size plus a byte count. If the byte size = the read-out byte count, data reading will stop.

[0073] Step S6: Determine whether the pixel position in the current frame is a bad pixel position.

[0074] Specifically, the pixel position stored in the cache is compared with the bad pixel position, and if they are equal, the pixel is considered to be a bad pixel, and the cache data is refreshed to the next bad pixel position.

[0075] Step S7: Repair bad pixels

[0076] Specifically, the eight pixel values ​​in the neighborhood of the color component corresponding to the pixel are medianized and added to obtain the mean. If the mean is within the threshold range x0-x1, the bad pixel is replaced by the mean; otherwise, the bad pixel is replaced by the median.

[0077] Among them, x0 is 18 and x1 is 180.

[0078] Step S8: Output the bayer image.

[0079] In a feasible embodiment: the technical feature that distinguishes this embodiment from the first embodiment is that in S7, the neighborhood is not divided according to the pixel points, the median and mean of the pixel values ​​are directly taken, and the bad pixels are compared and replaced.

[0080] An embodiment of an image bad pixel correction device based on FPGA of the present invention can be applied to any device with data processing capability, and the device with data processing capability can be a device or apparatus such as a computer. The device embodiment can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, the processor of any device with data processing capability reads the corresponding computer program instructions in the non-volatile memory into the internal memory and runs them. From the hardware level, if Figure 2 As shown in the figure, it is a hardware structure diagram of any device with data processing capability where an image bad pixel correction device based on FPGA of the present invention is located. Figure 2In addition to the system-on-chip bus controller, bad pixel correction circuit, system-on-chip bus, HDMI interface, MIPI interface, memory and non-volatile memory shown, any device with data processing capability in the embodiment is usually based on the actual function of the device with data processing capability, and other hardware may also be included, which will not be described in detail. The implementation process of the functions and effects of each unit in the above device is specifically detailed in the implementation process of the corresponding steps in the above method, which will not be described in detail here.

[0081] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of the present invention. Ordinary technicians in this field can understand and implement it without paying creative work.

[0082] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modification, equivalent substitution or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. An image bad pixel correction method based on FPGA, characterized in that: The steps include: S1: Aim the black body so that it fills the screen, obtain the Bayer format image, and obtain the coordinate position of the image pixel point; S2: Bad pixel marking part: read the value of the current frame register as the exposure gain value; S3: Mark the bad pixel position by the exposure gain value and store it in a mobile storage medium, and enter the bad pixel correction part after marking the bad pixel; S4: bad pixel correction part: read the bad pixel position from the mobile storage medium into the cache according to the exposure gain value of the current frame register; S5: Determine whether the pixel position of the current frame is the bad pixel position; if so, repair the bad pixel; otherwise, skip; S6: After repairing all bad pixels, output the Bayer format image; The S3 comprises the following sub-steps: S31: dividing a plurality of exposure gain areas according to the exposure gain value; S32: opening up a number of address spaces in a mobile storage medium according to the exposure gain region; S33: marking the bad pixel position of the current frame according to the exposure gain value of the current frame register and storing it in the corresponding address space; the bad pixel position marking in S3 includes the following sub-steps: A31: Divide the 3*3 neighborhood according to the color component corresponding to the pixel; A32: Get the 8 pixel values ​​in the neighborhood and add them up to get the average; A33: If the pixel value of the pixel is greater than the mean value, it is determined to be a bad pixel; otherwise, it is determined to be normal.

2. The method for correcting bad pixels of an image based on FPGA as claimed in claim 1, characterized in that: The S4 also includes the following contents: based on the exposure gain value of the current frame register, reading the bad pixel position from the corresponding address space and storing it in the cache.

3. The method for correcting bad pixels of an image based on FPGA as claimed in claim 1, characterized in that: The S4 also includes the following content: when it is identified that the exposure gain value of the current frame register is not in the same exposure gain region as the exposure gain value of the previous frame register, the following sub-steps are executed: S41: Clear the cache; S42: Obtaining the exposure gain region where the current frame register is located according to the exposure gain value of the current frame register; S43: Loading the bad pixel position of the address space corresponding to the exposure gain area; wherein the bad pixel position is the bad pixel position marked in S3.

4. The method for correcting bad pixels of an image based on FPGA as claimed in claim 1, characterized in that: In S5, whether the pixel position of the current frame is the bad pixel position is determined, including the following contents: comparing the bad pixel position obtained in S4 with the pixel position of the current frame; if they are equal, determining that the pixel of the current frame is a bad pixel, refreshing the cache data, and reading the next bad pixel position into the cache; otherwise, skipping.

5. The method for correcting bad pixels of an image based on FPGA as claimed in claim 1, characterized in that: In S5, repairing the bad pixel includes the following sub-steps: S51: Divide the neighborhood according to the color component corresponding to the pixel; S52: Obtain several pixel values ​​in the neighborhood, and take the median and mean; S53: pre-set a threshold range, and when the mean value is within the threshold range, replace the pixel value of the bad pixel with the mean value; otherwise, replace the pixel value of the bad pixel with the median value.

6. An image bad pixel correction device based on FPGA, characterized in that: The invention comprises an on-chip system bus controller, a bad pixel correction circuit, an on-chip system bus, an HDMI interface, a MIPI interface, a memory and a non-volatile memory, wherein the memory stores executable code, and when one or more processors execute the executable code, the FPGA-based image bad pixel correction method is implemented as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Image dead pixel cluster correction method, computer device and computer readable storage medium

    CN112911174A

  • Dead pixel correction optimization method for auxiliary driving camera

    CN114727102A