Disclosure of Invention
The invention aims to provide a method and a device for removing stripes of an infrared image, an infrared detector and a computer readable storage medium, which are used for solving the problems that ghost images are easy to appear and edge blurring is caused in the image after the existing infrared image is subjected to stripe removal.
In order to solve the technical problem, the invention provides a method for removing stripes of an infrared image, which comprises the following steps:
acquiring an original image output by an infrared detector and subjected to preprocessing;
filtering the original image to obtain a filtered image;
acquiring a vertical stripe matrix and/or a horizontal stripe matrix according to the original image and the filtered image;
searching the vertical column/horizontal row position suspected of having ghost from the vertical stripe matrix and/or the horizontal stripe matrix, and not performing corresponding vertical stripe/horizontal stripe removing processing on the vertical column/horizontal row position;
and generating an image with stripes removed according to the original image and the processed vertical stripe matrix and/or horizontal stripe matrix.
Optionally, the acquiring the raw image output by the infrared detector and preprocessed includes:
and acquiring an image which is output by the infrared detector and subjected to two-point value correction and blind pixel replacement as the original image.
Optionally, the filtering the original image, and acquiring a filtered image includes:
and filtering the original image by adopting a vertical stripe filter and/or a transverse stripe filter to obtain a filtered image.
Optionally, the searching for the vertical column position suspected of having the ghost from the vertical stripe matrix, and the non-vertical stripe removing processing for the vertical column position includes:
each point in the vertical stripe matrix and data above the pixel of the point calculate an average value to obtain an average value matrix;
performing column direction median filtering on the mean matrix to obtain a median matrix;
calculating a secondary small value in the column direction in the average value matrix to obtain a secondary small value matrix;
and searching columns of the scenery parallel to the edge of the column direction through the comparison of the median matrix and the second-smallest-value matrix, and setting 0 at the corresponding positions of the vertical stripe matrix.
Optionally, the searching for the horizontal row position suspected of having the ghost from the horizontal stripe matrix, and the performing no horizontal stripe removing process on the horizontal row position includes:
each point in the transverse stripe matrix and data positioned on the left side of the pixel of the transverse stripe matrix are averaged to obtain an average matrix;
performing row direction median filtering on the mean matrix to obtain a median matrix;
calculating a secondary small value of the row direction in the mean value matrix to obtain a secondary small value matrix;
and searching columns of the scenery parallel to the edges of the row direction through the comparison of the median matrix and the second-smallest-value matrix, and setting 0 at the corresponding position of the horizontal stripe matrix.
Optionally, the searching for the column of the scene parallel to the edge of the column direction through the comparison between the median matrix and the second smallest matrix, and setting 0 at the corresponding position of the vertical stripe matrix includes:
and through the comparison of the median matrix and the secondary small value matrix, setting 0 at the corresponding position of the vertical stripe matrix under the condition that the difference between the secondary small value matrix and the median matrix is greater than a preset value.
Optionally, the generating, according to the original image and the processed vertical stripe matrix and/or horizontal stripe matrix, an image with stripes removed includes:
and under the condition that the difference between the secondary minimum value matrix and the median matrix is not greater than the preset value, the data used for removing the stripes are the data in the corresponding median matrix.
The invention also provides a device for removing stripes of the infrared image, which comprises:
the original image acquisition module is used for acquiring an original image which is output by the infrared detector through preprocessing;
the filtering module is used for filtering the original image to obtain a filtered image;
the stripe matrix acquisition module is used for acquiring a vertical stripe matrix and/or a horizontal stripe matrix according to the original image and the filtered image;
the processing module is used for searching the vertical column/horizontal row position suspected of having the ghost from the vertical stripe matrix and/or the horizontal stripe matrix, and performing corresponding vertical stripe/horizontal stripe removing processing on the vertical column/horizontal row position;
and the de-striping module is used for generating an image with stripes removed according to the original image and the processed vertical stripe matrix and/or horizontal stripe matrix.
The present invention also provides an infrared detector, comprising:
a memory for storing a computer program;
a processor for implementing the steps of any of the above-mentioned methods for de-striping an infrared image when executing the computer program.
The present invention also provides a computer readable storage medium, having a computer program stored thereon, where the computer program is executed by a processor to implement the steps of any one of the above-mentioned methods for de-striping an infrared image.
The method for removing the stripes of the infrared image comprises the steps of obtaining an original image which is output by an infrared detector and is preprocessed; filtering the original image to obtain a filtered image; acquiring a vertical stripe matrix and/or a horizontal stripe matrix according to the original image and the filtered image; searching the vertical column/horizontal row position suspected of having ghost from the vertical stripe matrix and/or the horizontal stripe matrix, and not performing corresponding vertical stripe/horizontal stripe removing processing on the vertical column/horizontal row position; and generating an image with stripes removed according to the original image and the processed vertical stripe matrix and/or horizontal stripe matrix. According to the method and the device, the stripe removing processing is not carried out on the suspected vertical columns or horizontal rows of the ghost, the problems that the ghost is easy to appear in the infrared image after the stripe removing processing is carried out on the infrared image and the edge is fuzzy can be solved, and the image quality of the infrared imaging is improved. In addition, the application also provides an infrared image de-striping device, an infrared detector and a computer readable storage medium with the technical effects.
Drawings
In order to more clearly illustrate the embodiments or technical solutions of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained based on these drawings without creative efforts.
FIG. 1 is a first image after a prior art de-striping of an infrared image;
FIG. 2 is a second image after de-striping an existing IR image;
FIG. 3 is a flowchart of one embodiment of a method for de-striping an infrared image according to the present invention;
fig. 4 is a specific flowchart for searching for a vertical column position suspected of having a ghost from the vertical stripe matrix, where vertical stripe removing processing is not performed on the vertical column position;
FIG. 5 is a flow chart of another embodiment of a method for de-striping an infrared image provided herein;
FIG. 6 is a schematic diagram of an image of an original;
FIG. 7 is a diagram illustrating the effect of de-striping using only median filtering (colStripe1) on an original image;
FIG. 8 is a diagram illustrating the effect of vertical striping on an original image using a general averaging method;
FIG. 9 is a diagram illustrating the effect of vertical striping using only the next smallest value (colStripe3) on an original image;
FIG. 10 is a schematic diagram illustrating an effect of removing vertical stripes from an original image according to the present application;
FIG. 11 is a schematic diagram of imaging of a second original;
fig. 12 is a schematic diagram illustrating the effect of vertical striping only by using a median filtering method (colStripe1) on the original image two;
FIG. 13 is a schematic diagram illustrating the effect of vertical striping using a general averaging method for the second original drawing;
fig. 14 is a schematic diagram illustrating the effect of vertical striping using only the second smallest value (colStripe3) on the original image two;
FIG. 15 is a schematic diagram illustrating the effect of the second original image after vertical stripes are removed according to the present application;
FIG. 16 is a schematic diagram of three imaging of an original;
fig. 17 is a schematic diagram illustrating the effect of vertical striping only by using a median filter method (colStripe1) on an original image three;
FIG. 18 is a schematic diagram illustrating the effect of vertical striping in the conventional averaging method for the original drawing III;
fig. 19 is a schematic diagram showing the effect of vertical striping using only the second smallest value (colStripe3) for the original three;
FIG. 20 is a schematic diagram illustrating the effect of the third original image after vertical stripes are removed according to the present application;
FIG. 21 is a schematic view of imaging of an original image four;
fig. 22 is a schematic diagram illustrating the effect of vertical striping only by using a median filter method (colStripe1) on the original image four;
FIG. 23 is a schematic diagram illustrating the effect of vertical striping in the conventional averaging method for the original image IV;
fig. 24 is a schematic diagram showing the effect of vertical striping of original four using only the second smallest value (colStripe 3);
FIG. 25 is a schematic diagram illustrating the effect of the fourth original image after vertical striping is performed;
fig. 26 is a block diagram of an apparatus for de-striping an infrared image according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the disclosure, the invention will be described in further detail with reference to the accompanying drawings and specific embodiments. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
A flowchart of an embodiment of a method for removing stripes from an infrared image according to the present invention is shown in fig. 3, and the method includes:
step S101: acquiring an original image output by an infrared detector and subjected to preprocessing;
in this embodiment, the obtaining of the original image output by the infrared detector specifically includes: and acquiring an image after two-point value correction as the original image.
It should be noted that, in the embodiment of the present application, performing two-point value correction on an image can perform an image denoising effect, and ensure the imaging quality of the later image. Other pre-processing for denoising purposes is possible, and is not limited to this. As a specific implementation manner, after the infrared detector outputs an image, the image may be subjected to two-point value correction and blind pixel replacement to be used as the original image.
Step S102: filtering the original image to obtain a filtered image;
in the step, the original image is filtered, so that the original image can be subjected to a stripe removing effect. Specifically, a vertical stripe filter may be used to filter the original image, and a filtered image, that is, an image with vertical stripes removed, is obtained. Of course, other filters may be used to filter the original image, and the filter is not limited to the vertical stripe filter, and any other filter capable of removing the vertical stripe effect may be used.
Similarly, the original image may be filtered by using a horizontal stripe filter, and a filtered image, that is, an image after the horizontal stripes are removed, is obtained. The original image can be filtered by adopting other filters, the filter is not limited to a horizontal stripe filter, and other filters capable of removing horizontal stripes can be adopted.
Step S103: acquiring a vertical stripe matrix and/or a horizontal stripe matrix according to the original image and the filtered image;
specifically, the original image and the image from which the vertical stripes are removed are subjected to difference processing, so that a vertical stripe matrix can be obtained. And performing difference processing on the original image and the image with the horizontal stripes removed to obtain a horizontal stripe matrix.
Step S104: searching the vertical column/horizontal row position suspected of having ghost from the vertical stripe matrix and/or the horizontal stripe matrix, and not performing corresponding vertical stripe/horizontal stripe removing processing on the vertical column/horizontal row position;
referring to fig. 4, a specific flowchart for searching for a vertical column position suspected of having a ghost from the vertical stripe matrix and not performing vertical stripe removing processing on the vertical column position is provided in the present application, in step S104 in the present application, the following steps may be specifically included for a vertical stripe:
step S1041: each point in the vertical stripe matrix and the data above the pixel of the point calculate an average value to obtain an average value matrix;
and each pixel point in the vertical stripe matrix is added with a pixel above the pixel of the pixel point and the average value is calculated to obtain a mean value matrix. That is, the image data of the ith row and the jth column of the vertical stripe matrix and the pixels of the 1 st row to the jth column of the i-1 th row above are averaged to obtain an average matrix. Of course, there may be i-1-n to i-1 lines; each column can also be segmented, for example, 1 mean value is calculated for 10 consecutive groups, 10 groups are taken in total, discontinuity can be caused between 10 groups, and then the median value and the second smallest value of the column are removed, so that low resource usage is realized. It should be noted that the method for obtaining the average value in this step may be all the upper data, or n adjacent continuous data above, which does not affect the implementation of this application.
Step S1042: performing column direction median filtering on the mean matrix to obtain a median matrix;
it can be understood that the median filtering performed on the mean matrix in the present application may be equivalent median filtering, which does not affect the implementation of the present application.
Step S1043: calculating a secondary small value in the column direction in the average value matrix to obtain a secondary small value matrix;
specifically, the values in each column of the mean matrix may be sorted, and the minimum value of the sorted values may be used as the second smallest value matrix. And when the second minimum value matrix is the 3-time minimum value matrix, taking the third last minimum value as the 3-time minimum value matrix. The second minimum matrix may be a 1-time minimum, or may be a 2-time, 3-time, 4-time, or 5-time minimum.
Step S1044: and searching columns of the scenery parallel to the edge of the column direction through the comparison of the median matrix and the second-smallest-value matrix, and setting 0 at the corresponding positions of the vertical stripe matrix.
And through the comparison of the median matrix and the secondary minimum matrix, setting 0 at the corresponding position of the vertical stripe matrix under the condition that the difference between the secondary minimum matrix and the median matrix is greater than a preset value, and using data in a median filter or an equivalent median filter matrix at other positions. Under the condition that the difference between the sub-minimum matrix and the median matrix is not greater than the preset value, data used for removing the stripes are data in the corresponding median matrix, so that the edge blurring of the flagpole caused by mean filtering can be avoided, and the imaging quality of the infrared image is further improved.
As a specific embodiment, the sub-minimum matrix may be a 3-time minimum matrix, and the preset value may be 2. Of course, other values can be taken, which do not affect the implementation of the present application.
It should be noted that the present application may be directed to removing not only vertical stripes, but also horizontal stripes. The process of removing the horizontal stripes may specifically include: each point in the horizontal stripe matrix and data positioned on the left side of the pixel of the point calculate an average value to obtain an average value matrix; performing row direction median filtering on the mean matrix to obtain a median matrix; calculating a secondary small value of the row direction in the mean value matrix to obtain a secondary small value matrix; and searching columns of the scenery parallel to the edges of the row direction through the comparison of the median matrix and the second-smallest-value matrix, and setting 0 at the corresponding position of the horizontal stripe matrix. The averaging method may be all left data or n adjacent left continuous data. Likewise, the second minimum matrix may be 1 minimum, or may be 2, 3, 4, or 5. The above process only describes the removal of the vertical stripes in detail, and for the removal of the horizontal stripes, reference may be made to an embodiment of a method for removing the vertical stripes, and specific processes are not described herein again.
Step S105: and generating an image with stripes removed according to the original image and the processed vertical stripe matrix and/or horizontal stripe matrix.
And (4) making a difference value between the original image and the processed vertical stripe matrix or horizontal stripe to generate an image with the stripes removed.
The method for removing the stripes of the infrared image comprises the steps of obtaining an original image which is output by an infrared detector and is preprocessed; filtering the original image to obtain a filtered image; acquiring a vertical stripe matrix and/or a horizontal stripe matrix according to the original image and the filtered image; searching the vertical column/horizontal row position suspected of having ghost from the vertical stripe matrix and/or the horizontal stripe matrix, and not performing corresponding vertical stripe/horizontal stripe removing processing on the vertical column/horizontal row position; and generating an image with stripes removed according to the original image and the processed vertical stripe matrix and/or horizontal stripe matrix. According to the method and the device, the stripe removing processing is not carried out on the suspected vertical columns or horizontal rows of the ghost, the problems that the ghost is easy to appear in the infrared image after the stripe removing processing is carried out on the infrared image and the edge is fuzzy can be solved, and the image quality of the infrared imaging is improved.
Another specific embodiment of the method for removing stripes from an infrared image provided by the present application is shown in fig. 5, where the process includes:
step S201: acquiring an image x after two-point value correction;
step S202: filtering the image x through a vertical stripe filter to obtain a filtered image f (x);
step S203: acquiring a vertical stripe matrix c ═ x-f (x);
step S204: averaging each point in the vertical stripe matrix and the pixels above to obtain a mean matrix v;
and averaging each point in the vertical stripes with pixels positioned above the point in the same column to obtain an average matrix.
Step S205: in the column direction, solving a median matrix colStripe1 and a 3-time small value matrix colStripe3 of points below 10 rows of the v matrix;
in this embodiment, the V matrix performs median processing on the points from the 5 th row to the bottom row to obtain a median matrix. The points from row 1 to row 5 are not subjected to median processing, because the amount of the first 5 rows of data is small, and the obtained average value is not suitable to be used as an effective value in the v matrix.
Step S206: the column with the difference between the secondary small value matrix and the median matrix larger than 2 is set to 0 at the corresponding position of colStripe 1;
step S207: de-perpendicularized images were generated from x-colStripe 1.
FIG. 6 shows a schematic view of an image of an original; fig. 7 shows an effect diagram of de-striping original image only using median filtering (colStripe 1); FIG. 8 is a diagram illustrating the effect of vertical striping on an original image using a general averaging method; FIG. 9 is a diagram illustrating the effect of striping original image using only the next smallest value (colStripe 3); fig. 10 shows a schematic diagram of the effect of the present application on an original image after vertical striping. As is evident from a comparison of fig. 6-10, the image quality is higher after vertical striping using the present application.
Figures 11-15 compare the de-erections of poles with vertical poles (poles occupy most of the rows). Fig. 11 shows a schematic diagram of the imaging of the original image two; fig. 12 is a schematic diagram illustrating the effect of de-striping only the median filtering mode (colStripe1) on the original image two; FIG. 13 is a diagram illustrating the effect of using a general averaging approach to vertical striping for original two; fig. 14 shows an effect diagram of the original image after vertical striping using only the second smallest value (colStripe 3); fig. 15 is a schematic diagram showing the effect of the second original image after vertical striping according to the present application. As is evident from a comparison of fig. 11-15, the image quality is higher after vertical striping using the present application.
Figures 16-20 compare the de-erections of poles with vertical poles (poles in partial rows). Fig. 16 shows a schematic diagram of the original image three-shot imaging; fig. 17 is a schematic diagram illustrating the effect of de-striping original image three by using only the median filtering method (colStripe 1); FIG. 18 is a schematic diagram illustrating the effect of vertical striping using a general averaging method on the original image III; fig. 19 is a diagram illustrating the effect of vertical striping using only the next smallest value (colStripe3) for the original three; fig. 20 is a schematic diagram showing the effect of the third original image after vertical striping according to the present invention. As is evident from a comparison of fig. 16-20, the image quality is higher after vertical striping using the present application.
Figures 21-25 compare the de-erector effect of a pole with a vertical pole (the pole is full). Wherein, fig. 21 shows a schematic diagram of the original image four; fig. 22 is a schematic diagram illustrating the effect of de-striping original image four by using only the median filtering method (colStripe 1); FIG. 23 is a schematic diagram illustrating the effect of using a general averaging method to de-vertical stripes on the original image four; fig. 24 is a diagram illustrating the effect of vertical striping using only the next smallest value (colStripe3) for original four; fig. 25 is a schematic diagram showing the effect of the vertical striping of the present application on the original image four. As is evident from a comparison of fig. 21-25, the image quality is higher after vertical striping using the present application.
The following describes an infrared image de-striping apparatus provided in an embodiment of the present invention, and the infrared image de-striping apparatus described below and the infrared image de-striping method described above may be referred to in correspondence.
Fig. 26 is a block diagram of an apparatus for removing stripes from an infrared image according to an embodiment of the present invention, where the apparatus for removing stripes from an infrared image according to fig. 26 may include:
an original image obtaining module 100, configured to obtain an original image output by an infrared detector;
a filtering module 200, configured to filter the original image to obtain a filtered image;
a stripe matrix obtaining module 300, configured to obtain a vertical stripe matrix and/or a horizontal stripe matrix according to the original image and the filtered image;
the processing module 400 is configured to search a vertical column position suspected of having a ghost from the vertical stripe matrix and/or the horizontal stripe matrix, and not perform vertical stripe removal and/or horizontal stripe processing on the vertical column position;
and a de-striping module 500, configured to generate a de-striped image according to the original image and the processed vertical stripe matrix and/or horizontal stripe matrix.
The device for removing the infrared image fringe in this embodiment is used to implement the foregoing method for removing the infrared image fringe, and therefore a specific implementation manner of the device for removing the infrared image fringe may be found in the foregoing embodiment parts of the method for removing the infrared image fringe, for example, the original image obtaining module 100, the filtering module 200, the fringe matrix obtaining module 300, the processing module 400, and the fringe removing module 500 are respectively used to implement steps S101, S102, S103, S104, and S105 in the method for removing the infrared image fringe, so that the specific implementation manner thereof may refer to descriptions of corresponding respective part embodiments, and is not described herein again.
The present invention also provides an infrared detector, comprising:
a memory for storing a computer program;
a processor for implementing the steps of any of the above-mentioned methods for de-striping an infrared image when executing the computer program.
The present invention also provides a computer readable storage medium, having a computer program stored thereon, where the computer program is executed by a processor to implement the steps of any one of the above-mentioned methods for de-striping an infrared image.
The infrared detector and the computer-readable storage medium provided by the present application correspond to the above-mentioned method for removing stripes from an infrared image, and the detailed description thereof may refer to the description of each corresponding partial embodiment, which is not repeated herein.
In conclusion, the method and the device have the advantages that the stripe removing processing is not carried out on the vertical column position where the ghost is suspected to appear, the problems that the ghost appears easily in the infrared image and the edge is fuzzy after the stripe removing processing is carried out on the infrared image in the prior art can be solved, and the image quality of the infrared imaging is improved.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The method, the device, the infrared detector and the computer readable storage medium for removing the stripes of the infrared image provided by the invention are described in detail above. The principles and embodiments of the present invention are explained herein using specific examples, which are presented only to assist in understanding the method and its core concepts. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present invention.