Method and system for searching and correcting dead pixels, electronic equipment and storage medium
By creating a row index table and an ordered queue of column coordinates, combined with a filtering window for local correction, the complexity of finding and correcting bad pixels in high-resolution and high-frame-rate images is solved, achieving efficient and real-time bad pixel processing while saving hardware resources.
Patent Information
- Application Number
- CN202511349073.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-22
- Publication Date
- 2025-10-28
AI Technical Summary
Existing technologies face a sharp increase in the complexity of finding and correcting bad pixels when processing high-resolution and high-frame-rate images, leading to a decrease in speed and efficiency, failing to meet real-time requirements, and consuming significant hardware resources.
By creating a row index table and an ordered queue of column coordinates, and using a preset filtering window for local correction, combined with the design of row caching and ordered queue of column coordinates, bad pixels can be quickly found and corrected, reducing the time overhead of loading the entire frame data and comparing the global list.
It significantly reduces search complexity, meets the real-time requirement of processing each pixel of a high-resolution image within a single clock cycle, improves processing speed and efficiency, and saves hardware resources.
Smart Images

Figure CN120849640A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of bad pixel processing technology, and more particularly to a method, system, electronic device, and storage medium for finding and correcting bad pixels. Background Technology
[0002] In the field of image acquisition and processing, dead pixels are abnormal pixels caused by hardware defects in image sensors (such as CMOS and CCD) during manufacturing or use. They typically appear as bright spots, dark spots, or constant gray values in fixed locations, directly affecting image quality and the accuracy of subsequent analysis. To eliminate the impact of dead pixels, dead pixel correction technology has emerged. Its core is to identify dead pixels in an image through algorithms and repair them using information from surrounding normal pixels. Existing dead pixel finding and correction technologies are mainly divided into two categories: software implementation and hardware implementation. Software implementations rely on PCs or embedded processors (such as ARM and DSP), loading the entire frame of image into memory and traversing the image using a preset list of dead pixel coordinates to complete the correction. Hardware solutions include two types: one is a parallel comparator array, which uses N comparators to simultaneously compare the current pixel coordinates with N dead pixel coordinates; the other is a sequential traversal of the list, which compares the pixel coordinates with each entry in the dead pixel list.
[0003] However, regardless of the software or hardware implementation solutions mentioned above, their core technology is related to the image resolution, frame rate, and number of bad pixels. That is, when the image is high resolution and high frame rate, or when the number of bad pixels is large, the loading and traversal time of the entire frame image increases significantly, the complexity of finding and correcting bad pixels increases sharply, latency problems occur frequently, and thus the speed and efficiency decrease significantly. Summary of the Invention
[0004] This application discloses a method, system, electronic device, and storage medium for finding and correcting bad pixels, which can efficiently handle bad pixels.
[0005] The first aspect of this application discloses a method for finding and correcting bad pixels, including: Obtain a list of target defective pixel coordinate information, and create a row index table and a column coordinate ordered queue based on the target defective pixel coordinate information list. The target defective pixel coordinate information list includes the total number of defective pixels of the target image sensor, as well as the column coordinate information and row coordinate information of the defective pixels. The row index table includes the row coordinate information of the defective pixels and the number of defective pixels with the same row coordinate information. The column coordinate ordered queue includes the column coordinate information of defective pixels with the same row coordinate information. When requesting to acquire a target image and correct bad pixels in the target image, the target image is buffered row by row according to the size of a preset filtering window to obtain the row pixel data of the target image, wherein the target image is the image output by the target image sensor; The number of bad pixels in each row of pixels in the target image is obtained by searching the row index table based on the row coordinate information of the row pixel data. When the number of bad pixels in the current row of the indexed pixel in the target image is not 0, the column coordinate information of the bad pixels in the row of the target image that is the same as the corresponding row coordinate information is read from the column coordinate ordered queue according to the number of bad pixels in the current row of the indexed pixel and the corresponding row coordinate information, and the bad pixel coordinates of the target image are generated by combining the corresponding row coordinate information. Correction is performed based on the coordinates of bad pixels in the target image and the preset filtering window.
[0006] Optionally, both column coordinate information and row coordinate information are within the resolution pixel range of the image generated by the target image sensor. The step of creating a row index table and an ordered queue of column coordinates based on the target bad pixel coordinate information list includes: Based on the row coordinate information and the number of bad pixels with the same row coordinate information, a row index table is created one-to-one, and the row index table is stored in the on-chip random access memory of the field programmable gate array. The column coordinate information of bad points with the same row coordinate information is written into the column coordinate ordered queue in ascending order, and the column coordinate ordered queue is stored in the first-in-first-out memory.
[0007] Optionally, the resolution of the image output by the target image sensor is W×H, and the capacity of the on-chip random access memory of the field-programmable gate array is [missing information]. bit.
[0008] Optionally, the resolution of the image output by the target image sensor is W×H, the total number of bad pixels in the target image sensor is N, and the capacity of the first-in-first-out memory is [missing information]. bit.
[0009] Optionally, the correction based on the coordinates of the bad pixels in the target image and the preset filtering window includes: Based on the coordinates of the bad pixels in the target image and the size of the preset filtering window, obtain the coordinates of several neighboring pixels corresponding to the coordinates of the bad pixels in the target image. Obtain the pixel values of the bad pixel coordinates and the pixel values of the coordinates of the several neighboring pixels in the target image; Based on the pixel values of the bad pixel coordinates in the target image and the pixel values of the coordinates of several neighboring pixels, neighborhood filtering correction is performed to obtain a correction value. Replace the pixel values of the bad pixel coordinates in the target image with the correction values.
[0010] Optionally, after obtaining the list of target defect coordinates, the method further includes: The list of target bad point coordinates is stored in non-volatile memory.
[0011] Optionally, after creating a row index table and an ordered queue of column coordinates based on the target bad spot coordinate information list, the method further includes: Obtain the updated content of the target defect coordinate information list; Based on the updated content, the row index table and the column coordinate ordered queue are updated accordingly.
[0012] The second aspect of this application discloses a system for finding and correcting bad pixels, comprising: A creation unit is used to obtain a list of target bad pixel coordinate information and create a row index table and a column coordinate ordered queue based on the list of target bad pixel coordinate information. The list of target bad pixel coordinate information includes the total number of bad pixels of the target image sensor and the column coordinate information and row coordinate information of the bad pixels. The row index table includes the row coordinate information of the bad pixels and the number of bad pixels with the same row coordinate information. The column coordinate ordered queue includes the column coordinate information of bad pixels with the same row coordinate information. A row buffer unit is used to buffer the target image in rows according to the size of a preset filtering window when a request is made to acquire a target image and correct bad pixels in the target image, thereby obtaining row pixel data of the target image, wherein the target image is the image output by the target image sensor; The lookup unit is used to search the row index table based on the row coordinate information of the row pixel data to obtain the number of bad pixels in each row of pixels in the target image; The generation unit is configured to, when the number of bad pixels in the current row of the indexed pixel in the target image is not 0, read the column coordinate information of bad pixels in the row of the target image that is the same as the corresponding row coordinate information from the column coordinate ordered queue according to the number of bad pixels in the current row of the indexed pixel and the corresponding row coordinate information, and combine the corresponding row coordinate information to generate the bad pixel coordinates of the target image. The correction unit is used to perform correction based on the coordinates of bad pixels in the target image and the preset filtering window.
[0013] A third aspect of this application provides an electronic device, comprising: Processor, memory, input / output units, and bus; The processor is connected to memory, input / output units, and a bus; The memory stores a program, which the processor calls to execute methods such as the first aspect and any optional method of the first aspect for finding and correcting bad pixels.
[0014] The fourth aspect of this application provides a computer-readable storage medium on which a program is stored, which, when executed on a computer, performs a method for finding and correcting bad pixels as described in the first aspect and any optional method of the first aspect.
[0015] As can be seen from the above technical solutions, the embodiments of this application have the following advantages: This application provides a method for finding and correcting bad pixels, including: obtaining a list of target bad pixel coordinate information, and creating a row index table and a column coordinate ordered queue based on the target bad pixel coordinate information list. The target bad pixel coordinate information list includes the total number of bad pixels in the target image sensor, as well as the column coordinate information and row coordinate information of the bad pixels. The row index table includes the row coordinate information of the bad pixels and the number of bad pixels with the same row coordinate information. The column coordinate ordered queue includes the column coordinate information of bad pixels with the same row coordinate information. When requesting to obtain a target image and correct bad pixels in the target image, the target image is buffered row by row according to the size of a preset filtering window to obtain the target image. The image consists of row pixel data and the target image is the image output by the target image sensor. Based on the row coordinate information of the row pixel data, a lookup is performed in the row index table to obtain the number of bad pixels in each row of the target image. When the number of bad pixels in the current indexed row of the target image is not zero, the column coordinate information of the bad pixels in the target image that match the corresponding row coordinate information is read from the column coordinate ordered queue based on the number of bad pixels in the current indexed row and the corresponding row coordinate information. This column coordinate information is then combined with the corresponding row coordinate information to generate the bad pixel coordinates of the target image. Correction is then performed based on the bad pixel coordinates of the target image and a preset filtering window. The method for finding and correcting bad pixels in this application creates a row index table and an ordered column coordinate queue based on a target bad pixel coordinate information list. The target bad pixel coordinate information list records the location information of bad pixels at fixed positions on the image sensor. The row index table can be used to quickly determine whether there are bad pixels in each row of the target image and the number of bad pixels, avoiding invalid searches in rows without bad pixels and significantly reducing the search range. The ordered column coordinate queue stores the column coordinates of bad pixels in the same row in a centralized manner, so that after determining that there are bad pixels in the current row, it is only necessary to read the column coordinate information of that row, without traversing the entire bad pixel list. This reduces the time overhead caused by loading the entire frame data or comparing the global list, and significantly reduces the search complexity. While meeting the real-time requirement that each pixel of a high-resolution image is processed within a single clock cycle or a few cycles, it also fixes the delay of the bad pixel judgment pipeline within a limited number of clock cycles, which is basically independent of the total number of bad pixels. After locating the coordinates of the bad pixels, a preset filtering window is used for local correction, effectively improving the processing speed and reducing latency. Especially when there are a large number of bad pixels, it can more efficiently meet the speed and efficiency requirements of real-time image processing, and saves more hardware resources compared to hardware parallel comparator array solutions. In addition, the implementation of this application is compatible with the line scanning input mode of images, eliminating the need to buffer the entire image frame or perform complex cross-line / cross-block processing, thus improving the efficiency of the hardware pipeline. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a schematic diagram of an embodiment of the method for finding and correcting bad pixels in this application; Figure 2 This is a schematic diagram of another embodiment of the method for finding and correcting dead pixels in this application; Figure 3 This is a schematic diagram of another embodiment of the method for finding and correcting dead pixels in this application; Figure 4 This is a schematic diagram of another embodiment of the method for finding and correcting dead pixels in this application; Figure 5 This is a schematic diagram of an embodiment of the system for finding and correcting dead pixels according to this application; Figure 6 This is a schematic diagram of one embodiment of the electronic device of this application. Detailed Implementation
[0018] In the following description, specific details such as specific system structures and techniques are provided for purposes of illustration rather than limitation to facilitate a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obscuring the description of the present application with unnecessary detail.
[0019] It should be understood that, when used in this application specification, the term "comprising" indicates the presence of the described feature, integral, step, operation, element, and / or component, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or collections thereof.
[0020] It should also be understood that the term “and / or” as used in this application specification means any combination of one or more of the associated listed items, as well as all possible combinations, and includes such combinations.
[0021] As used in this application specification, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if [the described condition or event] is detected" may be interpreted, depending on the context, as "once determined," "in response to determination," "once [the described condition or event] is detected," or "in response to detection of [the described condition or event]."
[0022] Furthermore, in the description of this application, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0023] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0024] Defect pixel correction technology, applied in image processing, can be broadly categorized into software and hardware implementations. Software implementation involves performing defect pixel correction within the software of a PC or embedded processor (ARM, DSP, MCU, etc.). This typically involves loading the entire image frame into system memory, along with a list of known defect pixel coordinates detected during the defect pixel calibration phase. The software then iterates through the entire frame based on these coordinates to perform defect pixel correction. However, for high-resolution images, loading the entire frame into memory and searching the defect pixel coordinate list are computationally intensive and time-consuming operations. Especially in scenarios requiring high frame rates for high-resolution image processing, software solutions often cannot meet the throughput requirements for real-time processing, introducing unacceptable processing latency. Furthermore, software processing relies on the processor's computing power and system memory bandwidth. For simple defect pixel correction tasks, the energy efficiency of general-purpose processors is far lower than that of dedicated hardware accelerators. Additionally, many embedded or camera-internal processing scenarios require compact hardware with low power consumption, constraints that software solutions often lack.
[0025] Hardware implementations primarily utilize FPGAs or ASICs to design dedicated image processing pipelines for high-speed bad pixel correction. For example, if the bad pixel list exists in RAM, theoretically, N comparators can be built to simultaneously compare the current pixel with N bad pixels. The drawback is that hardware resource consumption (number of comparators) is directly proportional to the total number of bad pixels N; when N is large, hardware implementation becomes impossible. Another approach is to compare pixel coordinates with one or more entries in the bad pixel list within one or several clock cycles; if a match is not found, the next entry is compared. The drawback is that the lookup time depends on the bad pixel's position in the list; in the worst case, a comparison with the entire list is required, failing to meet the requirement of processing each pixel within a fixed, low latency.
[0026] Based on this, this application discloses a method, system, electronic device, and storage medium for finding and correcting bad pixels, which can efficiently handle bad pixels.
[0027] The technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0028] The method described in this application can be applied to servers, devices, terminals, or other devices with logical processing capabilities; therefore, this application does not limit its application. For ease of description, the following description uses a terminal as the executing entity.
[0029] Please see Figure 1 This application provides an embodiment of a method for finding and correcting bad pixels, comprising: 101. Obtain the target bad pixel coordinate information list, and create a row index table and a column coordinate ordered queue based on the target bad pixel coordinate information list. The target bad pixel coordinate information list includes the total number of bad pixels of the target image sensor, as well as the column coordinate information and row coordinate information of the bad pixels. The row index table includes the row coordinate information of the bad pixels and the number of bad pixels with the same row coordinate information. The column coordinate ordered queue includes the column coordinate information of bad pixels with the same row coordinate information. In this embodiment, a list of target defective pixel coordinates is obtained from the host via a transmission interface such as Ethernet, USB, CXP, or CameraLink. This list contains the total number of defective pixels in the target image sensor, denoted as N, and the column coordinates (xi) and row coordinates (yi) for each defective pixel. Therefore, the complete and accurate coordinates of the defective pixel are (xi, yi). Before obtaining the target defective pixel coordinate list, it is necessary to ensure that the list covers all currently known defective pixels. After obtaining the complete and accurate coordinates of the defective pixels, a row index table and a column coordinate ordered queue can be created based on these coordinates; specifically, a row index table is created based on the row coordinate information yi, and a column coordinate ordered queue is created based on the column coordinate information xi.
[0030] 102. When requesting to acquire the target image and correct the bad pixels of the target image, the target image is buffered row by row according to the preset filter window size to obtain the row pixel data of the target image. The target image is the image output by the target image sensor. In this embodiment, when a request to correct bad pixels in the target image is received, the system allocates row buffer resources according to a preset filtering window size, such as a 3×3 filtering window or a 5×5 filtering window. The depth of the row buffer is equal to the height of the filtering window minus 1; for example, a 3×3 window requires buffering 2 rows of image data. Then, the target image sensor outputs pixel data line by line, and the system stores the current row and the previous few rows of data into the row buffer. The row buffer is implemented using a dual-port RAM of the FPGA, supporting simultaneous read and write operations to ensure continuous pipeline processing. After the row buffer is completed, the system outputs the complete row pixel data required for the filtering window for use by subsequent modules.
[0031] 103. Based on the row coordinate information of the row pixel data, search in the row index table to obtain the number of bad pixels in each row of the target image; In this embodiment, when processing the row pixel data of the target image, the row coordinate information yi of the current row is extracted and used as an index to query the row index table. The row index table directly returns the value corresponding to the index through address mapping. The returned value indicates the number of bad pixels in each row of pixels of the target image. This search process does not need to traverse all bad pixel coordinates; it can be completed with a single index query. That is, if the returned value is 0, it means that there are no bad pixels in all pixels of the indexed current row of the target image, and the process can directly jump to the bad pixel processing flow of subsequent rows; if the returned value is not 0, it means that there are bad pixels in all pixels of the current row of the target image, and the number of bad pixels in the current row is the returned value. This step also provides the row coordinate information as a basis for the next step of accurately finding the column coordinates of bad pixels in the indexed current row, and effectively reduces invalid calculations and search time.
[0032] 104. When the number of bad pixels in the current row of the indexed pixel in the target image is not 0, based on the number of bad pixels in the current row of the indexed pixel and the corresponding row coordinate information, read the column coordinate information of the bad pixels in the row of the target image that are the same as the corresponding row coordinate information from the column coordinate ordered queue, and combine it with the corresponding row coordinate information to generate the bad pixel coordinates of the target image. In this embodiment, when step 103 determines that the number of bad pixels in the indexed current row of the target image is not zero, based on the number of bad pixels and the corresponding row coordinate information, the storage location of the column coordinate information corresponding to the pixel with the same row coordinate information as the indexed current row pixel in the column coordinate ordered queue is first located. Since the column coordinates of the same row in the column coordinate ordered queue are stored sequentially in segments, the column coordinate information xi of the bad pixels in that segment can be read directly in sequence. The value returned by the row index table in step 103 determines the number of times the column coordinates are read in the column coordinate ordered queue under the same corresponding row coordinate information. Then, the currently read column coordinate information xi is combined with the row coordinate information yi corresponding to the indexed current row pixel to generate the complete coordinates (xi, yi) of all bad pixels in the indexed current row pixel. This process achieves fast extraction of column coordinates through structured queue storage, avoids global traversal of the entire bad pixel list, and significantly improves the generation efficiency of bad pixel coordinates.
[0033] 105. Correct the image based on the coordinates of the bad pixels in the target image and the preset filtering window.
[0034] In this embodiment, based on the generated bad pixel coordinates (xi, yi), the bad pixel and its neighboring pixel data within the filtering window are extracted from the row cache. For example, for a 3×3 filtering window, the values of the eight neighboring pixels surrounding the bad pixel (xi, yi) need to be extracted. A preset filtering algorithm (such as median filtering) is used to calculate the correction value for replacing the bad pixel. Subsequently, the correction value is written to the pixel position corresponding to the bad pixel coordinates (xi, yi), completing the correction of a single bad pixel. This local window-based correction method ensures the accuracy of bad pixel repair, and combined with efficient coordinate lookup in the early stages, enables rapid execution of the overall correction process.
[0035] In this embodiment, firstly, a list of target defective pixel coordinate information is obtained, and then a row index table and a column coordinate ordered queue are created based on the target defective pixel coordinate information list. The target defective pixel coordinate information list includes the total number of defective pixels in the target image sensor, as well as the column coordinate information and row coordinate information of the defective pixels. The row index table includes the row coordinate information of the defective pixels and the number of defective pixels with the same row coordinate information. The column coordinate ordered queue includes the column coordinate information of defective pixels with the same row coordinate information. When a request to acquire the target image and correct the defective pixels of the target image is received, the target image is buffered row by row according to the preset filter window size to obtain the row pixel data of the target image. The target image is the image output by the target image sensor. The number of bad pixels in each row of the target image is obtained by searching the row index table based on the row coordinate information of the row pixel data. When the number of bad pixels in the current indexed row of the target image is not zero, the column coordinate information of the bad pixels in the target image that have the same row coordinate information is read from the column coordinate ordered queue based on the number of bad pixels in the current indexed row and the corresponding row coordinate information. This column coordinate information is then combined with the corresponding row coordinate information to generate the bad pixel coordinates of the target image. Correction is then performed based on the bad pixel coordinates of the target image and a preset filtering window. The method for finding and correcting bad pixels in this application creates a row index table and an ordered column coordinate queue based on a target bad pixel coordinate information list. The target bad pixel coordinate information list records the location information of bad pixels at fixed positions on the image sensor. The row index table can be used to quickly determine whether there are bad pixels in each row of the target image and the number of bad pixels, avoiding invalid searches in rows without bad pixels and significantly reducing the search range. The ordered column coordinate queue stores the column coordinates of bad pixels in the same row in a centralized manner, so that after determining that there are bad pixels in the current row, it is only necessary to read the column coordinate information of that row, without traversing the entire bad pixel list. This reduces the time overhead caused by loading the entire frame data or comparing the global list, and significantly reduces the search complexity. While meeting the real-time requirement that each pixel of a high-resolution image is processed within a single clock cycle or a few cycles, it also fixes the delay of the bad pixel judgment pipeline within a limited number of clock cycles, which is basically independent of the total number of bad pixels. After locating the coordinates of the bad pixels, a preset filtering window is used for local correction, effectively improving the processing speed and reducing latency. Especially when there are a large number of bad pixels, it can more efficiently meet the speed and efficiency requirements of real-time image processing, and saves more hardware resources compared to hardware parallel comparator array solutions. In addition, the implementation of this embodiment is compatible with the line scanning input mode of images, eliminating the need to cache the entire image frame or perform complex cross-line / cross-block processing, thus improving the efficiency of the hardware pipeline.
[0036] Please see Figure 2 This application provides another embodiment of a method for finding and correcting bad pixels, comprising: 201. Create a row index table one by one according to the row coordinate information and the number of bad points with the same row coordinate information, and store the row index table in the on-chip random access memory of the field programmable gate array; In this embodiment, according to the list of bad point coordinate information obtained in step 101, the number of bad points Cy corresponding to the row coordinate information yi of each row is counted. It should be noted that the image pixels generated by the target image sensor are all W×H, so the range of yi is 0≤yi<H. Both the column coordinate information and the row coordinate information are within the resolution pixel range of the image generated by the target image sensor. Then, according to the row coordinate information yi of the image output by the target image sensor and the number of bad points corresponding to each row (that is, the number of bad points with the same row coordinate information) Cy, a row index table is created one by one and stored in the on-chip random access memory of the field programmable gate array. Specifically, for the row with row coordinate information yi, if there are Cy bad points in this row, the value Cy is stored at the position corresponding to yi in the row index table; if there are no bad points in this row, 0 is stored. This one-to-one mapping relationship ensures that the number of bad points in this row can be directly located through the row coordinate. In order to store the above row index table, the memory resources of the on-chip random access memory should be planned well. Specifically, the address space of this on-chip random access memory corresponds one by one to the row coordinate information yi, and the maximum value of the number of bad points Cy stored in each address space may be W, that is, all pixel points in this row are bad points. Therefore, the bit width of each address space is determined by W, usually bits, that is, the number of bits obtained by rounding up log2W. And the total capacity of the on-chip random access memory is also determined by the wide resolution H. Therefore, the total capacity of the on-chip random access memory is bits, that is, H multiplied by the bit width of a single storage unit, ensuring that the number of bad points in all rows can be completely stored.
[0037] 202. Write the column coordinate information of the bad points with the same row coordinate information into the column coordinate ordered queue in ascending order, and store the column coordinate ordered queue in the first-in first-out memory.
[0038] In this embodiment, the column coordinate information xi of the bad points in each row is sorted in ascending order. When implementing, all bad points are grouped by row number yi, and the xi values in each group are sorted using algorithms such as quick sort to ensure that the xi values within the same row are arranged in ascending order from small to large. The ascending order ensures the orderliness of the column coordinates of the bad points within the same row, which is convenient for subsequent quick search. The sorted xi values will be used as the data source of the column coordinate ordered queue, and then the sorted xi values are written into the first-in first-out memory in turn. It should be noted that the resolution of the image output by the target image sensor is W×H, and the total number of bad points of the target image sensor is N. Therefore, the depth of the first-in first-out memory is equal to the total number of bad points N, and the bit width of each storage unit is similar to the bit width of each address space in step 201, which is Bits. Therefore, the total storage capacity of the first-in-first-out (FIFO) memory is... The storage width is N times the length of a single column coordinate, ensuring that the column coordinate information of all bad pixels can be fully accommodated, while adhering to the sequential read-write characteristics of FIFO. For example, a 4K image with 1000 bad pixels requires 1000 × 12 bits = 1.5KB of storage space. The read and write pointers of the FIFO are controlled by hardware logic to ensure that data flows out in row-by-row order.
[0039] Please see Figure 3 This application provides another embodiment of a method for finding and correcting bad pixels, comprising: 301. Based on the coordinates of the bad pixels in the target image and the size of the preset filtering window, obtain the coordinates of several neighboring pixels corresponding to the bad pixels in the target image. In this embodiment, the coordinate range of neighboring pixels is calculated within one clock cycle based on the current bad pixel coordinates (xi, yi) and the preset filtering window size. For a 3×3 filtering window, the neighborhood includes eight coordinate points: (xi-1, yi-1), (xi, yi-1), (xi+1, yi-1), (xi-1, yi), (xi+1, yi), (xi-1, yi+1), (xi, yi+1), and (xi+1, yi+1). The system checks whether these coordinates exceed the image boundary. If they do, they are automatically ignored or boundary processing strategies such as mirror filling are used to ensure that the coordinates of the neighboring pixels are all within the valid range, providing complete neighborhood information for subsequent filtering. Next, the system converts the calculated valid neighborhood coordinates into physical storage addresses in the line cache. Since the line cache uses a multi-port RAM design, it can access the pixel values corresponding to multiple coordinates in parallel. For a 3×3 window, the system typically needs to read the coordinate information of the central bad pixel and its eight neighboring pixels (a total of nine pixels) simultaneously within one clock cycle.
[0040] 302. Obtain the pixel values of the coordinates of the bad pixels in the target image and the pixel values of the coordinates of several neighboring pixels; In this embodiment, after obtaining the nine coordinates (including one bad pixel and eight neighboring pixels) in step 301, the pixel values corresponding to the nine coordinates in the target image are extracted. These nine pixel values include the bad pixel value and the neighboring pixel values. Then, the bad pixel value is corrected based on the normal pixel values among the neighboring pixels. Before correction, it is first determined whether there are also bad pixel values among the neighboring pixels. If so, the same method as for boundary pixels is used, i.e., automatic ignoring or mirror filling, to process the neighboring pixel values into eight normal pixel values. Then, the one bad pixel value and the eight normal pixel values are temporarily stored in a buffer area, awaiting subsequent filter processing. To ensure data synchronization, a pipeline register can also be added to align the pixel data of all channels.
[0041] 303. Based on the pixel values of the coordinates of the bad pixels in the target image and the pixel values of the coordinates of several neighboring pixels, perform neighborhood filtering correction to obtain the correction value; In this embodiment, based on the value of one bad pixel and eight normal pixels obtained in step 302, a preset neighborhood filtering algorithm is used to calculate and generate a correction value. Taking median filtering as an example, the eight normal pixels are sorted using 19 comparators in a three-stage pipeline, and the median value after sorting is selected as the correction value. If mean filtering is used, the average value of the eight normal pixels is calculated as the correction value. By calculating the correction value through the statistical characteristics of local neighborhoods, the repaired pixel value can be kept consistent with the surrounding environment, reducing correction artifacts and improving the overall consistency of the image.
[0042] 304. Replace the pixel values of the bad pixel coordinates in the target image with the correction values.
[0043] In this embodiment, the correction value calculated in step 303 replaces the original pixel value at the bad pixel coordinates (xi, yi) in the target image. The replacement operation is performed in the line buffer, directly updating the pixel data at the corresponding coordinates in the line buffer. This ensures that subsequent processing (such as image output or further image processing) uses the corrected pixel value. This replacement method guarantees real-time correction, eliminating the need to wait for the entire frame of image processing to complete. Instead, it updates the bad pixel pixels in real-time during line-by-line processing, enabling the corrected image to be output in real-time as a stream, meeting the requirements of real-time processing of high frame rate images. Furthermore, the replacement operation only targets the bad pixel coordinates, without affecting other normal pixels, avoiding unnecessary computational resource consumption.
[0044] Please see Figure 4 This application provides another embodiment of a method for finding and correcting bad pixels, comprising: 401. Obtain a list of target defect coordinates; Step 401 in this embodiment is similar to step 101 in the previous embodiment, and will not be described again here.
[0045] 402. Store the list of target bad point coordinates in non-volatile memory; In this embodiment, the list of target defect coordinates that have passed verification is stored in non-volatile memory, such as FLASH memory. The characteristics of non-volatile memory ensure that the defect coordinate information is not lost even if the system is powered off or restarted, eliminating the need to retrieve the list every time the system boots up, thus reducing system initialization time. During storage, the list data is written sequentially to the designated storage area according to the memory's address mapping rules, and the starting address and length information of the data are recorded to ensure accurate location and complete retrieval of the list content during subsequent readings. Error check codes can also be added to improve reliability. Furthermore, for ease of management, a certain amount of free space can be reserved in the memory for storing updated defect information later.
[0046] 403. Create a row index table and a column coordinate ordered queue based on the target defect coordinate information list; Step 403 in this embodiment is similar to step 101 in the previous embodiment, and will not be described again here.
[0047] 404. Update the list of target defect coordinates; In this embodiment, the updated content of the target bad pixel coordinate information list is received through the same transmission interface as the target bad pixel coordinate information list. The updated content may include newly added bad pixel coordinates, existing bad pixel coordinates that need to be deleted, or correction information for existing bad pixel coordinates. It is usually transmitted in the form of incremental data to reduce data transmission volume. After receiving the updated content, the system performs a validity check, including coordinate range verification and duplicate verification, to avoid duplication or conflict with existing coordinates. After passing the verification, the updated content is temporarily stored in a temporary buffer for further processing. Simultaneously, the system records the reception time and version information of the updated content for subsequent traceability and management. During the update process, the system maintains access to the currently used bad pixel information to ensure uninterrupted correction functionality.
[0048] 405. Based on the updated content, update the row index table and the column coordinate ordered queue accordingly.
[0049] In this embodiment, based on the update content, the list of target bad pixel coordinate information stored in the non-volatile memory is first updated, replacing or supplementing corresponding entries to ensure that the list in memory is consistent with the latest state. Subsequently, based on the updated complete list, the row index table and column coordinate ordered queue can be recreated, or incremental modifications can be made directly to the existing row index table and column coordinate ordered queue. If a new bad pixel is added, the number of bad pixels in the corresponding row's row index table is increased, and the newly added column coordinates are inserted into the corresponding position in the column coordinate ordered queue in ascending order; if a bad pixel is deleted, the number of bad pixels in the corresponding row is reduced, and the corresponding column coordinates are removed from the column coordinate ordered queue. The update operation is controlled by a dedicated state machine to ensure synchronous updates of the row index table and FIFO. The system temporarily locks access to these two data structures until the update is complete. For large-scale updates, the system may employ a double-buffering mechanism, constructing the updated data structure in a new storage area and then switching pointers to minimize the impact on the real-time correction process. After the update is completed, the new bad pixel information takes effect immediately, ensuring that the row index table and column coordinate ordered queue are always synchronized with the latest bad pixel information, ensuring the accuracy of subsequent bad pixel correction.
[0050] The above embodiments illustrate the method for finding and correcting bad pixels provided in this application. The system, electronic device, and storage medium for finding and correcting bad pixels provided in this application are described below: Please see Figure 5 This application provides an embodiment of a system for finding and correcting bad pixels, comprising: The creation unit 501 is used to obtain a list of target bad pixel coordinate information and create a row index table and a column coordinate ordered queue based on the list of target bad pixel coordinate information. The list of target bad pixel coordinate information includes the total number of bad pixels of the target image sensor and the column coordinate information and row coordinate information of the bad pixels. The row index table includes the row coordinate information of the bad pixels and the number of bad pixels with the same row coordinate information. The column coordinate ordered queue includes the column coordinate information of bad pixels with the same row coordinate information. The row buffer unit 502 is used to buffer the target image according to the size of the preset filtering window when a request to acquire the target image and correct the bad points of the target image is made; the target image is the image output by the target image sensor. The lookup unit 503 is used to search in the row index table based on the row coordinate information of the row pixel data to obtain the number of bad pixels and the corresponding row coordinate information of each row of pixels in the target image; The generation unit 504 is used to generate the bad pixel coordinates of the target image when the number of bad pixels in the current row of the indexed pixels in the target image is not 0, based on the number of bad pixels in the current row of the indexed pixels and the corresponding row coordinate information, read the column coordinate information of the bad pixels in the row of the target image that are the same as the corresponding row coordinate information from the column coordinate ordered queue, and combine it with the corresponding row coordinate information. The correction unit 505 is used to perform correction based on the coordinates of bad pixels in the target image and a preset filtering window.
[0051] Optionally, both column and row coordinate information are within the resolution pixel range of the image generated by the target image sensor. The creation unit 501 is specifically used for: Based on the row coordinate information and the number of bad pixels with the same row coordinate information, a row index table is created one-to-one, and the row index table is stored in the on-chip random access memory of the field programmable gate array. Write the column coordinate information of bad points with the same row coordinate information into the column coordinate ordered queue in ascending order, and store the column coordinate ordered queue into the first-in-first-out memory.
[0052] Optionally, the resolution of the image output by the target image sensor is W×H, and the capacity of the on-chip random access memory of the field-programmable gate array is [missing information]. bit.
[0053] Optionally, the resolution of the image output by the target image sensor is W×H, the total number of bad pixels in the target image sensor is N, and the capacity of the first-in-first-out memory is [missing information]. bit.
[0054] Optionally, the correction unit 505 is specifically used for: Based on the coordinates of the bad pixels in the target image and the size of the preset filtering window, obtain the coordinates of several neighboring pixels corresponding to the bad pixels in the target image. Obtain the pixel values of the bad pixel coordinates and the pixel values of several neighboring pixels in the target image; Based on the pixel values of the bad pixel coordinates and the pixel values of several neighboring pixels in the target image, neighborhood filtering correction is performed to obtain the correction value. Replace the pixel values of the bad pixel coordinates in the target image with the correction values.
[0055] Optionally, after creating unit 501, the following may also be included: Storage unit 506 is used to store a list of target bad point coordinate information into non-volatile memory.
[0056] Optionally, after creating unit 501, the following may also be included: The acquisition unit 507 is used to acquire the updated content of the target bad point coordinate information list; Update unit 508 is used to update the row index table and column coordinate ordered queue according to the update content.
[0057] Please see Figure 6 This application provides an electronic device, including: Processor 601, memory 602, input / output unit 603, and bus 604.
[0058] The processor 601 is connected to the memory 602, the input / output unit 603, and the bus 604.
[0059] The memory 602 stores a program, and the processor 601 calls the program to execute it, such as... Figure 1 , Figure 2 , Figure 3 or Figure 4 Methods for finding and correcting bad pixels.
[0060] This application provides a computer-readable storage medium on which a program is stored, and when the program is executed on a computer, it performs the following... Figure 1 , Figure 2 , Figure 3 or Figure 4 Methods for finding and correcting bad pixels.
[0061] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0062] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.
[0063] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0064] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0065] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
Claims
1. A method for finding and correcting dead pixels, characterized in that, include: Obtain a list of target defective pixel coordinate information, and create a row index table and a column coordinate ordered queue based on the target defective pixel coordinate information list. The target defective pixel coordinate information list includes the total number of defective pixels of the target image sensor, as well as the column coordinate information and row coordinate information of the defective pixels. The row index table includes the row coordinate information of the defective pixels and the number of defective pixels with the same row coordinate information. The column coordinate ordered queue includes the column coordinate information of defective pixels with the same row coordinate information. When requesting to acquire a target image and correct bad pixels in the target image, the target image is buffered row by row according to the size of a preset filtering window to obtain row pixel data of the target image, wherein the target image is the image output by the target image sensor; The number of bad pixels in each row of pixels in the target image is obtained by searching the row index table based on the row coordinate information of the row pixel data. When the number of bad pixels in the current row of the indexed pixel in the target image is not 0, the column coordinate information of the bad pixels in the row of the target image that is the same as the corresponding row coordinate information is read from the column coordinate ordered queue according to the number of bad pixels in the current row of the indexed pixel and the corresponding row coordinate information, and the bad pixel coordinates of the target image are generated by combining the corresponding row coordinate information. Correction is performed based on the coordinates of bad pixels in the target image and the preset filtering window.
2. The method according to claim 1, characterized in that, Both column coordinate information and row coordinate information are within the resolution pixel range of the image generated by the target image sensor. The step of creating a row index table and an ordered queue of column coordinates based on the target bad pixel coordinate information list includes: Based on the row coordinate information and the number of bad pixels with the same row coordinate information, a row index table is created one-to-one, and the row index table is stored in the on-chip random access memory of the field programmable gate array. The column coordinate information of bad points with the same row coordinate information is written into the column coordinate ordered queue in ascending order, and the column coordinate ordered queue is stored in the first-in-first-out memory.
3. The method according to claim 2, characterized in that, The target image sensor outputs an image with a resolution of W×H, and the on-chip random access memory of the field-programmable gate array has a capacity of [missing information]. Bit.
4. The method according to claim 2, characterized in that, The target image sensor outputs an image with a resolution of W×H, the target image sensor has a total of N dead pixels, and the first-in-first-out memory has a capacity of [missing information]. Bit.
5. The method according to claim 1, characterized in that, The correction based on the coordinates of the bad pixels in the target image and the preset filtering window includes: Based on the coordinates of the bad pixels in the target image and the size of the preset filtering window, obtain the coordinates of several neighboring pixels corresponding to the coordinates of the bad pixels in the target image. Obtain the pixel values of the bad pixel coordinates and the pixel values of the coordinates of the several neighboring pixels in the target image; Based on the pixel values of the bad pixel coordinates in the target image and the pixel values of the coordinates of several neighboring pixels, neighborhood filtering correction is performed to obtain a correction value. Replace the pixel values of the bad pixel coordinates in the target image with the correction values.
6. The method according to any one of claims 1-5, characterized in that, After obtaining the list of target defect coordinates, the following is also included: The list of target bad point coordinates is stored in non-volatile memory.
7. The method according to claim 6, characterized in that, After creating a row index table and an ordered queue of column coordinates based on the target bad pixel coordinate information list, the process also includes: Obtain the updated content of the target defect coordinate information list; Based on the updated content, the row index table and the column coordinate ordered queue are updated accordingly.
8. A system for finding and correcting defective pixels, characterized in that, include: A creation unit is used to obtain a list of target bad pixel coordinate information and create a row index table and a column coordinate ordered queue based on the list of target bad pixel coordinate information. The list of target bad pixel coordinate information includes the total number of bad pixels of the target image sensor and the column coordinate information and row coordinate information of the bad pixels. The row index table includes the row coordinate information of the bad pixels and the number of bad pixels with the same row coordinate information. The column coordinate ordered queue includes the column coordinate information of bad pixels with the same row coordinate information. A row buffer unit is used to buffer the target image in rows according to the size of a preset filtering window when a request is made to acquire a target image and correct bad pixels in the target image, thereby obtaining row pixel data of the target image, wherein the target image is the image output by the target image sensor; The lookup unit is used to search the row index table based on the row coordinate information of the row pixel data to obtain the number of bad pixels in each row of pixels in the target image; The generation unit is configured to, when the number of bad pixels in the current row of the indexed pixel in the target image is not 0, read the column coordinate information of bad pixels in the row of the target image that is the same as the corresponding row coordinate information from the column coordinate ordered queue according to the number of bad pixels in the current row of the indexed pixel and the corresponding row coordinate information, and combine the corresponding row coordinate information to generate the bad pixel coordinates of the target image. The correction unit is used to perform correction based on the coordinates of bad pixels in the target image and the preset filtering window.
9. An electronic device, characterized in that, include: Processor, memory, input / output units, and bus; The processor is connected to the memory, the input / output unit, and the bus; The memory stores a program that the processor invokes to perform the method for finding and correcting bad pixels as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium contains a program that, when executed on a computer, performs the method for finding and correcting bad pixels as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Video OSD display method, computer device and computer readable storage medium
CN114785975A
Image sensor pixel reading method, storage medium and camera
CN116582763A
Image correction method and system, terminal and computer storage medium
CN117274068A
Dead pixel correction method and electronic equipment
CN118233718A
Method and apparatus for adaptive image data interpolation
US7321400B1