Method, system, electronic device and storage medium for removing horizontal and vertical lines from infrared images
By optimizing the infrared image processing algorithm and using the NEON computing unit, the problems of complex algorithms and large resource occupancy in the existing technology are solved, and efficient and low-cost infrared image horizontal and vertical grain processing is realized.
Patent Information
- Application Number
- CN202210305485.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-25
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2042-03-25
AI Technical Summary
In the existing infrared image processing technology, the algorithm for removing horizontal and vertical lines is complex and has a large resource occupancy, making it difficult to achieve real-time processing on a single ARM chip, and requires the use of expensive and power-consuming large amounts of FPGA chips.
By optimizing the original horizontal and vertical grain algorithm, the number of calculations is reduced, and the calculation is performed using the NEON computing unit in the ARM architecture, the FPGA chip is replaced, reducing equipment cost and power consumption.
It improves the computing efficiency of infrared image processing, reduces equipment production costs, and reduces power consumption, and realizes real-time processing capabilities.
Smart Images

Figure FDA0005327394060000011 
Figure FDA0005327394060000012 
Figure FDA0005327394060000013
Abstract
Description
Technical Field
[0001] The present application belongs to the field of image processing, and in particular relates to a method, system, electronic device and storage medium for removing horizontal and vertical lines from infrared images. Background Art
[0002] Infrared cameras are devices that realize imaging based on the thermal radiation of objects. They can convert infrared spectrum signals into digital signals. During the imaging process, the infrared detector collects infrared images with obvious horizontal and vertical stripes. Image processing algorithms are needed to remove the horizontal and vertical stripes to obtain infrared images with clear details that are easy for the human eye to recognize.
[0003] Because the general infrared image horizontal and vertical stripe removal algorithm is relatively complex and occupies more resources, and is limited by the performance of embedded ARM chips, it is almost impossible for a single ARM chip to achieve real-time processing of the horizontal and vertical stripe removal algorithm. In order to enhance image quality and improve customer experience, most embedded infrared camera solutions on the market currently use a dual-chip solution such as FPGA+ARM to implement infrared image processing functions. The FPGA chip is used to implement the horizontal and vertical stripe removal algorithm to share the computing workload of the ARM processor.
[0004] However, FPGA chips are expensive and consume a lot of power, which not only increases the overall cost of the device but also increases the overall power consumption of the device. Summary of the invention
[0005] The main purpose of the embodiments of the present invention is to provide a method, system, electronic device and storage medium for removing horizontal and vertical lines from infrared images. Not only does it optimize the original horizontal and vertical line removal algorithm, thereby reducing the judgment calculation that affects the calculation speed in the original horizontal and vertical line removal algorithm and improving the calculation efficiency, but it also calculates the horizontal and vertical line removal algorithm through the NEON computing unit in the ARM architecture, replacing the FPGA computing unit originally required, thereby reducing the production cost of the equipment.
[0006] In a first aspect, a method for removing horizontal and vertical lines from an infrared image is provided, the method comprising:
[0007] The original algorithm for removing horizontal and vertical lines is optimized to obtain an optimized algorithm for removing horizontal and vertical lines. The algorithm for removing horizontal and vertical lines is optimized, including:
[0008] Processing the infrared image to be processed to obtain the cumulative sum and weighted sum of the pixels to be processed in the infrared image to be processed;
[0009] Calculating the value of the pixel to be processed and the weight matrix of the pixel to be processed according to the accumulated sum and the weighted sum of the pixel to be processed, so as to remove the horizontal and vertical stripes by the value of the pixel to be processed and the weight matrix;
[0010] The NEON computing unit in the ARM architecture is used to perform calculations to remove horizontal and vertical stripes from the infrared image to be processed according to the optimized horizontal and vertical stripe removal algorithm.
[0011] In a possible implementation, the processing of the infrared image to be processed to obtain the cumulative sum and the weighted sum of the pixels to be processed in the infrared image to be processed includes:
[0012] Performing filtering and expansion processing on the infrared image to be processed by using a preset filtering template and a preset grayscale difference algorithm to obtain a grayscale difference value of the infrared image to be processed;
[0013] Obtain the weight of the pixel to be processed by looking up the grayscale difference table, and obtain the cumulative sum of the pixel to be processed according to a preset cumulative sum formula;
[0014] The weighted sum of the pixels to be processed is obtained according to the cumulative sum and a preset weighted sum formula.
[0015] In a possible implementation, the algorithm optimization of the original horizontal and vertical stripe removal algorithm further includes: adjusting the traversal mode of the optimized horizontal and vertical stripe removal algorithm from column traversal to row traversal by presetting the number of cycles of the optimized horizontal and vertical stripe removal algorithm.
[0016] In another possible implementation, the step of presetting the number of cycles of the optimized horizontal and vertical streak removal algorithm includes:
[0017] Expanding the boundary of the infrared image to be processed according to a preset filtering template, and acquiring width data and height data of the expanded infrared image to be processed;
[0018] According to the width data and height data of the expanded infrared image to be processed and the optimized algorithm for removing horizontal and vertical stripes, the number of loops is indicated by an immediate number.
[0019] In a second aspect, a system for removing horizontal and vertical lines from an infrared image is provided, the system comprising:
[0020] The acquisition module is used to optimize the original horizontal and vertical grain removal algorithm and obtain the optimized horizontal and vertical grain removal algorithm. The algorithm optimization of the original horizontal and vertical grain removal algorithm includes:
[0021] Processing the infrared image to be processed to obtain the cumulative sum and weighted sum of the pixels to be processed in the infrared image to be processed;
[0022] Calculating the value of the pixel to be processed and the weight matrix of the pixel to be processed according to the accumulated sum and the weighted sum of the pixel to be processed, so as to remove the horizontal and vertical stripes by the value of the pixel to be processed and the weight matrix;
[0023] The computing module is used to perform calculations for removing horizontal and vertical stripes from the infrared image to be processed according to the optimized horizontal and vertical stripe removal algorithm through a NEON computing unit in an ARM architecture.
[0024] In a possible implementation, the processing of the infrared image to be processed to obtain the cumulative sum and the weighted sum of the pixels to be processed in the infrared image to be processed includes:
[0025] Performing filtering and expansion processing on the infrared image to be processed by using a preset filtering template and a preset grayscale difference algorithm to obtain a grayscale difference value of the infrared image to be processed;
[0026] Obtain the weight of the pixel to be processed by looking up the grayscale difference table, and obtain the cumulative sum of the pixel to be processed according to a preset cumulative sum formula;
[0027] The weighted sum of the pixels to be processed is obtained according to the cumulative sum and a preset weighted sum formula.
[0028] In a possible implementation, the acquisition module includes:
[0029] A cycle number obtaining unit, used to specify the cycle number of the optimized horizontal and vertical streak removal algorithm by preset;
[0030] The traversal mode adjustment unit is used to adjust the traversal mode of the optimized horizontal and vertical stripe removal algorithm from column traversal to row traversal.
[0031] In another possible implementation, the cycle number acquisition unit includes:
[0032] A data acquisition unit, used for extending the boundary of the infrared image to be processed according to a preset filtering template, and acquiring width data and height data of the extended infrared image to be processed;
[0033] The loop number indicating unit is used to indicate the loop number through an immediate number according to the width data and height data of the expanded infrared image to be processed and the optimized algorithm for removing horizontal and vertical stripes.
[0034] In a third aspect, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for removing horizontal and vertical lines from an infrared image provided in the first aspect is implemented.
[0035] In a fourth aspect, a non-transitory computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method for removing horizontal and vertical lines from an infrared image provided in the first aspect is implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in describing the embodiments of the present application are briefly introduced below.
[0037] Figure 1 A flow chart of a method for removing horizontal and vertical lines from an infrared image provided by an embodiment of the present invention;
[0038] Figure 2 A flow chart of a method for removing horizontal and vertical lines from an infrared image provided by another embodiment of the present invention;
[0039] Figure 3 A flowchart of a method for removing horizontal and vertical lines from an infrared image provided by another embodiment of the present invention
[0040] Figure 4 A structural diagram of a system for removing horizontal and vertical lines from infrared images provided by one embodiment of the present invention;
[0041] Figure 5 A structural diagram of a system for removing horizontal and vertical lines from infrared images provided by another embodiment of the present invention;
[0042] Figure 6 A structural diagram of a system for removing horizontal and vertical lines from infrared images provided by yet another embodiment of the present invention;
[0043] Figure 7 The figure is a schematic diagram of the physical structure of an electronic device of the present invention.
[0044] Specific implementation method
[0045] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar modules or modules with the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be interpreted as limiting the present invention.
[0046] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "a", "an", "said" and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of the features, integers, steps, operations, modules and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, modules, components and / or groups thereof. It should be understood that when we refer to a module as being "connected" or "coupled" to another module, it may be directly connected or coupled to the other modules, or there may be intermediate modules. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any modules and all combinations of one or more associated listed items.
[0047] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation method of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0048] The technical solution of the present application and how to solve the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0049] like Figure 1 The flowchart of a method for removing horizontal and vertical lines from an infrared image provided by an embodiment of the present invention is shown, and the method comprises:
[0050] Step 101, optimizing the original algorithm for removing horizontal and vertical lines, and obtaining an optimized algorithm for removing horizontal and vertical lines, wherein optimizing the original algorithm for removing horizontal and vertical lines includes: processing the infrared image to be processed, and obtaining a cumulative sum and a weighted sum of pixels to be processed in the infrared image to be processed; calculating the value of the pixel to be processed and a weight matrix of the pixel to be processed according to the cumulative sum and the weighted sum of the pixel to be processed, so as to remove the horizontal and vertical lines by the value of the pixel to be processed and the weight matrix;
[0051] Specifically, the infrared image to be processed can be subjected to filtering and expansion processing by using a preset filtering template and a preset grayscale difference algorithm to obtain a grayscale difference value of the infrared image to be processed;
[0052] Obtain the weight of the pixel to be processed by looking up the grayscale difference table, and obtain the cumulative sum of the pixel to be processed according to a preset cumulative sum formula;
[0053] Obtaining a weighted sum of the pixels to be processed according to the cumulative sum and a preset weighted sum formula;
[0054] Obtaining a weight matrix of the pixel to be processed according to a preset weight matrix algorithm;
[0055] Step 102 , using the NEON computing unit in the ARM architecture to perform calculations for removing horizontal and vertical stripes on the infrared image to be processed according to the optimized horizontal and vertical stripe removal algorithm.
[0056] In an embodiment of the present invention, in order to solve the problem of multiple calculations in the original horizontal and vertical line removal algorithm, the original horizontal and vertical line removal algorithm is optimized, the number of calculations of the optimized horizontal and vertical line removal algorithm is reduced, and the load of the horizontal and vertical line removal algorithm in subsequent calculation modules is reduced.
[0057] NEON technology is ARM Cortex TM-A series processors are specially designed for large-scale parallel computing 128-bit SIMD (single instruction, multiple data) architecture extension. NEON technology can provide flexible and powerful acceleration for consumer multimedia applications. The horizontal and vertical stripe removal part of the infrared image to be processed is calculated in the NEON computing unit through the optimized horizontal and vertical stripe removal algorithm. Not only does it not need to add expensive FPGA chips to the device, but also thanks to the powerful computing power of the NEON computing module, the horizontal and vertical stripes in the infrared image to be processed can be quickly and accurately removed. To turn on the NEON computing unit, it can be achieved through the following code:
[0058] arm-linux-g++-O3-mfloat-abi=softfp-mfpu=neon-o*.cpp
[0059] In the embodiment of the present invention, the original horizontal and vertical stripe removal algorithm is optimized to obtain the optimized horizontal and vertical stripe removal algorithm; the horizontal and vertical stripe removal calculation is performed on the infrared image to be processed according to the optimized horizontal and vertical stripe removal algorithm by the NEON computing unit in the ARM architecture. Not only is the judgment calculation that affects the calculation speed in the original horizontal and vertical stripe removal algorithm reduced by optimizing the original horizontal and vertical stripe removal algorithm, thereby improving the hormone three efficiency, but also the horizontal and vertical stripe removal algorithm is calculated by the original NEON computing unit in the ARM architecture, replacing the original FPGA calculation unit, thereby reducing the production cost of the equipment.
[0060] like Figure 2 The flowchart of a method for removing horizontal and vertical lines provided by another embodiment of the present invention is shown, wherein the algorithm optimization of the original algorithm for removing horizontal and vertical lines includes:
[0061] Step 201, filtering and expanding the infrared image to be processed by using a preset filtering template and a preset grayscale difference algorithm to obtain the grayscale difference value of the infrared image to be processed, wherein the grayscale difference algorithm is: gray_diff[m][n]=src[i][j]-src[m][n], m∈[i-1,i+1], n∈[j-1,j+1], i∈[0,h], j∈[0,w];
[0062] Step 202, the weight of the pixel to be processed is obtained by looking up the table according to the grayscale difference, and the cumulative sum of the pixel to be processed is obtained according to a preset cumulative sum formula, and the cumulative sum formula is:
[0063]
[0064] Step 203, obtaining the weighted sum of the pixels to be processed according to the cumulative sum and a preset weighted sum formula, wherein the weighted sum formula is:
[0065]
[0066] Step 204, obtaining the filtered value of the pixel to be processed according to the cumulative sum, the weighted sum and a preset filtering evaluation formula, wherein the filtering evaluation formula is:
[0067]
[0068] Step 205, obtaining the weight matrix of the pixel to be processed according to a preset weight matrix algorithm, wherein the weight matrix algorithm is:
[0069]
[0070] In the embodiment of the present invention, the original algorithm for removing horizontal and vertical lines has the problem of large amount of calculation. Therefore, the present application reduces the steps of the algorithm for removing horizontal and vertical lines to five steps: obtaining the grayscale difference of the infrared image to be processed, obtaining the cumulative sum of the pixels to be processed, obtaining the weighted sum of the pixels to be processed, obtaining the filtered value of the pixels to be processed, and obtaining the weight matrix of the pixels to be processed, thereby avoiding multiple conditional judgment calculations and improving calculation efficiency. In the formulas involved above, m and n represent the index of the window, i and j represent the index of the current image, h represents the height of the infrared image to be processed after expansion, w represents the width of the infrared image to be processed after expansion, gray_weight_table represents the Gaussian weight table, and src represents the value of the current pixel.
[0071] The above filtering template is a 3*3 filtering template.
[0072] As an optional embodiment of the present invention, the algorithm optimization of the original horizontal and vertical line removal algorithm also includes: adjusting the traversal mode of the optimized horizontal and vertical line removal algorithm from column traversal to row traversal by presetting the number of cycles of the optimized horizontal and vertical line removal algorithm.
[0073] like Figure 3 The flowchart of a method for removing horizontal and vertical lines provided by another embodiment of the present invention is shown, wherein the number of cycles of the optimized algorithm for removing horizontal and vertical lines is indicated by preset, including:
[0074] Step 301, expanding the boundary of the infrared image to be processed according to a preset filtering template, and obtaining width data and height data of the expanded infrared image to be processed;
[0075] Step 302 , indicating the number of loops by an immediate number according to the width data and height data of the expanded infrared image to be processed and the optimized algorithm for removing horizontal and vertical stripes.
[0076] In the embodiment of the present invention, the number of cycles of the optimized horizontal and vertical stripe removal algorithm is indicated by an immediate number, and the width and height data of the infrared image to be processed after the boundary expansion need to be obtained. Therefore, the boundary of the infrared image to be processed is first expanded by a preset filter template, and the width data and height data of the infrared image to be processed after the expansion are obtained. Based on the width data, height data and the optimized horizontal and vertical stripe removal algorithm, the number of cycles is indicated by an immediate number.
[0077] like Figure 4 The figure shows a structural diagram of a system for removing horizontal and vertical lines from infrared images provided by an embodiment of the present invention, wherein the system comprises:
[0078] The acquisition module 401 is used to optimize the original algorithm for removing horizontal and vertical lines, and obtain the optimized algorithm for removing horizontal and vertical lines. The algorithm optimization of the original algorithm for removing horizontal and vertical lines includes: processing the infrared image to be processed to obtain the cumulative sum and weighted sum of the pixels to be processed in the infrared image to be processed; calculating the value of the pixel to be processed and the weight matrix of the pixel to be processed according to the cumulative sum and weighted sum of the pixel to be processed, so as to remove the horizontal and vertical lines through the value of the pixel to be processed and the weight matrix.
[0079] Specifically, the infrared image to be processed is subjected to filtering and expansion processing by using a preset filtering template and a preset grayscale difference algorithm to obtain a grayscale difference value of the infrared image to be processed;
[0080] Obtain the weight of the pixel to be processed by looking up the grayscale difference table, and obtain the cumulative sum of the pixel to be processed according to a preset cumulative sum formula;
[0081] Obtaining a weighted sum of the pixels to be processed according to the cumulative sum and a preset weighted sum formula;
[0082] Obtaining a weight matrix of the pixel to be processed according to a preset weight matrix algorithm;
[0083] The calculation module 402 is used to perform calculations for removing horizontal and vertical stripes from the infrared image to be processed according to the optimized horizontal and vertical stripe removal algorithm through a NEON computing unit in the ARM architecture.
[0084] In an embodiment of the present invention, in order to solve the problem of multiple calculations in the original horizontal and vertical line removal algorithm, the original horizontal and vertical line removal algorithm is optimized, the number of calculations of the optimized horizontal and vertical line removal algorithm is reduced, and the load of the horizontal and vertical line removal algorithm in subsequent calculation modules is reduced.
[0085] NEON technology is ARM Cortex TM-A series processors are specially designed for large-scale parallel computing 128-bit SIMD (single instruction, multiple data) architecture extension. NEON technology can provide flexible and powerful acceleration for consumer multimedia applications. The horizontal and vertical stripe removal part of the infrared image to be processed is calculated in the NEON computing unit through the optimized horizontal and vertical stripe removal algorithm. Not only does it not need to add expensive FPGA chips to the device, but also thanks to the powerful computing power of the NEON computing module, the horizontal and vertical stripes in the infrared image to be processed can be quickly and accurately removed. To turn on the NEON computing unit, it can be achieved through the following code:
[0086] arm-linux-g++-O3-mfloat-abi=softfp-mfpu=neon-o*.cpp
[0087] The grayscale difference algorithm is: gray_diff[m][n]=src[i][j]-src[m][n], m∈[i-1,i+1], n∈[j-1,j+1], i∈[0,h], j∈[0,w],
[0088] The cumulative sum formula is:
[0089]
[0090] The weighted sum formula is:
[0091]
[0092] The filtering evaluation formula is:
[0093] The weight matrix algorithm is:
[0094] Among them, m and n represent the index of the window, i and j represent the index of the current image, h represents the height of the infrared image to be processed after expansion, w represents the width of the infrared image to be processed after expansion, gray_weight_table represents the Gaussian weight table, and src represents the value of the current pixel.
[0095] The original algorithm for removing horizontal and vertical stripes has the problem of large amount of calculation. Therefore, the present application reduces the steps of the algorithm for removing horizontal and vertical stripes to five steps: obtaining the grayscale difference of the infrared image to be processed, obtaining the cumulative sum of the pixels to be processed, obtaining the weighted sum of the pixels to be processed, obtaining the filtered value of the pixels to be processed, and obtaining the weight matrix of the pixels to be processed, thereby avoiding the calculation of multiple condition judgments and improving the calculation efficiency.
[0096] The above filtering template is a 3*3 filtering template.
[0097] In the embodiment of the present invention, the original horizontal and vertical stripe removal algorithm is optimized to obtain the optimized horizontal and vertical stripe removal algorithm; the horizontal and vertical stripe removal calculation is performed on the infrared image to be processed according to the optimized horizontal and vertical stripe removal algorithm by the NEON computing unit in the ARM architecture. Not only is the judgment calculation that affects the calculation speed in the original horizontal and vertical stripe removal algorithm reduced by optimizing the original horizontal and vertical stripe removal algorithm, thereby improving the hormone three efficiency, but also the horizontal and vertical stripe removal algorithm is calculated by the original NEON computing unit in the ARM architecture, replacing the original FPGA calculation unit, thereby reducing the production cost of the equipment.
[0098] like Figure 5 The figure is a structural diagram of a system for removing horizontal and vertical lines from infrared images provided by another embodiment of the present invention, wherein the acquisition module 401 further includes:
[0099] A cycle number obtaining unit 501 is used to specify the cycle number of the optimized horizontal and vertical streak removal algorithm by preset;
[0100] The traversal mode adjusting unit 502 is used to adjust the traversal mode of the optimized horizontal and vertical streak removal algorithm from column traversal to row traversal.
[0101] In the embodiment of the present invention, the original horizontal and vertical stripe removal algorithm is optimized to obtain the optimized horizontal and vertical stripe removal algorithm; the horizontal and vertical stripe removal calculation is performed on the infrared image to be processed according to the optimized horizontal and vertical stripe removal algorithm by the NEON computing unit in the ARM architecture. Not only is the judgment calculation that affects the calculation speed in the original horizontal and vertical stripe removal algorithm reduced by optimizing the original horizontal and vertical stripe removal algorithm, thereby improving the hormone three efficiency, but also the horizontal and vertical stripe removal algorithm is calculated by the original NEON computing unit in the ARM architecture, replacing the original FPGA calculation unit, thereby reducing the production cost of the equipment.
[0102] like Figure 6 FIG. 5 is a structural diagram of a system for removing horizontal and vertical lines from infrared images provided by another embodiment of the present invention. The cycle number acquisition unit 502 includes:
[0103] The data acquisition unit 601 is used to expand the boundary of the infrared image to be processed according to a preset filtering template, and obtain the width data and height data of the expanded infrared image to be processed;
[0104] The loop number specifying unit 602 is used to specify the loop number through an immediate number according to the width data and height data of the expanded infrared image to be processed and the optimized algorithm for removing horizontal and vertical stripes.
[0105] In the embodiment of the present invention, the number of cycles of the optimized horizontal and vertical stripe removal algorithm is indicated by an immediate number, and the width and height data of the infrared image to be processed after the boundary expansion need to be obtained. Therefore, the boundary of the infrared image to be processed is first expanded by a preset filter template, and the width data and height data of the infrared image to be processed after the expansion are obtained. Based on the width data, height data and the optimized horizontal and vertical stripe removal algorithm, the number of cycles is indicated by an immediate number.
[0106] Figure 7 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 7 As shown, the electronic device may include: a processor (processor) 701, a communication interface (Communications Interface) 702, a memory (memory) 703 and a communication bus 704, wherein the processor, the communication interface and the memory communicate with each other through the communication bus. The processor can call the logic instructions in the memory to execute the method of removing horizontal and vertical lines from infrared images, and the method includes: optimizing the original algorithm for removing horizontal and vertical lines to obtain the optimized algorithm for removing horizontal and vertical lines, and optimizing the original algorithm for removing horizontal and vertical lines includes: performing filtering and expansion processing on the infrared image to be processed through a preset filtering template and a preset grayscale difference algorithm to obtain the grayscale difference of the infrared image to be processed; obtaining the weight of the pixel points to be processed by looking up the table according to the grayscale difference, and obtaining the cumulative sum of the pixel points to be processed according to a preset cumulative sum formula; obtaining the weighted sum of the pixel points to be processed according to the cumulative sum and a preset weighted sum formula; obtaining the weight matrix of the pixel points to be processed according to a preset weight matrix algorithm; and performing horizontal and vertical line removal calculation on the infrared image to be processed according to the optimized algorithm for removing horizontal and vertical lines through the NEON computing unit in the ARM architecture.
[0107] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0108] On the other hand, an embodiment of the present invention further provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the method for removing horizontal and vertical lines from infrared images provided by the above-mentioned method embodiments, the method including: optimizing the original algorithm for removing horizontal and vertical lines to obtain an optimized algorithm for removing horizontal and vertical lines, the algorithm optimization of the original algorithm for removing horizontal and vertical lines includes: performing filtering and expansion processing on the infrared image to be processed through a preset filtering template and a preset grayscale difference algorithm to obtain the grayscale difference of the infrared image to be processed; obtaining the weight of the pixel points to be processed by looking up the table according to the grayscale difference, and obtaining the cumulative sum of the pixel points to be processed according to a preset cumulative sum formula; obtaining the weighted sum of the pixel points to be processed according to the cumulative sum and a preset weighted sum formula; obtaining the weight matrix of the pixel points to be processed according to a preset weight matrix algorithm; and performing horizontal and vertical line removal calculation on the infrared image to be processed according to the optimized algorithm for removing horizontal and vertical lines through a NEON computing unit in the ARM architecture.
[0109] On the other hand, an embodiment of the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the method for removing horizontal and vertical lines from infrared images provided in the above-mentioned embodiments, the method comprising: performing algorithm optimization on an original algorithm for removing horizontal and vertical lines to obtain an optimized algorithm for removing horizontal and vertical lines, the algorithm optimization on the original algorithm for removing horizontal and vertical lines comprising: performing filtering and expansion processing on the infrared image to be processed by a preset filtering template and a preset grayscale difference algorithm to obtain a grayscale difference of the infrared image to be processed; obtaining the weight of the pixel points to be processed by looking up a table according to the grayscale difference, and obtaining the cumulative sum of the pixel points to be processed according to a preset cumulative sum formula; obtaining the weighted sum of the pixel points to be processed according to the cumulative sum and a preset weighted sum formula; obtaining the weight matrix of the pixel points to be processed according to a preset weight matrix algorithm; and performing horizontal and vertical line removal calculations on the infrared image to be processed according to the optimized algorithm for removing horizontal and vertical lines by a NEON computing unit in the ARM architecture.
[0110] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0111] The above is only a partial implementation of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for removing horizontal and vertical lines from infrared images, characterized in that: The method comprises: The original algorithm for removing horizontal and vertical lines is optimized to obtain an optimized algorithm for removing horizontal and vertical lines. The algorithm for removing horizontal and vertical lines is optimized, including: Step 201, filtering and expanding the infrared image to be processed by using a preset filtering template and a preset grayscale difference algorithm to obtain the grayscale difference value of the infrared image to be processed, wherein the grayscale difference algorithm is: gray_diff[m][n]=src[i][j]-src[m][n], m∈[i-1,i+1], n∈[j-1,j+1], i∈[0,h], j∈[0,w]; Step 202, the weight of the pixel to be processed is obtained by looking up the table according to the grayscale difference, and the cumulative sum of the pixel to be processed is obtained according to a preset cumulative sum formula, and the cumulative sum formula is: Step 203, obtaining the weighted sum of the pixels to be processed according to the cumulative sum and a preset weighted sum formula, wherein the weighted sum formula is: Step 204, obtaining the filtered value of the pixel to be processed according to the cumulative sum, the weighted sum and a preset filtering evaluation formula, wherein the filtering evaluation formula is: Step 205, obtaining the weight matrix of the pixel to be processed according to a preset weight matrix algorithm, wherein the weight matrix algorithm is: Using the NEON computing unit in the ARM architecture to perform calculations to remove horizontal and vertical lines from the infrared image to be processed according to the optimized horizontal and vertical line removal algorithm; Among them, m and n represent the index of the window, i and j represent the index of the current image, h represents the height of the infrared image to be processed after expansion, w represents the width of the infrared image to be processed after expansion, gray_weight_table represents the Gaussian weight table, and src represents the value of the current pixel.
2. The method according to claim 1, characterized in that The algorithm optimization of the original horizontal and vertical stripe removal algorithm also includes: specifying the number of cycles of the optimized horizontal and vertical stripe removal algorithm by preset, and adjusting the traversal mode of the optimized horizontal and vertical stripe removal algorithm from column traversal to row traversal.
3. The method according to claim 2, characterized in that The preset number of cycles of the optimized horizontal and vertical streak removal algorithm includes: Expanding the boundary of the infrared image to be processed according to a preset filtering template, and acquiring width data and height data of the expanded infrared image to be processed; According to the width data and height data of the expanded infrared image to be processed and the optimized algorithm for removing horizontal and vertical stripes, the number of loops is indicated by an immediate number.
4. A system for removing horizontal and vertical lines from infrared images, characterized in that: The system comprises: The acquisition module is used to optimize the original horizontal and vertical grain removal algorithm and obtain the optimized horizontal and vertical grain removal algorithm. The algorithm optimization of the original horizontal and vertical grain removal algorithm includes: Step 201, filtering and expanding the infrared image to be processed by using a preset filtering template and a preset grayscale difference algorithm to obtain the grayscale difference value of the infrared image to be processed, wherein the grayscale difference algorithm is: gray_diff[m][n]=src[i][j]-src[m][n], m∈[i-1,i+1], n∈[j-1,j+1], i∈[0,h], j∈[0,w]; Step 202, the weight of the pixel to be processed is obtained by looking up the table according to the grayscale difference, and the cumulative sum of the pixel to be processed is obtained according to a preset cumulative sum formula, and the cumulative sum formula is: Step 203, obtaining the weighted sum of the pixels to be processed according to the cumulative sum and a preset weighted sum formula, wherein the weighted sum formula is: Step 204, obtaining the filtered value of the pixel to be processed according to the cumulative sum, the weighted sum and a preset filtering evaluation formula, wherein the filtering evaluation formula is: Step 205, obtaining the weight matrix of the pixel to be processed according to a preset weight matrix algorithm, wherein the weight matrix algorithm is: A computing module, used for performing calculations for removing horizontal and vertical stripes from the infrared image to be processed according to the optimized horizontal and vertical stripe removal algorithm through a NEON computing unit in an ARM architecture; Among them, m and n represent the index of the window, i and j represent the index of the current image, h represents the height of the infrared image to be processed after expansion, w represents the width of the infrared image to be processed after expansion, gray_weight_table represents the Gaussian weight table, and src represents the value of the current pixel.
5. The system according to claim 4, characterized in that The acquisition module also includes: A cycle number obtaining unit, used to specify the cycle number of the optimized horizontal and vertical streak removal algorithm by preset; The traversal mode adjustment unit is used to adjust the traversal mode of the optimized horizontal and vertical stripe removal algorithm from column traversal to row traversal.
6. The system according to claim 5, characterized in that The cycle number acquisition unit includes: A data acquisition unit, used for extending the boundary of the infrared image to be processed according to a preset filtering template, and acquiring width data and height data of the extended infrared image to be processed; The loop number indicating unit is used to indicate the loop number through an immediate number according to the width data and height data of the expanded infrared image to be processed and the optimized algorithm for removing horizontal and vertical stripes.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method for removing horizontal and vertical lines from an infrared image as described in any one of claims 1 to 3 is implemented.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for removing horizontal and vertical lines from an infrared image as described in any one of claims 1 to 3 is implemented.
Citation Information
Patent Citations
Infrared image stripe removing method and device, infrared detector and storage medium
CN109360168A
Vertical stripe removing method for infrared video
CN110910324A