An image processing method and device for an infrared image and an electronic device
By combining the time domain and spatial domain methods to detect and compensate for the horizontal stripes in the infrared image, the problem of horizontal stripes in the infrared image after the sensor array is impacted is solved, and efficient horizontal stripe removal and image quality improvement are achieved.
Patent Information
- Application Number
- CN202310704200.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-14
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2043-06-14
AI Technical Summary
It is difficult to effectively remove horizontal stripes in infrared images with existing technologies, especially the striped non-uniform noise generated when the sensor array is subjected to a strong impact.
A method combining time domain and spatial domain is used to detect horizontal stripes. By acquiring the target infrared image, the previous frame image and the filtered difference image, horizontal stripe detection is performed in the time domain and spatial domain respectively. When the detection results all indicate the presence of horizontal stripes, image compensation is performed, including the use of multiple filters for filtering and compensation.
The accuracy of horizontal stripe detection and the comprehensiveness of image compensation are improved, ensuring the improvement of image quality and avoiding the loss of details of images without horizontal stripes.
Smart Images

Figure CN116777775B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of infrared image processing, in particular to an image processing method and device for an infrared image and an electronic device. BACKGROUND
[0002] As an important technology of imaging system, infrared thermal imaging currently usually adopts a sensor array for imaging. With the improvement of sensor process level and the continuous improvement of application requirements, the pixel scale of the sensor array has been expanded to millions of units.
[0003] However, due to the manufacturing materials, process, circuit, equipment form and use environment of the sensor array, after being subjected to a strong impact for a short time, the infrared image obtained by the sensor array for imaging will have horizontal lines. For example, an infrared camera is provided on a gun, and when the gun is fired, the sensor array in the infrared camera is subjected to a strong impact, resulting in horizontal lines in the infrared image obtained by the sensor array for imaging. The horizontal lines can be understood as a kind of striped non-uniform noise appearing in the infrared image.
[0004] Objective, there is an urgent need for an image processing method for an infrared image, so as to effectively remove the horizontal lines of the infrared image with horizontal lines. SUMMARY
[0005] The purpose of the embodiments of the present application is to provide an image processing method, device and electronic device for an infrared image, which can effectively remove the horizontal lines of the infrared image with horizontal lines. The specific technical solutions are as follows:
[0006] In a first aspect, the embodiments of the present application provide an image processing method for an infrared image, comprising:
[0007] obtaining a first difference image and a second difference image corresponding to a target infrared image to be processed; wherein the first difference image is a difference image of the target infrared image and a corresponding previous frame image, and the second difference image is a difference image of the target infrared image and a target infrared image after filtering processing;
[0008] determining a detection result of the target infrared image on whether there are horizontal lines based on the pixel values of each pixel point of the first difference image, to obtain a detection result in the time domain dimension;
[0009] determining a detection result of the target infrared image on whether there are horizontal lines based on the pixel values of each pixel point of the second difference image, to obtain a detection result in the spatial domain dimension;
[0010] If both the detection result in the time domain dimension and the detection result in the spatial domain dimension indicate the presence of horizontal stripes, performing image compensation on the target infrared image in the time domain dimension to obtain an intermediate image;
[0011] Image compensation is performed on the intermediate image in a spatial dimension to obtain an image corresponding to the target infrared image after removing horizontal stripes.
[0012] Optionally, determining a detection result of whether horizontal stripes exist in the target infrared image based on the pixel value of each pixel point of the first difference image to obtain a detection result in the time domain dimension includes:
[0013] Based on the pixel value of each pixel point of the first difference image, detecting whether the first difference image has horizontal stripes to obtain a first detection result;
[0014] If the first detection result indicates the presence of horizontal stripes, setting the detection result of the target infrared image regarding the presence of horizontal stripes as the presence of horizontal stripes, thereby obtaining a detection result in the time domain dimension;
[0015] If the first detection result indicates that there are no horizontal stripes, the detection result of the target infrared image regarding whether there are horizontal stripes is set to no horizontal stripes, thereby obtaining a detection result in the time domain dimension.
[0016] Optionally, determining a detection result of whether horizontal stripes exist in the target infrared image based on the pixel value of each pixel point of the second difference image to obtain a detection result in a spatial dimension includes:
[0017] Based on the pixel value of each pixel point of the second difference image, detecting whether the second difference image has horizontal stripes to obtain a second detection result;
[0018] If the second detection result indicates the presence of horizontal stripes, setting the detection result of the target infrared image regarding the presence of horizontal stripes as the presence of horizontal stripes, thereby obtaining a detection result in the spatial dimension;
[0019] If the second detection result indicates that there are no horizontal stripes, the detection result of the target infrared image regarding whether there are horizontal stripes is set to no horizontal stripes, thereby obtaining a detection result in the spatial dimension.
[0020] Optionally, the detecting whether horizontal stripes exist in the first difference image based on the pixel value of each pixel point of the first difference image to obtain a first detection result includes:
[0021] Determining a pixel type of each pixel of the first difference image based on a pixel value of each pixel of the first difference image; wherein the pixel type includes a first type or a second type, the first type and the second type of pixels have different brightness levels, and the brightness of the first type of pixels is higher than that of the second type of pixels;
[0022] Counting the number of pixel rows meeting the horizontal stripe condition in the first difference image according to the pixel type of each pixel point in the first difference image as a first row number;
[0023] If the first number of lines is greater than a preset first line number threshold, the presence of horizontal stripes in the first difference image is determined as a first detection result; otherwise, the absence of horizontal stripes in the first difference image is determined as a first detection result.
[0024] Optionally, determining the pixel type of each pixel point in the first difference image according to the pixel value of each pixel point in the first difference image includes:
[0025] For each pixel of the first difference image, if a pixel value of the pixel satisfies a first condition, determining the pixel type of the pixel is the first type; if the pixel value of the pixel satisfies a second condition, determining the pixel type of the pixel is the second type;
[0026] The first condition is that the pixel value is greater than a first pixel threshold, and the second condition is that the pixel value is less than the opposite number of the first pixel threshold.
[0027] Optionally, counting the number of pixel rows meeting the horizontal stripe condition in the first difference image according to the pixel type of each pixel point in the first difference image as the first row number includes:
[0028] For each pixel row of the first difference image, summing the first reference values corresponding to each designated pixel point in the pixel row to obtain a first calculation result, and if the obtained first calculation result is greater than a first result threshold, determining that the pixel row is a pixel row belonging to a bright stripe; if the obtained first calculation result is less than the opposite of the first result threshold, determining that the pixel row is a pixel row belonging to a dark stripe;
[0029] Based on the determined pixel rows belonging to the bright stripes and the pixel rows belonging to the dark stripes, determining the number of pixel rows in the first difference image that meet the horizontal stripe condition as a first row number;
[0030] Among them, the designated pixel points are pixel points with pixel types, and the first reference value corresponding to each designated pixel point is the characterization value of the pixel type of the pixel point. The characterization value of the first type is a positive number, and the characterization value of the second type is the opposite of the characterization value of the first type.
[0031] Optionally, determining the number of pixel rows that meet the horizontal stripe condition in the first difference image based on the determined pixel rows belonging to the bright stripes and the determined pixel rows belonging to the dark stripes as a number of pixel rows includes:
[0032] Correction processing is performed on the pixel rows determined to be bright stripes and the pixel rows determined to be dark stripes according to a predetermined correction processing method; wherein the correction processing method includes: if there are adjacent pixel rows among the pixel rows determined to be bright stripes, merging the adjacent pixel rows to obtain a pixel row belonging to the bright stripes; and / or, if there are adjacent pixel rows among the pixel rows determined to be dark stripes, merging the adjacent pixel rows to obtain a pixel row belonging to the dark stripes;
[0033] After the correction process, the total number of pixel rows belonging to bright stripes and the total number of pixel rows belonging to dark stripes are calculated to obtain the number of pixel rows meeting the horizontal stripe condition in the first difference image as the first row number.
[0034] Optionally, the detecting whether horizontal stripes exist on the second difference image based on the pixel value of each pixel point of the second difference image to obtain a second detection result includes:
[0035] Determining a pixel type of each pixel of the second difference image based on a pixel value of each pixel of the second difference image; wherein the pixel type includes a first type or a second type, the first type and the second type of pixels have different brightness levels, and the brightness of the first type of pixels is higher than that of the second type of pixels;
[0036] Counting the number of pixel rows meeting the horizontal stripe condition in the second difference image according to the pixel type of each pixel point in the second difference image as a second row number;
[0037] If the second number of lines is greater than a preset second line number threshold, the presence of horizontal stripes in the second difference image is determined as a second detection result; otherwise, the absence of horizontal stripes in the second difference image is determined as a second detection result.
[0038] Optionally, determining the pixel type of each pixel point in the second difference image according to the pixel value of each pixel point in the second difference image includes:
[0039] For each pixel of the second difference image, if a pixel value of the pixel satisfies a third condition, determining the pixel type of the pixel is the first type; if the pixel value of the pixel satisfies a fourth condition, determining the pixel type of the pixel is the second type;
[0040] The third condition is that the pixel value is greater than the second pixel threshold, and the fourth condition is that the pixel value is less than the opposite number of the second pixel threshold.
[0041] Optionally, counting the number of pixel rows meeting the horizontal stripe condition in the second difference image according to the pixel type of each pixel point in the second difference image as the second row number includes:
[0042] For each pixel row of the second difference image, summing the first reference values corresponding to each designated pixel point in the pixel row to obtain a second calculation result, and if the second calculation result is greater than a second result threshold, determining that the pixel row is a pixel row belonging to a bright stripe; and if the second calculation result is less than the inverse of the second result threshold, determining that the pixel row is a pixel row belonging to a dark stripe;
[0043] Based on the determined pixel rows belonging to the bright stripes and the determined pixel rows belonging to the dark stripes, determining the number of pixel rows in the second difference image that meet the horizontal stripe condition as a second number of rows;
[0044] Among them, the designated pixel points are pixel points with pixel types, and the first reference value corresponding to each designated pixel point is the characterization value of the pixel type of the pixel point. The characterization value of the first type is a positive number, and the characterization value of the second type is the opposite of the characterization value of the first type.
[0045] Optionally, determining the number of pixel rows that meet the horizontal stripe condition in the second difference image based on the determined pixel rows belonging to the bright stripes and the determined pixel rows belonging to the dark stripes as the second number of rows includes:
[0046] Correction processing is performed on the pixel rows determined to be bright stripes and the pixel rows determined to be dark stripes according to a predetermined correction processing method; wherein the correction processing method includes: if there are adjacent pixel rows among the pixel rows determined to be bright stripes, merging the adjacent pixel rows to obtain a pixel row belonging to the bright stripes; and / or, if there are adjacent pixel rows among the pixel rows determined to be dark stripes, merging the adjacent pixel rows to obtain a pixel row belonging to the dark stripes;
[0047] After the correction process, the total number of pixel rows belonging to bright stripes and the total number of pixel rows belonging to dark stripes are calculated to obtain the number of pixel rows meeting the horizontal stripe condition in the second difference image as the second row number.
[0048] Optionally, performing image compensation on the target infrared image in the time domain dimension to obtain an intermediate image includes:
[0049] Filtering the first difference image based on a first filter to obtain a first backup image; wherein the first filter is a filter for removing shear waves;
[0050] determining a difference image between the first difference image and the first spare image as a first compensation image;
[0051] Filtering the first compensated image based on a second filter to obtain a first compensation value; wherein the second filter is a filter for removing vertical waves;
[0052] Based on the first compensation value, image compensation in the time domain dimension is performed on the target infrared image to obtain an intermediate image.
[0053] Optionally, performing image compensation on the intermediate image in a spatial dimension to obtain an image corresponding to the target infrared image after removing horizontal stripes includes:
[0054] filtering the intermediate image based on a third filter to obtain a second backup image, and filtering the intermediate image based on a fourth filter to obtain a third backup image; wherein the third filter and the fourth filter are filters for removing horizontal stripes from different regions of the intermediate image;
[0055] Determining a second compensated image based on the second backup image and the third backup image in a predetermined determination method; wherein the predetermined determination method includes: for each pixel point of the intermediate image, if the absolute value of the pixel value of a first pixel point corresponding to the pixel point in the second backup image is less than the absolute value of the pixel value of a second pixel point corresponding to the pixel point in the third backup image, determining an initial compensation value for the pixel point as the pixel value of the first pixel point corresponding to the pixel point; otherwise, determining the initial compensation value for the pixel point as the pixel value of the second pixel point corresponding to the pixel point, wherein both the first pixel point and the second pixel point corresponding to the pixel point are pixel points that match the position of the pixel point;
[0056] Filtering the second compensated image using a fifth filter to obtain a second compensation value; wherein the fifth filter is a filter for removing vertical waves;
[0057] Based on the second compensation value, image compensation is performed on the intermediate image in a spatial dimension to obtain an image corresponding to the target infrared image after removing horizontal stripes.
[0058] In a second aspect, an embodiment of the present application provides an image processing device for infrared images, comprising:
[0059] an acquisition module, configured to acquire a first difference image and a second difference image corresponding to the target infrared image to be processed; wherein the first difference image is a difference image between the target infrared image and the corresponding previous frame image, and the second difference image is a difference image between the target infrared image and the target infrared image after filtering;
[0060] a first determining module, configured to determine a detection result of whether horizontal stripes are present in the target infrared image based on a pixel value of each pixel point of the first difference image, and obtain a detection result in a time domain dimension;
[0061] a second determining module, configured to determine a detection result of whether horizontal stripes are present in the target infrared image based on the pixel value of each pixel point of the second difference image, and obtain a detection result in a spatial dimension;
[0062] a first image compensation module, configured to perform image compensation on the target infrared image in the time domain dimension to obtain an intermediate image if both the detection result in the time domain dimension and the detection result in the spatial domain dimension indicate the presence of horizontal stripes;
[0063] The second image compensation module is used to perform image compensation on the intermediate image in a spatial dimension to obtain an image corresponding to the target infrared image after removing horizontal stripes.
[0064] Optionally, the first determining module includes:
[0065] a first detection submodule, configured to detect whether horizontal stripes are present in the first difference image based on the pixel value of each pixel point in the first difference image, and obtain a first detection result;
[0066] a first setting submodule, configured to set the detection result of the target infrared image regarding whether horizontal stripes exist as the presence of horizontal stripes if the first detection result indicates the presence of horizontal stripes, thereby obtaining a detection result in a time domain dimension;
[0067] a second setting submodule, configured to set the detection result of the target infrared image regarding the presence of horizontal stripes to the absence of horizontal stripes if the first detection result indicates that there are no horizontal stripes, thereby obtaining a detection result in the time domain dimension;
[0068] Optionally, the second determining module includes:
[0069] a second detection submodule, configured to detect whether horizontal stripes are present in the second difference image based on the pixel value of each pixel point in the second difference image, and obtain a second detection result;
[0070] a third setting submodule, configured to set the detection result of the target infrared image regarding whether horizontal stripes exist as the presence of horizontal stripes if the second detection result indicates the presence of horizontal stripes, thereby obtaining a detection result in a spatial dimension;
[0071] a fourth setting submodule, configured to set the detection result of the target infrared image regarding the presence of horizontal stripes to the absence of horizontal stripes if the second detection result indicates that there are no horizontal stripes, thereby obtaining a detection result in a spatial dimension;
[0072] Optionally, the first detection submodule includes:
[0073] a first determining unit, configured to determine a pixel type of each pixel of the first difference image based on a pixel value of each pixel of the first difference image; wherein the pixel type includes a first type or a second type, the first type and the second type of pixels have different brightness levels, and the brightness of the first type of pixels is higher than that of the second type of pixels;
[0074] a first counting unit, configured to count, according to a pixel type of each pixel point in the first difference image, the number of pixel rows meeting a horizontal stripe condition in the first difference image as a first row number;
[0075] a second determining unit, configured to determine the presence of horizontal stripes in the first difference image as a first detection result if the first number of lines is greater than a preset first line number threshold, and otherwise determine the absence of horizontal stripes in the first difference image as the first detection result;
[0076] Optionally, the first determining unit includes:
[0077] a first determining subunit, configured to, for each pixel of the first difference image, determine that the pixel type of the pixel is the first type if a pixel value of the pixel satisfies a first condition, and determine that the pixel type of the pixel is the second type if the pixel value of the pixel satisfies a second condition;
[0078] The first condition is that the pixel value is greater than a first pixel threshold, and the second condition is that the pixel value is less than the opposite number of the first pixel threshold.
[0079] Optionally, the first statistical unit includes:
[0080] a first summing subunit, configured to sum, for each pixel row of the first difference image, first reference values corresponding to designated pixels in the pixel row to obtain a first calculation result, and if the first calculation result is greater than a first result threshold, determine that the pixel row is a pixel row belonging to a bright stripe; and if the first calculation result is less than the opposite of the first result threshold, determine that the pixel row is a pixel row belonging to a dark stripe;
[0081] a second determining subunit, configured to determine, based on the determined pixel rows belonging to the bright stripes and the determined pixel rows belonging to the dark stripes, the number of pixel rows in the first difference image that meet the horizontal stripe condition, as a first row number;
[0082] The designated pixel points are pixel points having a pixel type, the first reference value corresponding to each designated pixel point is a characterizing value of the pixel type of the pixel point, the characterizing value of the first type is a positive number, and the characterizing value of the second type is the opposite number of the characterizing value of the first type;
[0083] Optionally, the second determining subunit is further configured to perform correction processing on the pixel rows determined to belong to the bright stripes and the pixel rows determined to belong to the dark stripes according to a predetermined correction processing method; wherein the correction processing method includes: if there are adjacent pixel rows among the pixel rows determined to belong to the bright stripes, merging the adjacent pixel rows to obtain a pixel row belonging to the bright stripes; and / or, if there are adjacent pixel rows among the pixel rows determined to belong to the dark stripes, merging the adjacent pixel rows to obtain a pixel row belonging to the dark stripes.
[0084] After the correction process, the total number of pixel rows belonging to bright stripes and the total number of pixel rows belonging to dark stripes are calculated to obtain the number of pixel rows meeting the horizontal stripe condition in the first difference image as the first row number;
[0085] Optionally, the second detection submodule includes:
[0086] a third determining unit, configured to determine a pixel type of each pixel of the second difference image based on a pixel value of each pixel of the second difference image; wherein the pixel type includes a first type or a second type, the first type and the second type of pixels have different brightness levels, and the brightness of the first type of pixels is higher than that of the second type of pixels;
[0087] a second counting unit, configured to count, according to the pixel type of each pixel point in the second difference image, the number of pixel rows meeting the horizontal stripe condition in the second difference image as a second row number;
[0088] a fourth determining unit, configured to determine the presence of horizontal stripes in the second difference image as a second detection result if the second number of lines is greater than a preset second line number threshold, and otherwise determine the absence of horizontal stripes in the second difference image as a second detection result;
[0089] Optionally, the third determining unit includes:
[0090] a third determining sub-unit, configured to determine, for each pixel point of the second difference image, a pixel type of the pixel point as the first type if a pixel value of the pixel point satisfies a third condition, and determine the pixel type of the pixel point as the second type if the pixel value of the pixel point satisfies a fourth condition;
[0091] wherein the third condition is greater than a second pixel threshold, and the fourth condition is less than an opposite of the second pixel threshold;
[0092] Optionally, the second statistical unit comprises:
[0093] a second summing sub-unit, configured to sum up the first reference values corresponding to each specified pixel point in each pixel row of the second difference image to obtain a second calculation result, and determine that the pixel row belongs to a bright stripe if the obtained second calculation result is greater than a second result threshold, and determine that the pixel row belongs to a dark stripe if the obtained second calculation result is less than an opposite of the second result threshold;
[0094] a fourth determining sub-unit, configured to determine, as a second row number, a number of pixel rows satisfying a cross stripe condition in the second difference image based on the pixel rows determined to belong to the bright stripe and the pixel rows determined to belong to the dark stripe;
[0095] wherein the specified pixel point is a pixel point having a pixel type, the first reference value corresponding to each specified pixel point is a representation value of the pixel type of the pixel point, the representation value of the first type is a positive number, and the representation value of the second type is an opposite of the representation value of the first type;
[0096] Optionally, the fourth determining sub-unit is further configured to perform a correction processing on the pixel rows determined to belong to the bright stripe and the pixel rows determined to belong to the dark stripe according to a predetermined correction processing mode, and the correction processing mode comprises: performing pixel row merging on adjacent pixel rows in the pixel rows determined to belong to the bright stripe to obtain a pixel row belonging to the bright stripe, and / or performing pixel row merging on adjacent pixel rows in the pixel rows determined to belong to the dark stripe to obtain a pixel row belonging to the dark stripe.
[0097] After the correction processing, a total number of the pixel rows belonging to the bright stripe and the pixel rows belonging to the dark stripe is calculated to obtain the number of the pixel rows satisfying the cross stripe condition in the second difference image as the second row number.
[0098] Optionally, the first image compensation module comprises:
[0099] A first filtering submodule is configured to filter the first difference image based on a first filter to obtain a first backup image; wherein the first filter is a filter for removing shear waves;
[0100] a first determining submodule, configured to determine a difference image between the first difference image and the first spare image as a first compensation image;
[0101] A second filtering submodule is configured to filter the first compensated image based on a second filter to obtain a first compensation value; wherein the second filter is a filter for removing vertical waves;
[0102] A first image compensation submodule is configured to perform image compensation in the time domain dimension on the target infrared image based on the first compensation value to obtain an intermediate image;
[0103] Optionally, the second image compensation module includes:
[0104] a third filtering submodule, configured to filter the intermediate image using a third filter to obtain a second backup image, and to filter the intermediate image using a fourth filter to obtain a third backup image; wherein the third filter and the fourth filter are filters for removing horizontal stripes from different regions of the intermediate image;
[0105] a second determining submodule, configured to determine a second compensated image based on the second backup image and the third backup image in a predetermined determining manner; wherein the predetermined determining manner includes: for each pixel point of the intermediate image, if the absolute value of the pixel value of a first pixel point corresponding to the pixel point in the second backup image is less than the absolute value of the pixel value of a second pixel point corresponding to the pixel point in the third backup image, determining an initial compensation value of the pixel point as the pixel value of the first pixel point corresponding to the pixel point; otherwise, determining the initial compensation value of the pixel point as the pixel value of the second pixel point corresponding to the pixel point, wherein both the first pixel point and the second pixel point corresponding to the pixel point are pixel points that match the position of the pixel point;
[0106] a fourth filtering submodule, configured to filter the second compensated image using a fifth filter to obtain a second compensation value; wherein the fifth filter is a filter for removing vertical waves;
[0107] The second image compensation submodule is configured to perform image compensation on the intermediate image in a spatial dimension based on the second compensation value to obtain an image corresponding to the target infrared image after removing horizontal stripes.
[0108] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0109] Memory for storing computer programs;
[0110] The processor is configured to implement any of the above-mentioned image processing methods for infrared images when executing the program stored in the memory.
[0111] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements any of the above-mentioned image processing methods for infrared images.
[0112] Beneficial effects of the embodiments of the present application:
[0113] The image processing method for infrared images provided in the embodiment of the present application can obtain a first difference image and a second difference image corresponding to the target infrared image to be processed, determine the detection result of whether the target infrared image has horizontal stripes based on the pixel value of each pixel point of the first difference image, and obtain the detection result in the time domain dimension, and determine the detection result of whether the target infrared image has horizontal stripes based on the pixel value of each pixel point of the second difference image, and obtain the detection result in the spatial domain dimension. If the detection result in the time domain dimension and the detection result in the spatial domain dimension both indicate the presence of horizontal stripes, image compensation is performed on the target infrared image in the time domain dimension to obtain an intermediate image, and then image compensation is performed on the intermediate image in the spatial domain dimension to obtain an image corresponding to the target infrared image after removing the horizontal stripes. It can be seen that the embodiment of the present application adopts a method of combining the time domain dimension and the spatial domain dimension to perform horizontal stripe detection, which can ensure the accuracy of the horizontal stripe detection result; and when both the time domain dimension and the spatial domain dimension indicate the presence of horizontal stripes, image compensation is performed on the target infrared image in the time domain dimension and the spatial domain dimension, making the compensation more comprehensive and accurate. Therefore, the method of combining horizontal stripe detection with image compensation adopted in the embodiment of the present application can effectively remove horizontal stripes from infrared images containing horizontal stripes.
[0114] In addition, performing horizontal stripe detection on the first difference image and the second difference image can also avoid loss of details of images without horizontal stripes, thereby greatly improving the image quality of the image after image compensation.
[0115] Of course, it is not necessary to achieve all the advantages described above at the same time when implementing any product or method of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0116] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other embodiments can also be obtained based on these drawings.
[0117] Figure 1 A flowchart of an image processing method for infrared images provided in an embodiment of the present application;
[0118] Figure 2 A schematic flow chart of a time-domain image compensation method provided in an embodiment of the present application;
[0119] Figure 3 A schematic flow chart of a spatial dimension image compensation method provided in an embodiment of the present application;
[0120] Figure 4 A flowchart of another image processing method for infrared images provided in an embodiment of the present application;
[0121] Figure 5 A schematic structural diagram of an image processing device for infrared images provided in an embodiment of the present application;
[0122] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0123] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field based on this application are within the scope of protection of this application.
[0124] Below, the professional terms involved in the embodiments of this application are first introduced:
[0125] Infrared image: an image formed by an infrared remote sensor receiving infrared rays reflected from or emitted by the ground.
[0126] Horizontal streaks: A type of striped non-uniform noise that appears in infrared images. Horizontal streaks caused by strong impacts can also be called impact streaks. Impact streaks are characterized by large numbers, varying widths, and high intensity.
[0127] In order to better understand this solution, before introducing the solution provided by the embodiments of the present application, a brief introduction to the image processing method for infrared images in the prior art is given:
[0128] Impact streaks are numerous, vary in width, and are highly intense. At the moment of firing, hundreds of grayscale differences may appear. Therefore, image noise reduction is often required. However, due to the characteristics of impact streaks, conventional noise reduction algorithms are difficult to remove them. Existing image processing methods use spatial domain removal followed by temporal domain removal, but this method can only remove narrow streaks with low noise intensity. Other existing methods use multi-frame temporal domain removal, but this method also fails to remove streaks with high noise intensity, and is susceptible to the impact of usage scenarios.
[0129] Based on the problems existing in the related art, the embodiments of the present application provide an image processing method, device and electronic device for infrared images, which can effectively remove horizontal stripes from infrared images containing horizontal stripes.
[0130] The following is an introduction to an image processing method for infrared images provided in an embodiment of the present application.
[0131] The image processing method for infrared images provided in the embodiments of the present application can be applied to electronic devices. In specific applications, the electronic device can be a terminal device or a server. For example, the terminal device can be a computer device, an infrared camera, etc. The embodiments of the present application do not limit the specific form of the electronic device.
[0132] Specifically, the execution entity of the image processing method for infrared images may be an image processing device for infrared images. Exemplarily, when the image processing method for infrared images is applied to a terminal device, the image processing device for infrared images may be a client running on the terminal device, and the client may be used to remove horizontal streaks from infrared images. Exemplarily, when the image processing method for infrared images is applied to a server, the image processing device for infrared images may be a computer program running on the server, and the computer program may be used to remove horizontal streaks from infrared images.
[0133] The image processing method for infrared images provided in the embodiment of the present application may include the following steps:
[0134] Acquire a first difference image and a second difference image corresponding to the target infrared image to be processed; wherein the first difference image is a difference image between the target infrared image and a corresponding previous frame image, and the second difference image is a difference image between the target infrared image and the target infrared image after filtering;
[0135] Determining a detection result of whether horizontal stripes exist in the target infrared image based on the pixel value of each pixel point of the first difference image, and obtaining a detection result in the time domain dimension;
[0136] Determining a detection result of whether horizontal stripes exist in the target infrared image based on the pixel value of each pixel point of the second difference image, and obtaining a detection result in a spatial dimension;
[0137] If both the detection result in the time domain dimension and the detection result in the spatial domain dimension indicate the presence of horizontal stripes, performing image compensation on the target infrared image in the time domain dimension to obtain an intermediate image;
[0138] Image compensation is performed on the intermediate image in a spatial dimension to obtain an image corresponding to the target infrared image after removing horizontal stripes.
[0139] As can be seen, the embodiment of the present application uses a method that combines the time domain and spatial domain dimensions to detect horizontal stripes, which can ensure the accuracy of the horizontal stripe detection results. Moreover, when both the time domain and spatial domain dimensions indicate the presence of horizontal stripes, image compensation is performed on the target infrared image in the time domain and spatial domain dimensions, making the compensation more comprehensive and accurate. Therefore, the method of combining horizontal stripe detection and image compensation used in the embodiment of the present application can effectively remove horizontal stripes from infrared images that contain horizontal stripes.
[0140] In addition, performing horizontal stripe detection on the first difference image and the second difference image can also avoid loss of details of images without horizontal stripes, thereby greatly improving the image quality of the image after image compensation.
[0141] An image processing method for infrared images provided by an embodiment of the present application is described below with reference to the accompanying drawings.
[0142] Figure 1 The flowchart of the image processing method for infrared images provided in the embodiment of the present application is as follows: Figure 1 As shown, the method may include steps S101-S105:
[0143] S101, obtaining a first difference image and a second difference image corresponding to a target infrared image to be processed;
[0144] The first difference image is a difference image between the target infrared image and the corresponding previous frame image, and the second difference image is a difference image between the target infrared image and the target infrared image after filtering.
[0145] It can be understood that the target infrared image is an infrared image output by the sensor array, specifically, the target infrared image is an infrared image output by the infrared sensor of the infrared focal plane array; and by subtracting the two images, a difference image can be obtained. Therefore, the first difference image is obtained by subtracting the target infrared image from the corresponding previous frame image, and the second difference image is obtained by subtracting the target infrared image from the filtered target infrared image. Since the first difference image is obtained by subtracting the infrared images of the current frame and the previous frame, that is, by subtracting different infrared images in the time domain dimension, in subsequent steps, it is possible to determine whether the target infrared image has horizontal stripes in the time domain dimension based on the first difference image; since the second difference image is obtained by subtracting the target infrared image from the filtered target infrared image, that is, by subtracting different infrared images in the spatial domain dimension, it is possible to determine whether the target infrared image has horizontal stripes in the spatial domain dimension based on the second difference image. In addition, it should be noted that for the same scene, during the imaging process of the sensor array, continuous imaging can be performed, that is, images can be continuously collected. At this time, images other than the first frame can be used as target infrared images, and the target infrared image has the previous frame image.
[0146] In addition, since the first difference image and the second difference image are both obtained by subtraction, the pixels representing the image content in the target infrared image will not be reflected in the difference image, while the horizontal stripes after subtraction can be represented. Therefore, with the help of the first difference image and the second difference image, multimodal detection and subsequent processing can be performed from the time domain and spatial domain dimensions.
[0147] Optionally, in one implementation, the generation of the first difference image and the second difference image can be expressed in the form of a formula, which is described below with reference to the formula:
[0148] Formula 1:
[0149] dif_img(i,j)=Img(i,j)-Img_pre(i,j);
[0150] Among them, dif_img(i,j) represents the first difference image, Img(i,j) represents the target infrared image, Img_pre(i,j) represents the previous frame image, 1≤i≤imgH; 1≤j≤imgW; imgH, imgW are the height and width of the target infrared image.
[0151] It can be understood that the physical meaning and value range of i and j in the subsequent formulas are consistent with those of i and j in Formula 1, so they are not described in detail in the subsequent formulas.
[0152] Among them, the first difference image, the target infrared image and the previous frame image are all matrix images. The first difference image includes the pixel value of each pixel point, so dif_img(i,j) can also be represented as the pixel value of each pixel point in the first difference image.
[0153] Formula 2:
[0154] dif_img2(i,j)=Img(i,j)-Img_h1(i,j);
[0155] Among them, dif_img2(i,j) represents the second difference image, Img(i,j) represents the target infrared image, Img_h1(i,j) represents the filtered target infrared image, 1≤i≤imgH; 1≤j≤imgW; imgH, imgW are the height and width of the target infrared image.
[0156] The second difference image and the filtered target infrared image are both matrix images. The second difference image includes the pixel value of each pixel point. Therefore, dif_img2(i, j) can also be represented as the pixel value of each pixel point in the second difference image.
[0157] For example, the filter h1 used when filtering the target infrared image may be as follows:
[0158]
[0159] Among them, T represents the transposition of the matrix. It can be understood as an infrared image matrix, where h1 is a filter with a window size of 5, and after calculation, h1 = [0.2 0.2 0.2 0.2 0.2]. Of course, h1 is not limited to a filter with a window size of 5, but can also be a filter with a window size of 7, and this embodiment of the application does not specifically limit this.
[0160] S102, determining a detection result of whether horizontal stripes exist in the target infrared image based on the pixel value of each pixel point of the first difference image, and obtaining a detection result in the time domain dimension;
[0161] It is understood that the first difference image is composed of individual pixels, each of which has a pixel value. It should be noted that since the first difference image is the difference between the target infrared image and the corresponding previous frame image, the pixel values of each pixel in the first difference image can be used to determine the detection result of whether horizontal stripes are present in the target infrared image, thereby obtaining a detection result in the time domain dimension.
[0162] It should be noted that step S102 and step S103 can be understood as performing horizontal stripe detection in the time domain dimension and performing horizontal stripe detection in the spatial domain dimension, respectively. In actual use, step S103 can also be executed first to perform horizontal stripe detection in the spatial domain dimension first. The embodiment of the present application does not specifically limit the order of horizontal stripe detection in the two dimensions.
[0163] Optionally, in one implementation, determining the detection result of whether horizontal stripes exist in the target infrared image based on the pixel value of each pixel point of the first difference image to obtain the detection result in the time domain dimension may include steps A1-A3:
[0164] A1, based on the pixel value of each pixel point of the first difference image, detecting whether the first difference image has horizontal stripes, and obtaining a first detection result;
[0165] It is understood that based on the pixel values of each pixel point in the first difference image, whether the first difference image has horizontal stripes can be detected, thereby obtaining a detection result for the first difference image, i.e., a first detection result. The first detection result can then represent two situations, namely, whether the first difference image has horizontal stripes or whether the first difference image does not have horizontal stripes.
[0166] In addition, for the sake of clarity, the content of performing horizontal stripe detection on the first difference image will be introduced in other embodiments, so it will not be described in detail here.
[0167] A2: If the first detection result indicates the presence of horizontal stripes, setting the detection result of the target infrared image regarding the presence of horizontal stripes to the presence of horizontal stripes, thereby obtaining a detection result in the time domain dimension;
[0168] It should be noted that the detection result in the time domain dimension can be the detection result for the target infrared image, while the first detection result is the detection result for the first difference image. Since the first difference image is the difference image between the target infrared image and the corresponding previous frame image, the detection result regarding the presence of horizontal stripes in the target infrared image can be set based on the first detection result, thereby obtaining the detection result in the time domain dimension. Therefore, when the first detection result indicates the presence of horizontal stripes in the first difference image, the detection result in the time domain dimension indicates the presence of horizontal stripes in the target infrared image in the time domain dimension.
[0169] Exemplarily, if the first detection result indicates that horizontal stripes exist in the first difference image a, the detection result of whether horizontal stripes exist in the target infrared image A is set to the presence of horizontal stripes, thereby obtaining a detection result in the time domain dimension, which indicates that horizontal stripes exist in the target infrared image A in the time domain dimension.
[0170] A3. If the first detection result indicates that there are no horizontal stripes, the detection result of the target infrared image regarding whether there are horizontal stripes is set to no horizontal stripes, thereby obtaining a detection result in the time domain dimension.
[0171] It can be understood that if the first detection result represents that there are no horizontal stripes in the first difference image, the detection result of the target infrared image regarding whether there are horizontal stripes can be set to no horizontal stripes, thereby obtaining the detection result in the time domain dimension, wherein the detection result in the time domain dimension represents that there are no horizontal stripes in the target infrared image in the time domain dimension.
[0172] Exemplarily, if the first detection result indicates that there are no horizontal stripes in the first difference image a, the detection result of whether there are horizontal stripes in the target infrared image A is set to no horizontal stripes, thereby obtaining a detection result in the time domain dimension, which indicates that there are no horizontal stripes in the target infrared image A in the time domain dimension.
[0173] It can be seen that by determining the detection result of the target infrared image in the time domain dimension based on the first detection result of the first difference image, a more accurate detection result in the time domain dimension can be obtained, which facilitates the subsequent steps to effectively remove horizontal stripes from infrared images with horizontal stripes.
[0174] S103, determining a detection result of whether horizontal stripes exist in the target infrared image based on the pixel value of each pixel point of the second difference image, and obtaining a detection result in a spatial dimension;
[0175] It is understood that the second difference image is composed of individual pixels, each of which has a pixel value. It should be noted that since the second difference image is the difference between the target infrared image and the filtered target infrared image, the pixel values of each pixel in the second difference image can be used to determine the detection result of whether horizontal stripes are present in the target infrared image, thereby obtaining a detection result in the spatial dimension.
[0176] Optionally, in one implementation, determining the detection result of whether horizontal stripes exist in the target infrared image based on the pixel value of each pixel point of the second difference image to obtain the detection result in the spatial dimension may include steps B1-B3:
[0177] B1, based on the pixel value of each pixel point of the second difference image, detecting whether the second difference image has horizontal stripes, and obtaining a second detection result;
[0178] It is understood that based on the pixel values of each pixel point in the second difference image, the presence of horizontal stripes in the second difference image can be detected, thereby obtaining a detection result for the second difference image, i.e., a second detection result. The second detection result can then represent two situations: the presence of horizontal stripes in the second difference image or the absence of horizontal stripes in the second difference image.
[0179] In addition, for the sake of clarity, the content of performing horizontal stripe detection on the second difference image will be introduced in other embodiments, so it will not be described in detail here.
[0180] B2. If the second detection result indicates the presence of horizontal stripes, setting the detection result of the target infrared image regarding the presence of horizontal stripes to the presence of horizontal stripes, thereby obtaining a detection result in the spatial dimension;
[0181] It should be noted that the detection result in the spatial dimension can be the detection result for the target infrared image, while the second detection result is the detection result for the second difference image. Since the second difference image is the difference image between the target infrared image and the filtered target infrared image, the detection result regarding the presence of horizontal stripes in the target infrared image can be set based on the second detection result, thereby obtaining the detection result in the spatial dimension. Therefore, when the second detection result indicates the presence of horizontal stripes in the second difference image, the detection result in the spatial dimension indicates the presence of horizontal stripes in the target infrared image in the spatial dimension.
[0182] Exemplarily, if the second detection result indicates that horizontal stripes exist in the second difference image b, the detection result of whether horizontal stripes exist in the target infrared image B is set to the presence of horizontal stripes, thereby obtaining a detection result in the spatial dimension, which indicates that horizontal stripes exist in the target infrared image B in the time domain dimension.
[0183] B3. If the second detection result indicates that there are no horizontal stripes, the detection result of the target infrared image regarding whether there are horizontal stripes is set to no horizontal stripes, thereby obtaining a detection result in the spatial dimension.
[0184] It can be understood that if the second detection result characterizes that there are no horizontal stripes in the second difference image, the detection result of the target infrared image regarding whether there are horizontal stripes can be set to no horizontal stripes, thereby obtaining the detection result in the spatial dimension, wherein the detection result in the spatial dimension characterizes that there are no horizontal stripes in the target infrared image in the spatial dimension.
[0185] Exemplarily, if the second detection result characterizes that there are no horizontal stripes in the second difference image b, the detection result of whether there are horizontal stripes in the target infrared image B is set to no horizontal stripes, thereby obtaining a detection result in the spatial dimension, which characterizes that there are no horizontal stripes in the target infrared image B in the spatial dimension.
[0186] It can be seen that, by determining the detection result of the target infrared image in the spatial dimension according to the second detection result of the second difference image, a more accurate detection result in the spatial dimension can be obtained, thereby facilitating the subsequent step of effectively removing the horizontal lines from the infrared image with horizontal lines.
[0187] In S104, if the detection result in the time domain and the detection result in the spatial domain both indicate that there are horizontal lines, image compensation is performed on the target infrared image in the time domain to obtain an intermediate image.
[0188] It can be understood that, when the detection result in the time domain and the detection result in the spatial domain both indicate that there are horizontal lines, it can be accurately indicated that the target infrared image has horizontal lines, and then compensation can be performed on the target infrared image. Since the target infrared image is detected to have horizontal lines in both the time domain and the spatial domain, image compensation is performed on the target infrared image in the time domain to obtain an intermediate image, so that subsequent image compensation is performed in the spatial domain based on the intermediate image. It should be noted that, if only the detection result in the time domain or the detection result in the spatial domain indicates that there are horizontal lines, no image compensation is performed on the target infrared image in the time domain.
[0189] In addition, for the sake of layout clarity, the specific steps of performing image compensation on the target infrared image in the time domain will be introduced in other embodiments, and therefore will not be described in detail here.
[0190] In S105, image compensation is performed on the intermediate image in the spatial domain to obtain an image with horizontal lines removed corresponding to the target infrared image.
[0191] It can be understood that, after image compensation in the time domain, an intermediate image can be obtained, and then image compensation in the spatial domain is performed on the intermediate image to obtain an infrared image with horizontal lines removed, i.e., the final processing result. It should be noted that, image compensation in the time domain can be performed on the target infrared image first, and then image compensation in the spatial domain is performed, so as to ensure that rough compensation is performed first and then fine compensation is performed.
[0192] In addition, for the sake of layout clarity, the specific steps of performing image compensation on the target infrared image in the spatial domain will be introduced in other embodiments, and therefore will not be described in detail here.
[0193] As can be seen, the embodiment of the present application uses a method that combines the time domain and the spatial domain to detect horizontal stripes, which can ensure the accuracy of the horizontal stripe detection results. Moreover, when horizontal stripes are present in both the time domain and the spatial domain, image compensation is performed on the target infrared image in the time domain and the spatial domain, making the compensation more comprehensive and accurate. Therefore, the method of combining horizontal stripe detection and image compensation adopted in the embodiment of the present application can effectively remove horizontal stripes from infrared images that contain horizontal stripes.
[0194] In addition, performing horizontal stripe detection on the first difference image and the second difference image can also avoid loss of details of images without horizontal stripes, thereby greatly improving the image quality of the image after image compensation.
[0195] Based on the above embodiment, the method for determining the first detection result is introduced below:
[0196] Optionally, in one implementation, detecting whether horizontal stripes exist in the first difference image based on the pixel values of each pixel point of the first difference image to obtain a first detection result may include steps C1 to C3:
[0197] Step C1, determining a pixel type of each pixel point in the first difference image according to a pixel value of each pixel point in the first difference image;
[0198] The pixel type includes a first type or a second type, the brightness of the pixels of the first type and the second type are different, and the brightness of the pixels of the first type is higher than that of the pixels of the second type;
[0199] It is understandable that the first type can be called a bright stripe type, and the second type can be called a dark stripe type. It should be noted that the horizontal stripes in the infrared image are composed of bright stripes and dark stripes. Therefore, if there are horizontal stripes in the first difference image, and the horizontal stripes can also be divided into bright stripes and dark stripes based on the degree of brightness, then any pixel point in the first difference image may be a pixel point on a bright stripe or a pixel point on a dark stripe. Therefore, the pixel type of any pixel point may be the first type, that is, the bright stripe type, or the second type, that is, the dark stripe type; of course, any pixel point in the first difference image may neither be a pixel point of a bright stripe nor a pixel point of a dark stripe. In this case, the pixel point is not set to either pixel type. For example, based on the pixel values of pixel points a and pixel points b in the first difference image, it can be determined that the pixel type of pixel point a is the first type and the pixel type of pixel point b is the second type.
[0200] Optionally, in one implementation, step C1, determining the pixel type of each pixel point of the first difference image according to the pixel value of each pixel point of the first difference image, may include step C11:
[0201] Step C11: for each pixel of the first difference image, if the pixel value of the pixel satisfies a first condition, determining the pixel type of the pixel is the first type; if the pixel value of the pixel satisfies a second condition, determining the pixel type of the pixel is the second type;
[0202] The first condition is that the pixel value is greater than a first pixel threshold, and the second condition is that the pixel value is less than the opposite number of the first pixel threshold.
[0203] It can be understood that if the pixel value of a pixel point in the first difference image satisfies the first condition, then the pixel type of the pixel point can be determined to be the first type, i.e., the bright stripe type; if the pixel value of a pixel point in the first difference image satisfies the second condition, then the pixel type of the pixel point can be determined to be the second type, i.e., the dark stripe type.
[0204] It should be noted that the first pixel threshold is an empirical value, usually pre-set by relevant personnel, and is generally 32. The first pixel threshold can also be called the first pixel stripe threshold. Of course, the first pixel threshold can also be other values, and this embodiment of the application does not specifically limit this.
[0205] In addition, there may be pixels in the first difference image that satisfy neither the first condition nor the second condition, such as pixels with a pixel value of 0. In this case, there is no need to determine the pixel type of the pixel.
[0206] For example, the pixel value of pixel a in the first difference image is 34, and the pixel value of pixel b is -36. Then, the pixel value of pixel a satisfies the first condition, that is, the pixel value 34 of pixel a is greater than the first pixel threshold 32, and it can be determined that the pixel type of pixel a is the first type. The pixel value of pixel b satisfies the second condition, that is, the pixel value -36 of pixel b is less than the opposite number of the first pixel threshold -32, and it can be determined that the pixel type of pixel b is the second type.
[0207] Optionally, in one implementation, the step of determining the pixel type of each pixel point of the first difference image can be embodied in the form of a formula, which is described below with reference to the formula:
[0208] Formula 3:
[0209] flag_stripe(i,j)=1; if dif_img(i,j)>T_stripe;
[0210] flag_stripe(i,j) = -1; if dif_img(i,j) < -T_stripe;
[0211] wherein, the flag_stripe(i,j) = 1 represents that the pixel type of the pixel point is the first type, the flag_stripe(i,j) = -1 represents that the pixel type of the pixel point is the second type, the (i,j) can represent the position of the pixel point, the dif_img(i,j) represents the pixel value of each pixel point in the first difference image, and the T_stripe represents the first pixel threshold.
[0212] Step C2, according to the pixel type of each pixel point of the first difference image, counting the number of pixel rows meeting the horizontal stripe condition in the first difference image as the first row number.
[0213] It can be understood that after determining the pixel type of each pixel point of the first difference image, the number of pixel rows meeting the horizontal stripe condition in each row of the first difference image can be determined and counted, and the number of pixel rows obtained by counting is taken as the first row number. It can be understood that not all pixel rows in the first difference image meet the horizontal stripe condition, only the number of pixel rows meeting the horizontal stripe condition can be used for the counting process, so that the sum of the row numbers is taken as the first row number.
[0214] Optionally, in an implementation manner, the step C2 can include steps C21-C22:
[0215] Step C21, for each pixel row of the first difference image, summing the first reference values corresponding to each specified pixel point in the pixel row to obtain a first calculation result, if the obtained first calculation result is greater than a first result threshold, determining that the pixel row is a pixel row belonging to the bright stripe; if the obtained first calculation result is less than the opposite number of the first result threshold, determining that the pixel row is a pixel row belonging to the dark stripe.
[0216] wherein, the specified pixel point is a pixel point with a pixel type, the first reference value corresponding to each specified pixel point is the representation value of the pixel type of the pixel point, the representation value of the first type is a positive number, and the representation value of the second type is the opposite number of the representation value of the first type.
[0217] It can be understood that the first reference value corresponding to the first type of pixel point is the first type of representation value, which is a positive number, and can be 1, 2, etc. The first reference value corresponding to the second type of pixel point is the second type of representation value, which is the opposite of the first type of representation value, and is generally a negative number, which can be -1, -2, etc. It should be noted that the sum of the first type of representation value and the second type of representation value is 0, and the embodiment of the present application does not limit the first type and the second type of representation value. Then, according to the number of specified pixel points in the pixel row, the first reference values of the specified pixel points can be summed to obtain the first calculation result. For example, there are 5 specified pixel points in the first row of the first difference image, of which 4 are of the first type and 1 is of the second type. The first type of representation value is 1 and the second type of representation value is -1. Therefore, the first calculation result can be calculated as 4.
[0218] It should be noted that the first result threshold is an empirical value, which is usually set in advance by relevant personnel. The first result threshold is generally half of the width of the entire infrared image, that is, 0.5W. The first result threshold can also be referred to as a row stripe threshold. Of course, the first result threshold can also be other values, and the embodiment of the present application does not limit it.
[0219] It can be understood that if the first calculation result is greater than the first result threshold, that is, the proportion of the number of bright stripe type pixel points in the pixel row is greater than 50%, then it can be determined that the pixel row belongs to the bright stripe pixel row. If the first calculation result is less than the opposite of the first result threshold, that is, the proportion of the number of dark stripe type pixel points in the pixel row is greater than 50%, then it can be determined that the pixel row belongs to the dark stripe pixel row. For example, the first calculation result is 4 and the first result threshold is 3, so it can be determined that the pixel row belongs to the bright stripe pixel row. The first calculation result is -6 and the first result threshold is -3, so it can be determined that the pixel row belongs to the dark stripe pixel row.
[0220] Optionally, in an implementation manner, the step of determining whether the pixel row belongs to the bright stripe / dark stripe pixel row can be embodied in the form of a formula, which will be described below in combination with the formula:
[0221] Formula 4:
[0222] flag_line_stripe(i) = 1; if
[0223] flag_line_stripe(i) = -1; if
[0224] Wherein, flag_line_stripe(i)=1 represents that pixel row i belongs to the pixel row of bright stripes, flag_line_stripe(i)=-1 represents that pixel row i belongs to the pixel row of dark stripes, T_num_stripe represents the first result threshold, Characterize the first calculation result.
[0225] It can be understood that when the first calculation result is greater than the first result threshold, the pixel row is determined to be a pixel row of bright stripes, and when the first calculation result is less than the opposite of the first result threshold, the pixel row is determined to be a pixel row of dark stripes.
[0226] Alternatively, in one implementation, the pixel row may be determined to be a bright stripe or a dark stripe based on the ratio of the first and second type of pixels in the pixel row to a predetermined result ratio. For example, if the first type of pixels accounts for 60% of the pixel row and the predetermined result ratio is 50%, then the pixel row may be determined to be a bright stripe. If the second type of pixels accounts for 80% of the pixel row and the predetermined result ratio is 50%, then the pixel row may be determined to be a dark stripe.
[0227] It is understandable that there is no unique method for determining whether a pixel row is a bright stripe pixel row or a dark stripe pixel row, and the embodiments of the present application do not specifically limit this.
[0228] Step C22: determining the number of pixel rows that meet the horizontal stripe condition in the first difference image based on the determined pixel rows belonging to the bright stripes and the pixel rows belonging to the dark stripes, as a first row number;
[0229] It can be understood that the pixel rows that are determined to be bright stripes and the pixel rows that are determined to be dark stripes are all counted to determine the number of pixel rows that meet the horizontal stripe condition, and this number of pixel rows is used as the first row number.
[0230] It can be seen that the embodiment of the present application obtains a first calculation result by summing the first reference values corresponding to each specified pixel point in the pixel row, and then determines whether the pixel row belongs to a pixel row of bright stripes or a pixel row of dark stripes through the size relationship between the first calculation result and the first result threshold, thereby obtaining a first row number. Based on the first row number, it can be determined whether there are horizontal stripes in the first difference image in the time domain dimension, thereby facilitating the subsequent steps to effectively remove the horizontal stripes from the infrared image with horizontal stripes.
[0231] Optionally, in one implementation, step C22 may include steps C221-C222:
[0232] Step C221: performing correction processing on the pixel rows determined to be bright stripes and the pixel rows determined to be dark stripes according to a predetermined correction processing method; wherein the correction processing method includes: if there are adjacent pixel rows among the pixel rows determined to be bright stripes, merging the adjacent pixel rows to obtain a pixel row belonging to the bright stripes; and / or, if there are adjacent pixel rows among the pixel rows determined to be dark stripes, merging the adjacent pixel rows to obtain a pixel row belonging to the dark stripes.
[0233] It can be understood that when performing correction processing, adjacent pixel rows belonging to bright stripes and dark stripes can be merged to obtain a pixel row belonging to bright stripes and dark stripes, or pixel rows can be merged only for bright stripes or dark stripes. The embodiment of the present application does not specifically limit the correction processing method.
[0234] For example, pixel row a and pixel row b are adjacent and both are pixel rows of bright stripes, so pixel row a and pixel row b can be merged to obtain a pixel row belonging to bright stripes; pixel row c and pixel row d are adjacent and both are pixel rows of dark stripes, so pixel row c and pixel row d can be merged to obtain a pixel row belonging to dark stripes.
[0235] Step C222 , after the correction process, calculate the total number of pixel rows belonging to bright stripes and the total number of pixel rows belonging to dark stripes, and obtain the number of pixel rows that meet the horizontal stripe condition in the first difference image as the first row number.
[0236] It is understandable that after the correction process is performed, the total number of pixel rows belonging to bright stripes and dark stripes can be counted, and the total number of rows is the number of pixel rows that meet the horizontal stripe condition.
[0237] It should be noted that after the correction process, the pixel values belonging to the bright stripes and the pixel values belonging to the dark stripes are both pixel row numbers that meet the horizontal stripe condition, and the sum of the two can be used as the first row number.
[0238] For example, after correction processing, there are 3 rows of pixels belonging to bright stripes and 2 rows of pixels belonging to dark stripes. Then, the number of pixel rows that meet the horizontal stripe conditions in the first difference image is 5, which is used as the first row number.
[0239] Optionally, in one implementation, the steps of correcting the process and calculating the first number of rows can be expressed in the form of a formula, which is described below:
[0240] Formula 5:
[0241] flag_line_stripe(i)=0; if flag_line_stripe(i)-flag_line_stripe(i-1)=0;
[0242]
[0243] Among them, flag_line_stripe(i) represents a row of pixels, flag_line_stripe(i-1) represents the adjacent pixel row, t_num_stripe represents the first row number, The sum of the absolute values of the pixel rows representing the bright stripes and the pixel rows representing the dark stripes in the first difference image.
[0244] It can be seen that the embodiment of the present application performs correction processing on the pixel rows belonging to bright stripes and the pixel rows belonging to dark stripes according to a predetermined correction processing method, thereby obtaining a first row number. Based on the first row number, it can be determined whether there are horizontal stripes in the first difference image in the time domain dimension, thereby facilitating the subsequent steps to effectively remove the horizontal stripes from the infrared image with horizontal stripes.
[0245] Step C3: if the first number of lines is greater than a preset first line number threshold, determining the presence of horizontal stripes in the first difference image as a first detection result; otherwise, determining the absence of horizontal stripes in the first difference image as a first detection result.
[0246] It can be understood that when the first number of rows is greater than the preset first number of rows threshold, it indicates that the number of pixel rows that meet the horizontal stripe condition in the first difference image is greater than the preset first number of rows threshold. In this case, it can be indicated that horizontal stripes exist in the first difference image, which can be determined as the first detection result. Conversely, when the first number of rows is less than the preset first number of rows threshold, it indicates that the number of pixel rows that meet the horizontal stripe condition in the first difference image is less than the preset first number of rows threshold. In this case, it can be indicated that no horizontal stripes exist in the first difference image, which can be determined as the first detection result.
[0247] Exemplarily, if the first number of rows is 5 and the preset first number of rows threshold is 4, then the presence of horizontal stripes in the first difference image is determined as the first detection result; if the first number of rows is 5 and the preset first number of rows threshold is 6, then the absence of horizontal stripes in the first difference image is determined as the first detection result.
[0248] It is understandable that the first row number threshold is preset by the user and is an empirical value, and the embodiment of the present application does not specifically limit its specific value.
[0249] Optionally, in one implementation, the step of determining the first detection result can be embodied in the form of a formula, which is described below with reference to the formula:
[0250] Formula 6:
[0251] t_num_stripe>T_t_num_stripe;
[0252] Among them, t_num_stripe represents the number of the first row, and T_t_num_stripe represents the threshold value of the number of the first row.
[0253] It can be seen that by determining the pixel type of each pixel point of the first difference image, and then counting the number of pixel rows that meet the horizontal stripe conditions in the first difference image according to the pixel type of each pixel point, as the first row number, and then determining the first detection result based on the size relationship between the first row number and the preset first row number threshold, the first detection result can determine whether there are horizontal stripes in the first difference image in the time domain dimension, thereby facilitating the subsequent steps to effectively remove horizontal stripes from the infrared image with horizontal stripes.
[0254] Based on the above embodiment, the method for determining the second detection result is introduced below:
[0255] Optionally, in one implementation, detecting whether horizontal stripes are present in the second difference image based on the pixel values of each pixel point in the second difference image to obtain a second detection result may include steps D1 to D3:
[0256] Step D1, determining the pixel type of each pixel point in the second difference image according to the pixel value of each pixel point in the second difference image;
[0257] The pixel type includes a first type or a second type, the brightness of the pixels of the first type and the second type are different, and the brightness of the pixels of the first type is higher than that of the pixels of the second type;
[0258] It is understandable that the first type can be called a bright stripe type, and the second type can be called a dark stripe type. It should be noted that the horizontal stripes in the infrared image are composed of bright stripes and dark stripes. Therefore, if there are horizontal stripes in the second difference image, and the horizontal stripes can also be divided into bright stripes and dark stripes based on the degree of brightness, then any pixel point in the second difference image may be a pixel point on the bright and dark stripes, or a pixel point on the dark stripes. Therefore, the pixel type of any pixel point may be the first type, that is, the bright stripe type, or the second type, that is, the dark stripe type; of course, any pixel point in the first difference image may neither be a pixel point of the bright stripes nor a pixel point of the dark stripes. In this case, the pixel point is not set to either pixel type. For example, based on the pixel values of pixel points a and pixel points b in the second difference image, it can be determined that the pixel type of pixel point a is the first type and the pixel type of pixel point b is the second type.
[0259] Optionally, in one implementation, step D1, determining the pixel type of each pixel point of the second difference image according to the pixel value of each pixel point of the second difference image, may include step D11:
[0260] Step D11: for each pixel of the second difference image, if the pixel value of the pixel satisfies the third condition, determining the pixel type of the pixel is the first type; if the pixel value of the pixel satisfies the fourth condition, determining the pixel type of the pixel is the second type;
[0261] The third condition is that the pixel value is greater than the second pixel threshold, and the fourth condition is that the pixel value is less than the opposite number of the second pixel threshold.
[0262] It can be understood that if the pixel value of the pixel point in the second difference image meets the third condition, then the pixel type of the pixel point can be determined to be the first type, that is, the bright stripe type; if the pixel value of the pixel point in the second difference image meets the fourth condition, then the pixel type of the pixel point can be determined to be the second type, that is, the dark stripe type.
[0263] It should be noted that the second pixel threshold is an empirical value, usually pre-set by relevant personnel, and is generally 32. The second pixel threshold can also be called a second pixel stripe threshold. Of course, the second pixel threshold can also be other values, and this embodiment of the application does not specifically limit this.
[0264] In addition, there may be pixels in the second difference image that satisfy neither the third condition nor the fourth condition, such as pixels with a pixel value of 0. In this case, there is no need to determine the pixel type of the pixel.
[0265] For example, the pixel value of pixel a in the second difference image is 34, and the pixel value of pixel b is -36. Then, the pixel value of pixel a satisfies the third condition, that is, the pixel value 34 of pixel a is greater than the second pixel threshold 32, and it can be determined that the pixel type of pixel a is the first type. The pixel value of pixel b satisfies the fourth condition, that is, the pixel value -36 of pixel b is less than the opposite number of the second pixel threshold -32, and it can be determined that the pixel type of pixel b is the second type.
[0266] Optionally, in one implementation, the step of determining the pixel type of each pixel point of the second difference image can be embodied in the form of a formula, which is described below with reference to the formula:
[0267] Formula 7:
[0268] flag_stripe2(i,j)=1; if dif_img2(i,j)>T_stripe2;
[0269] flag_stripe2(i,j)=-1; if dif_img2(i,j)<-T_stripe2;
[0270] Among them, flag_stripe2(i,j)=1 represents that the pixel type of the pixel point is the first type, flag_stripe2(i,j)=-1 represents that the pixel type of the pixel point is the second type, (i,j) can represent the position of the pixel point, dif_img2(i,j) represents the pixel value of each pixel point in the second difference image, and T_stripe2 represents the second pixel threshold.
[0271] Step D2, counting the number of pixel rows in the second difference image that meet the horizontal stripe condition according to the pixel type of each pixel point in the second difference image, as a second row number;
[0272] It is understood that after determining the pixel type of each pixel point in the second difference image, the number of pixel rows in each row of the second difference image that meet the horizontal stripe condition can be determined and counted, and the number of pixel rows obtained by counting is used as the second row number. It is understood that not all pixel rows in the second difference image meet the horizontal stripe condition, and only the number of pixel rows that meet the horizontal stripe condition can be used in the counting process, so that the sum of the number of rows is used as the second row number.
[0273] Optionally, in one implementation, step D2 may include steps D21-D22:
[0274] Step D21: For each pixel row of the second difference image, summing the first reference values corresponding to each designated pixel point in the pixel row to obtain a second calculation result; if the second calculation result is greater than a second result threshold, determining that the pixel row is a pixel row belonging to a bright stripe; if the second calculation result is less than the inverse of the second result threshold, determining that the pixel row is a pixel row belonging to a dark stripe;
[0275] Among them, the designated pixel points are pixel points with pixel types, and the first reference value corresponding to each designated pixel point is the characterization value of the pixel type of the pixel point. The characterization value of the first type is a positive number, and the characterization value of the second type is the opposite of the characterization value of the first type.
[0276] It can be understood that the first reference value corresponding to the first type of pixel is the characterization value of the first type, which is a positive number, generally 1, 2, etc. The first reference value corresponding to the second type of pixel is the characterization value of the second type, which is the opposite of the characterization value of the first type, generally a negative number, generally -1, -2, etc. It should be noted that the sum of the characterization value of the first type and the characterization value of the second type is 0. The embodiment of the present application does not specifically limit the characterization values of the first type and the second type. Then, in the second difference image, according to the number of specified pixels in the pixel row, the first reference values of each specified pixel can be summed to obtain the second calculation result. For example, there are 5 specified pixels in the first row of the second difference image, including 4 pixels of the first type and 1 pixel of the second type. The characterization value of the first type is 1 and the characterization value of the second type is -1. Then, the second calculation result can be calculated to be 4.
[0277] It should be noted that the second result threshold is an empirical value, typically preset by relevant personnel. The second result threshold is generally half the width of the entire infrared image, i.e., 0.5W. The second result threshold may also be referred to as a line stripe threshold. Of course, the second result threshold may also be other values, and this embodiment of the application does not specifically limit this.
[0278] It is understood that if the second calculation result is greater than the second result threshold, that is, the number of bright stripe-type pixels in the pixel row accounts for more than 50%, then the pixel row can be determined to be a bright stripe pixel row; if the second calculation result is less than the inverse of the second result threshold, that is, the number of dark stripe-type pixels in the pixel row accounts for more than 50%, then the pixel row can be determined to be a dark stripe pixel row. For example, if the second calculation result is 4 and the second result threshold is 3, then the pixel row can be determined to be a bright stripe pixel row; if the second calculation result is -6 and the second result threshold is -3, then the pixel row can be determined to be a dark stripe pixel row.
[0279] Optionally, in one implementation, the step of determining whether a pixel row is a bright stripe or a dark stripe can be expressed in the form of a formula, which is described below with reference to the formula:
[0280] Formula 8:
[0281] flag_line_stripe2(i)=1; if
[0282] flag_line_stripe2(i)=-1; if
[0283] Wherein, flag_line_stripe2(i)=1 represents that pixel row i belongs to the pixel row of bright stripes, flag_line_stripe2(i)=-1 represents that pixel row i belongs to the pixel row of dark stripes, T_num_stripe2 represents the second result threshold, Characterize the second calculation result.
[0284] It can be understood that when the second calculation result is greater than the second result threshold, the pixel row is determined to be a pixel row of bright stripes, and when the second calculation result is less than the opposite of the second result threshold, the pixel row is determined to be a pixel row of dark stripes.
[0285] Step D22: determining the number of pixel rows that meet the horizontal stripe condition in the second difference image based on the determined pixel rows belonging to the bright stripes and the determined pixel rows belonging to the dark stripes, as a second number of rows;
[0286] It can be understood that the pixel rows that are determined to be bright stripes and the pixel rows that are determined to be dark stripes are all counted to determine the number of pixel rows that meet the horizontal stripe condition, and this number of pixel rows is used as the second row number.
[0287] It can be seen that the embodiment of the present application obtains the second calculation result by summing the first reference values corresponding to each specified pixel point in the pixel row, and then determines whether the pixel row belongs to a pixel row of bright stripes or a pixel row of dark stripes through the size relationship between the second calculation result and the second result threshold, thereby obtaining the second row number. Based on the second row number, it can be determined whether there are horizontal stripes in the second difference image in the spatial dimension, thereby facilitating the subsequent steps to effectively remove the horizontal stripes from the infrared image with horizontal stripes.
[0288] Optionally, in one implementation, step D22 may include steps D221-D222:
[0289] Step D221, performing correction processing on the pixel rows determined to be bright stripes and the pixel rows determined to be dark stripes according to a predetermined correction processing method; wherein the correction processing method includes: if there are adjacent pixel rows among the pixel rows determined to be bright stripes, merging the adjacent pixel rows to obtain a pixel row belonging to the bright stripes; and / or, if there are adjacent pixel rows among the pixel rows determined to be dark stripes, merging the adjacent pixel rows to obtain a pixel row belonging to the dark stripes.
[0290] It can be understood that when performing correction processing, adjacent pixel rows belonging to bright stripes and dark stripes can be merged to obtain a pixel row belonging to bright stripes and dark stripes, or pixel rows can be merged only for bright stripes or dark stripes. The embodiment of the present application does not specifically limit the correction processing method.
[0291] For example, pixel row a and pixel row b are adjacent and both are pixel rows of bright stripes, so pixel row a and pixel row b can be merged to obtain a pixel row belonging to bright stripes; pixel row c and pixel row d are adjacent and both are pixel rows of dark stripes, so pixel row c and pixel row d can be merged to obtain a pixel row belonging to dark stripes.
[0292] Step D222, after the correction process, calculate the total number of pixel rows belonging to bright stripes and the total number of pixel rows belonging to dark stripes, and obtain the number of pixel rows that meet the horizontal stripe condition in the second difference image as the second row number.
[0293] It is understandable that after the correction process is performed, the total number of pixel rows belonging to bright stripes and dark stripes can be counted, and the total number of rows is the number of pixel rows that meet the horizontal stripe condition.
[0294] It should be noted that after the correction process, the pixel values belonging to the bright stripes and the pixel values belonging to the dark stripes are both pixel row numbers that meet the horizontal stripe condition, and the sum of the two can be used as the second row number.
[0295] For example, after correction processing, there are 3 rows of pixels belonging to bright stripes and 2 rows of pixels belonging to dark stripes. Then, the number of pixel rows that meet the horizontal stripe conditions in the second difference image is 5, which is used as the second row number.
[0296] Optionally, in one implementation, the steps of correcting and calculating the second number of rows can be expressed in the form of a formula, which is described below:
[0297] Formula 9:
[0298] flag_line_stripe2(i)=0; if flag_line_stripe2(i)-flag_line_stripe2(i-1)=0;
[0299]
[0300] Among them, flag_line_stripe2(i) represents a row of pixels, flag_line_stripe2(i-1) represents the adjacent row of pixels, s_num_stripe represents the second row number, The sum of the absolute values of the pixel rows representing the bright stripes and the pixel rows representing the dark stripes in the second difference image.
[0301] It can be seen that the embodiment of the present application performs correction processing on the pixel rows belonging to bright stripes and the pixel rows belonging to dark stripes according to a predetermined correction processing method, thereby obtaining a second row number. Based on the second row number, it can be determined whether there are horizontal stripes in the second difference image in the spatial dimension, thereby facilitating the subsequent steps to effectively remove the horizontal stripes from the infrared image with horizontal stripes.
[0302] Step D3: if the second number of lines is greater than a preset second line number threshold, determining the presence of horizontal stripes in the second difference image as a second detection result; otherwise, determining the absence of horizontal stripes in the second difference image as a second detection result.
[0303] It can be understood that when the second number of rows is greater than the preset second number of rows threshold, it indicates that the number of pixel rows that meet the horizontal stripe condition in the second difference image is greater than the preset second number of rows threshold. In this case, it can be indicated that horizontal stripes exist in the second difference image, which can be determined as the second detection result. Conversely, when the second number of rows is less than the preset second number of rows threshold, it indicates that the number of pixel rows that meet the horizontal stripe condition in the second difference image is less than the preset second number of rows threshold. In this case, it can be indicated that no horizontal stripes exist in the second difference image, which can be determined as the second detection result.
[0304] For example, if the second number of rows is 5 and the preset second number of rows threshold is 4, then the presence of horizontal stripes in the second difference image is determined as the second detection result; if the second number of rows is 5 and the preset second number of rows threshold is 6, then the absence of horizontal stripes in the second difference image is determined as the second detection result.
[0305] It is understandable that the second row number threshold is preset by the user and is an empirical value, and the embodiment of the present application does not specifically limit its specific value.
[0306] Optionally, in one implementation, the step of determining the first detection result can be embodied in the form of a formula, which is described below with reference to the formula:
[0307] Formula 10:
[0308] t_num_stripe>T_t_num_stripe;
[0309] Among them, t_num_stripe represents the second row number, and T_t_num_stripe represents the second row number threshold.
[0310] It can be seen that by determining the pixel type of each pixel point of the second difference image, and then counting the number of pixel rows that meet the horizontal stripe condition in the second difference image according to the pixel type of each pixel point, as the second row number, and then determining the second detection result based on the size relationship between the second row number and the preset second row number threshold, the second detection result can determine whether there are horizontal stripes in the second difference image in the spatial dimension, thereby facilitating the subsequent steps to effectively remove the horizontal stripes from the infrared image with horizontal stripes.
[0311] Optionally, in one implementation, the target infrared image is compensated in the time domain dimension to obtain a specific process of the intermediate image, such as Figure 2 As shown, steps S201-S204 may be included:
[0312] S201, filtering the first difference image based on a first filter to obtain a first spare image;
[0313] Wherein, the first filter is a filter for removing shear waves;
[0314] It is understood that after filtering the first difference image based on the first filter, a first backup image can be obtained. Since the first filter is used to remove transverse waves, the horizontal stripes in the obtained first backup image are greatly weakened. This filtering process can also be called one-dimensional vertical filtering. For example, based on the filter A used to remove horizontal stripes, the first difference image a is filtered to obtain the first backup image a'; wherein the horizontal stripes in the first backup image a' are greatly weakened. It is understood that the first filter and the filter used to obtain the second difference image can be the same filter, and of course different filters can also be used.
[0315] S202, determining a difference image between the first difference image and the first spare image as a first compensation image;
[0316] It is understood that the first compensated image can be obtained by subtracting the first difference image from the first backup image. Both the first compensated image and the first backup image can be in the form of a matrix, wherein the first compensated image includes multiple compensation values. Optionally, in one implementation, the step of determining the first compensated image can be expressed in the form of a formula, which is explained below with reference to the formula:
[0317] Formula 11:
[0318] cor_t_img(i,j)=dif_img(i,j)-dif_img_h1(i,j);
[0319] Wherein, cor_t_img(i, j) represents the first compensated image, dif_img(i, j) represents the first difference image, and dif_img_h1(i, j) represents the first spare image.
[0320] S203, filtering the first compensated image based on a second filter to obtain a first compensation value;
[0321] Wherein, the second filter is a filter for removing vertical waves;
[0322] It is understandable that, due to the continuity of the horizontal stripes in the spatial domain, the first compensated image can be filtered based on the second filter to obtain the first compensation value. This filtering process can also be called one-dimensional horizontal filtering.
[0323] Optionally, in one implementation, the step of filtering the first compensated image can be expressed in the form of a formula, which is described below with reference to the formula:
[0324] Formula 12:
[0325] h2=[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] / 16;
[0326] Among them, h2 is the second filter, [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] is the first compensated image in matrix form. Of course, h2 is not necessarily a filter with a window of 16, but can also be a filter with other windows. The embodiment of the present application does not specifically limit the second filter.
[0327] S204: Perform image compensation in the time domain dimension on the target infrared image based on the first compensation value to obtain an intermediate image.
[0328] It can be understood that the specific process of performing image compensation in the time domain dimension on the target infrared image can be understood as subtracting the target infrared image from the first compensation value to obtain an intermediate image.
[0329] Optionally, in one implementation, the step of obtaining the intermediate image can be expressed in the form of a formula, which is described below with reference to the formula:
[0330] Formula 13:
[0331] Img1(i,j)=Img(i,j)-cor_t_img(i,j);
[0332] Among them, Img(i,j) is the target infrared image, cor_t_img(i,j) is the second compensation value, and Img1(i,j) is the intermediate image.
[0333] It can be seen that the second compensation value can be obtained by one-dimensional vertical filtering and one-dimensional horizontal filtering, and based on the second compensation value, the target infrared image can be compensated in the time domain dimension, thereby facilitating effective horizontal stripe removal of the infrared image with horizontal stripes.
[0334] Optionally, in an implementation, the specific process of compensating the target infrared image in the spatial domain to obtain the image after horizontal stripe removal corresponding to the target infrared image can include steps S301-S304 as shown in the following table: Figure 3
[0335] S301, filtering the intermediate image based on a third filter to obtain a second backup image, and filtering the intermediate image based on a fourth filter to obtain a third backup image;
[0336] The third filter and the fourth filter are filters for removing horizontal stripes in different regions of the intermediate image.
[0337] It can be understood that for filtering in the spatial domain, a side window filtering manner can be used, that is, two filters are used to filter different regions of the intermediate image, and the intermediate region can be completely covered by the filtering ranges of the two filters. The different regions of the intermediate image can be left and right regions, or upper and lower regions, which are not limited by the embodiments of the present application.
[0338] The process of side window filtering will be briefly introduced in the form of formulas below by taking two filters as an example.
[0339] Formula 14:
[0340]
[0341]
[0342] w1 is the third filter for filtering the left region of the intermediate region, and w2 is the fourth filter for filtering the right region of the intermediate region.
[0343] S302, determining a second compensation image according to a predetermined determination manner based on the second backup image and the third backup image.
[0344] The predetermined determination method includes: for each pixel point of the intermediate image, if the absolute value of the pixel value of the first pixel point corresponding to the pixel point in the second backup image is less than the absolute value of the pixel value of the second pixel point corresponding to the pixel point in the third backup image, determining the initial compensation value of the pixel point as the pixel value of the first pixel point corresponding to the pixel point; otherwise, determining the initial compensation value of the pixel point as the pixel value of the second pixel point corresponding to the pixel point, wherein the first pixel point and the second pixel point corresponding to the pixel point are both pixel points that match the position of the pixel point;
[0345] The initial compensation value of the pixel is the initial compensation value of each pixel in the intermediate image. After the initial compensation value of each pixel in the intermediate image is determined, a second compensated image can be obtained.
[0346] It can be understood that for each pixel point of the intermediate image, the second compensated image is determined based on the size relationship between the absolute value of the pixel value of the first pixel point corresponding to the pixel point in the second backup image and the absolute value of the pixel value of the second pixel point corresponding to the pixel point in the third backup image.
[0347] It is understood that when the absolute value of the pixel value of a first pixel point is less than the absolute value of the pixel value of a second pixel point, the initial compensation value of the pixel point is determined to be the pixel value of the first pixel point corresponding to the pixel point. Then, when the absolute value of the pixel value of the second pixel point is equal to the absolute value of the pixel value of the second pixel point, the initial compensation value of the pixel point is determined to be the pixel value of the second pixel point corresponding to the pixel point. For example, if the absolute value of the pixel value of the first pixel point is 10 and the absolute value of the pixel value of the second pixel point is 9, then the absolute value of the pixel value of the second pixel point can be determined as the initial compensation value of the pixel point; if the absolute value of the pixel value of the first pixel point is 9 and the absolute value of the pixel value of the second pixel point is 10, then the absolute value of the pixel value of the first pixel point can be determined as the initial compensation value of the pixel point.
[0348] Optionally, in one implementation, the step of determining the second compensation image can be briefly introduced in the form of a formula:
[0349] Formula 15:
[0350] cor_s_img(i,j)=cor_s_img1(i,j); if abs(cor_s_img1(i,j)) <abs(cor_s_img2(i,j));
[0351] cor_s_img(i,j)=cor_s_img2(i,j); if abs(cor_s_img1(i,j))≥abs(cor_s_img2(i,j));
[0352] Among them, cor_s_img(i,j) represents the second compensated image, cor_s_img1(i,j) represents the pixel value of the first pixel point corresponding to the pixel point in the second spare image, cor_s_img2(i,j) represents the pixel value of the first pixel point corresponding to the pixel point in the third spare image, abs(cor_s_img1(i,j)) represents the absolute value of the pixel value of the first pixel point corresponding to the pixel point in the second spare image, and abs(cor_s_img2(i,j)) represents the absolute value of the pixel value of the first pixel point corresponding to the pixel point in the third spare image.
[0353] S303, filtering the second compensated image using a fifth filter to obtain a second compensation value;
[0354] Wherein, the fifth filter is a filter for removing vertical waves;
[0355] It can be understood that, due to the continuity of the horizontal stripes in the spatial domain, the fifth filter can be used to filter the second compensated image to obtain the second compensation value. This filtering process can also be called one-dimensional horizontal filtering.
[0356] S304: Perform image compensation on the intermediate image in a spatial dimension based on the second compensation value to obtain an image corresponding to the target infrared image after removing horizontal stripes.
[0357] It should be noted that the specific process of image compensation in the spatial dimension of the intermediate image can be understood as subtracting the intermediate image from the second compensation value to obtain the image after removing the horizontal stripes corresponding to the target infrared image. After image compensation in the time domain dimension and compensation in the spatial dimension, the horizontal stripes in the target infrared image can be effectively removed.
[0358] Optionally, in one implementation, the step of obtaining the image corresponding to the target infrared image after removing the horizontal stripes can be expressed in the form of a formula, which is described below with reference to the formula:
[0359] Formula 16:
[0360] Img2(i,j)=Img1(i,j)-cor_s_img(i,j);
[0361] Among them, Img2(i,j) is the image after removing horizontal stripes corresponding to the target infrared image, cor_s_img(i,j) is the second compensation value, and Img1(i,j) is the intermediate image.
[0362] It can be seen that the embodiment of the present application adopts a combination of time domain dimension and spatial domain dimension to perform image compensation, so that the high-intensity noise generated after a strong impact in a short period of time can be removed. Therefore, the embodiment of the present application can effectively remove horizontal stripes in infrared images with horizontal stripes.
[0363] Optionally, in one implementation, the present application also provides another image processing method for infrared images, such as Figure 4 As shown, this may include:
[0364] S401, detector raw output;
[0365] It can be understood that the detector includes a sensor array, and the infrared image originally output by the detector is the target infrared image, and the horizontal stripe detection can be performed on the target infrared image.
[0366] S402, time domain detection of impact striations;
[0367] It is understandable that impact striations can also be called striations;
[0368] It can be understood that the impact streak detection in the time domain dimension of the target infrared image is performed. This process is based on the first difference image corresponding to the target infrared image, so as to determine the detection result of whether the target infrared image has impact streaks, thereby realizing the time domain detection of impact streaks.
[0369] S403, impact stripe airspace detection;
[0370] It can be understood that the impact streak detection in the spatial dimension of the target infrared image is performed. This process is based on the second difference image corresponding to the target infrared image, so as to determine the detection result of whether the target infrared image has impact streaks, thereby realizing the spatial detection of impact streaks.
[0371] S404, impact stripe judgment;
[0372] It can be understood that this process is to determine whether the detection results of the impact horizontal stripe time domain detection and the impact horizontal stripe space domain detection both indicate the existence of impact horizontal stripes. If the detection results of both indicate the existence of impact horizontal stripes, subsequent steps can be performed.
[0373] S405, the time domain filtering module performs filtering and image compensation;
[0374] It is understandable that the image compensation in the time domain dimension can be performed by the time domain filtering module, and the image compensation is performed on the target infrared image in the time domain dimension to obtain an intermediate image.
[0375] S406, the spatial domain filtering module performs filtering and image compensation;
[0376] It can be understood that the image compensation in the spatial dimension can be performed by the spatial filtering module. By performing image compensation on the intermediate image in the spatial dimension, an image after removing horizontal stripes corresponding to the target infrared image can be obtained.
[0377] S407, detector output;
[0378] It is understandable that the detector can eventually output the image corresponding to the target infrared image after removing the horizontal stripes.
[0379] As can be seen, the embodiment of the present application uses a method that combines the time domain and spatial domain dimensions to detect horizontal stripes, which can ensure the accuracy of the horizontal stripe detection results. Moreover, when both the time domain and spatial domain dimensions indicate the presence of horizontal stripes, image compensation is performed on the target infrared image in the time domain and spatial domain dimensions, making the compensation more comprehensive and accurate. Therefore, the method of combining horizontal stripe detection and image compensation used in the embodiment of the present application can effectively remove horizontal stripes from infrared images that contain horizontal stripes.
[0380] Based on the above method embodiment, Figure 5 As shown, an embodiment of the present application provides an image processing device for infrared images, comprising:
[0381] An acquisition module 510 is configured to acquire a first difference image and a second difference image corresponding to the target infrared image to be processed; wherein the first difference image is a difference image between the target infrared image and a corresponding previous frame image, and the second difference image is a difference image between the target infrared image and the filtered target infrared image;
[0382] A first determining module 520 is configured to determine a detection result of whether horizontal stripes exist in the target infrared image based on the pixel value of each pixel point of the first difference image, and obtain a detection result in the time domain dimension;
[0383] A second determining module 530 is configured to determine a detection result of whether horizontal stripes exist in the target infrared image based on the pixel value of each pixel point of the second difference image, and obtain a detection result in a spatial dimension;
[0384] A first image compensation module 540 is configured to perform image compensation on the target infrared image in the time domain dimension to obtain an intermediate image if both the detection result in the time domain dimension and the detection result in the spatial domain dimension indicate the presence of horizontal stripes;
[0385] The second image compensation module 550 is configured to perform image compensation on the intermediate image in a spatial dimension to obtain an image corresponding to the target infrared image after removing horizontal stripes.
[0386] Optionally, the first determining module includes:
[0387] a first detection submodule, configured to detect whether horizontal stripes are present in the first difference image based on the pixel value of each pixel point in the first difference image, and obtain a first detection result;
[0388] a first setting submodule, configured to set the detection result of the target infrared image regarding whether horizontal stripes exist as the presence of horizontal stripes if the first detection result indicates the presence of horizontal stripes, thereby obtaining a detection result in a time domain dimension;
[0389] a second setting submodule, configured to set the detection result of the target infrared image regarding the presence of horizontal stripes to the absence of horizontal stripes if the first detection result indicates that there are no horizontal stripes, thereby obtaining a detection result in the time domain dimension;
[0390] Optionally, the second determining module includes:
[0391] a second detection submodule, configured to detect whether horizontal stripes are present in the second difference image based on the pixel value of each pixel point in the second difference image, and obtain a second detection result;
[0392] a third setting submodule, configured to set the detection result of the target infrared image regarding whether horizontal stripes exist as the presence of horizontal stripes if the second detection result indicates the presence of horizontal stripes, thereby obtaining a detection result in a spatial dimension;
[0393] a fourth setting submodule, configured to set the detection result of the target infrared image regarding the presence of horizontal stripes to the absence of horizontal stripes if the second detection result indicates that there are no horizontal stripes, thereby obtaining a detection result in a spatial dimension;
[0394] Optionally, the first detection submodule includes:
[0395] a first determining unit, configured to determine a pixel type of each pixel of the first difference image based on a pixel value of each pixel of the first difference image; wherein the pixel type includes a first type or a second type, the first type and the second type of pixels have different brightness levels, and the brightness of the first type of pixels is higher than that of the second type of pixels;
[0396] a first counting unit, configured to count, according to a pixel type of each pixel point in the first difference image, the number of pixel rows meeting a horizontal stripe condition in the first difference image as a first row number;
[0397] a second determining unit, configured to determine the presence of horizontal stripes in the first difference image as a first detection result if the first number of lines is greater than a preset first line number threshold, and otherwise determine the absence of horizontal stripes in the first difference image as the first detection result;
[0398] Optionally, the first determining unit includes:
[0399] a first determining subunit, configured to, for each pixel of the first difference image, determine that the pixel type of the pixel is the first type if a pixel value of the pixel satisfies a first condition, and determine that the pixel type of the pixel is the second type if the pixel value of the pixel satisfies a second condition;
[0400] The first condition is that the pixel value is greater than a first pixel threshold, and the second condition is that the pixel value is less than the opposite number of the first pixel threshold.
[0401] Optionally, the first statistical unit includes:
[0402] a first summing subunit, configured to sum, for each pixel row of the first difference image, first reference values corresponding to designated pixels in the pixel row to obtain a first calculation result, and if the first calculation result is greater than a first result threshold, determine that the pixel row is a pixel row belonging to a bright stripe; and if the first calculation result is less than the opposite of the first result threshold, determine that the pixel row is a pixel row belonging to a dark stripe;
[0403] a second determining subunit, configured to determine, based on the determined pixel rows belonging to the bright stripes and the determined pixel rows belonging to the dark stripes, the number of pixel rows in the first difference image that meet the horizontal stripe condition, as a first row number;
[0404] The designated pixel points are pixel points having a pixel type, the first reference value corresponding to each designated pixel point is a characterizing value of the pixel type of the pixel point, the characterizing value of the first type is a positive number, and the characterizing value of the second type is the opposite number of the characterizing value of the first type;
[0405] Optionally, the second determining subunit is further configured to perform correction processing on the pixel rows determined to belong to the bright stripes and the pixel rows determined to belong to the dark stripes according to a predetermined correction processing method; wherein the correction processing method includes: if there are adjacent pixel rows among the pixel rows determined to belong to the bright stripes, merging the adjacent pixel rows to obtain a pixel row belonging to the bright stripes; and / or, if there are adjacent pixel rows among the pixel rows determined to belong to the dark stripes, merging the adjacent pixel rows to obtain a pixel row belonging to the dark stripes.
[0406] After the correction process, the total number of pixel rows belonging to bright stripes and the total number of pixel rows belonging to dark stripes are calculated to obtain the number of pixel rows meeting the horizontal stripe condition in the first difference image as the first row number;
[0407] Optionally, the second detection submodule includes:
[0408] a third determining unit, configured to determine a pixel type of each pixel of the second difference image based on a pixel value of each pixel of the second difference image; wherein the pixel type includes a first type or a second type, the first type and the second type of pixels have different brightness levels, and the brightness of the first type of pixels is higher than that of the second type of pixels;
[0409] a second counting unit, configured to count, according to the pixel type of each pixel point in the second difference image, the number of pixel rows meeting the horizontal stripe condition in the second difference image as a second row number;
[0410] a fourth determining unit, configured to determine the presence of horizontal stripes in the second difference image as a second detection result if the second number of lines is greater than a preset second line number threshold, and otherwise determine the absence of horizontal stripes in the second difference image as a second detection result;
[0411] Optionally, the third determining unit includes:
[0412] a third determining subunit, configured to, for each pixel of the second difference image, determine that the pixel type of the pixel is the first type if a pixel value of the pixel satisfies a third condition, and determine that the pixel type of the pixel is the second type if the pixel value of the pixel satisfies a fourth condition;
[0413] The third condition is that the pixel value is greater than the second pixel threshold, and the fourth condition is that the pixel value is less than the opposite number of the second pixel threshold.
[0414] Optionally, the second statistical unit includes:
[0415] a second summing subunit, configured to sum, for each pixel row of the second difference image, the first reference values corresponding to the respective designated pixels in the pixel row to obtain a second calculation result, and if the second calculation result is greater than a second result threshold, determine that the pixel row is a pixel row belonging to a bright stripe; and if the second calculation result is less than the inverse of the second result threshold, determine that the pixel row is a pixel row belonging to a dark stripe;
[0416] a fourth determining subunit, configured to determine, based on the determined pixel rows belonging to the bright stripes and the determined pixel rows belonging to the dark stripes, the number of pixel rows in the second difference image that meet the horizontal stripe condition, as a second number of rows;
[0417] The designated pixel points are pixel points having a pixel type, the first reference value corresponding to each designated pixel point is a characterizing value of the pixel type of the pixel point, the characterizing value of the first type is a positive number, and the characterizing value of the second type is the opposite number of the characterizing value of the first type;
[0418] Optionally, the fourth determining subunit is further configured to perform correction processing on the pixel rows determined to belong to the bright stripes and the pixel rows determined to belong to the dark stripes according to a predetermined correction processing method; wherein the correction processing method includes: if there are adjacent pixel rows among the pixel rows determined to belong to the bright stripes, merging the adjacent pixel rows to obtain a pixel row belonging to the bright stripes; and / or, if there are adjacent pixel rows among the pixel rows determined to belong to the dark stripes, merging the adjacent pixel rows to obtain a pixel row belonging to the dark stripes.
[0419] After the correction process, the total number of pixel rows belonging to bright stripes and the total number of pixel rows belonging to dark stripes are calculated to obtain the number of pixel rows meeting the horizontal stripe condition in the second difference image as the second row number;
[0420] Optionally, the first image compensation module includes:
[0421] A first filtering submodule is configured to filter the first difference image based on a first filter to obtain a first backup image; wherein the first filter is a filter for removing shear waves;
[0422] a first determining submodule, configured to determine a difference image between the first difference image and the first spare image as a first compensation image;
[0423] A second filtering submodule is configured to filter the first compensated image based on a second filter to obtain a first compensation value; wherein the second filter is a filter for removing vertical waves;
[0424] A first image compensation submodule is configured to perform image compensation in the time domain dimension on the target infrared image based on the first compensation value to obtain an intermediate image;
[0425] Optionally, the second image compensation module includes:
[0426] a third filtering submodule, configured to filter the intermediate image using a third filter to obtain a second backup image, and to filter the intermediate image using a fourth filter to obtain a third backup image; wherein the third filter and the fourth filter are filters for removing horizontal stripes from different regions of the intermediate image;
[0427] a second determining submodule, configured to determine, based on the second backup image and the third backup image, a second compensated image of the intermediate image in a predetermined determining manner; wherein the predetermined determining manner includes: for each pixel point of the intermediate image, if the absolute value of the pixel value of a first pixel point corresponding to the pixel point in the second backup image is less than the absolute value of the pixel value of a second pixel point corresponding to the pixel point in the third backup image, determining an initial compensation value of the pixel point as the pixel value of the first pixel point corresponding to the pixel point; otherwise, determining the initial compensation value of the pixel point as the pixel value of the second pixel point corresponding to the pixel point, wherein the first pixel point and the second pixel point corresponding to the pixel point are both pixel points that match the position of the pixel point;
[0428] a fourth filtering submodule, configured to filter the second compensated image using a fifth filter to obtain a second compensation value; wherein the fifth filter is a filter for removing vertical waves;
[0429] The second image compensation submodule is configured to perform image compensation on the intermediate image in a spatial dimension based on the second compensation value to obtain an image corresponding to the target infrared image after removing horizontal stripes.
[0430] In the technical solution of this application, the operations involved in obtaining, storing, using, processing, transmitting, providing and disclosing user personal information are all carried out with the user's authorization.
[0431] The present application also provides an electronic device, such as Figure 6 Shown, including:
[0432] Memory 601, used for storing computer programs;
[0433] The processor 602 is configured to implement the above-mentioned image processing method for infrared images when executing the program stored in the memory 601 .
[0434] Furthermore, the electronic device may further include a communication bus and / or a communication interface, and the processor 602, the communication interface, and the memory 601 communicate with each other via the communication bus.
[0435] The communication bus mentioned in the electronic device mentioned above may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not mean that there is only one bus or only one type of bus.
[0436] The communication interface is used for communication between the above electronic device and other devices.
[0437] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.
[0438] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.
[0439] In another embodiment provided in the present application, a computer-readable storage medium is further provided, in which a computer program is stored. When the computer program is executed by a processor, any of the above-mentioned image processing methods for infrared images is implemented.
[0440] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any one of the image processing methods for infrared images in the above embodiments.
[0441] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD).
[0442] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.
[0443] Each embodiment in this specification is described in a related manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiment is generally similar to the method embodiment, so the description is relatively simple. For related parts, refer to the description of the method embodiment.
[0444] The above description is only a preferred embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application are included in the scope of protection of the present application.
Claims
1. An image processing method for infrared images, characterized in that: include: Acquire a first difference image and a second difference image corresponding to the target infrared image to be processed; wherein the first difference image is a difference image between the target infrared image and a corresponding previous frame image, and the second difference image is a difference image between the target infrared image and the target infrared image after filtering; Determining a detection result of whether horizontal stripes exist in the target infrared image based on the pixel value of each pixel point of the first difference image, and obtaining a detection result in the time domain dimension; Determining a detection result of whether horizontal stripes exist in the target infrared image based on the pixel value of each pixel point of the second difference image, and obtaining a detection result in a spatial dimension; If both the detection result in the time domain dimension and the detection result in the spatial domain dimension indicate the presence of horizontal stripes, performing image compensation on the target infrared image in the time domain dimension to obtain an intermediate image; Image compensation is performed on the intermediate image in a spatial dimension to obtain an image corresponding to the target infrared image after removing horizontal stripes.
2. The method according to claim 1, characterized in that The step of determining a detection result of whether horizontal stripes exist in the target infrared image based on the pixel value of each pixel point of the first difference image, and obtaining a detection result in the time domain dimension, includes: Based on the pixel value of each pixel point of the first difference image, detecting whether the first difference image has horizontal stripes to obtain a first detection result; If the first detection result indicates the presence of horizontal stripes, setting the detection result of the target infrared image regarding the presence of horizontal stripes as the presence of horizontal stripes, thereby obtaining a detection result in the time domain dimension; If the first detection result indicates that there are no horizontal stripes, the detection result of the target infrared image regarding whether there are horizontal stripes is set to no horizontal stripes, thereby obtaining a detection result in the time domain dimension.
3. The method according to claim 1, characterized in that The step of determining a detection result of whether horizontal stripes exist in the target infrared image based on the pixel value of each pixel point of the second difference image, and obtaining a detection result in a spatial dimension, includes: performing a detection on the second difference image regarding whether horizontal stripes exist based on the pixel value of each pixel point of the second difference image to obtain a second detection result; If the second detection result indicates the presence of horizontal stripes, setting the detection result of the target infrared image regarding the presence of horizontal stripes as the presence of horizontal stripes, thereby obtaining a detection result in the spatial dimension; If the second detection result indicates that there are no horizontal stripes, the detection result of the target infrared image regarding whether there are horizontal stripes is set to no horizontal stripes, thereby obtaining a detection result in the spatial dimension.
4. The method according to claim 2, characterized in that The detecting whether horizontal stripes exist in the first difference image based on the pixel values of each pixel point of the first difference image to obtain a first detection result includes: Determining a pixel type of each pixel of the first difference image based on a pixel value of each pixel of the first difference image; wherein the pixel type includes a first type or a second type, the first type and the second type of pixels have different brightness levels, and the brightness of the first type of pixels is higher than that of the second type of pixels; Counting the number of pixel rows meeting the horizontal stripe condition in the first difference image according to the pixel type of each pixel point in the first difference image as a first row number; If the first number of lines is greater than a preset first line number threshold, the presence of horizontal stripes in the first difference image is determined as a first detection result; otherwise, the absence of horizontal stripes in the first difference image is determined as a first detection result.
5. The method according to claim 4, characterized in that The determining, according to the pixel value of each pixel point of the first difference image, the pixel type of each pixel point of the first difference image includes: For each pixel of the first difference image, if a pixel value of the pixel satisfies a first condition, determining the pixel type of the pixel is the first type; if the pixel value of the pixel satisfies a second condition, determining the pixel type of the pixel is the second type; The first condition is that the pixel value is greater than a first pixel threshold, and the second condition is that the pixel value is less than the opposite number of the first pixel threshold.
6. The method according to claim 4, characterized in that The counting, based on the pixel type of each pixel point in the first difference image, of the number of pixel rows meeting the horizontal stripe condition in the first difference image as the first row number, includes: For each pixel row of the first difference image, summing the first reference values corresponding to each designated pixel point in the pixel row to obtain a first calculation result, and if the obtained first calculation result is greater than a first result threshold, determining that the pixel row is a pixel row belonging to a bright stripe; if the obtained first calculation result is less than the opposite of the first result threshold, determining that the pixel row is a pixel row belonging to a dark stripe; Based on the determined pixel rows belonging to the bright stripes and the pixel rows belonging to the dark stripes, determining the number of pixel rows in the first difference image that meet the horizontal stripe condition as a first row number; Among them, the designated pixel points are pixel points with pixel types, and the first reference value corresponding to each designated pixel point is the characterization value of the pixel type of the pixel point. The characterization value of the first type is a positive number, and the characterization value of the second type is the opposite of the characterization value of the first type.
7. The method according to claim 6, characterized in that The step of determining the number of pixel rows that meet the horizontal stripe condition in the first difference image based on the determined pixel rows belonging to the bright stripes and the determined pixel rows belonging to the dark stripes as a number of pixel rows includes: Correction processing is performed on the pixel rows determined to be bright stripes and the pixel rows determined to be dark stripes according to a predetermined correction processing method; wherein the correction processing method includes: if there are adjacent pixel rows among the pixel rows determined to be bright stripes, merging the adjacent pixel rows to obtain a pixel row belonging to the bright stripes; and / or, if there are adjacent pixel rows among the pixel rows determined to be dark stripes, merging the adjacent pixel rows to obtain a pixel row belonging to the dark stripes; After the correction process, the total number of pixel rows belonging to bright stripes and the total number of pixel rows belonging to dark stripes are calculated to obtain the number of pixel rows meeting the horizontal stripe condition in the first difference image as the first row number.
8. The method according to claim 3, characterized in that The detecting whether horizontal stripes exist on the second difference image based on the pixel values of each pixel point of the second difference image to obtain a second detection result includes: Determining a pixel type of each pixel of the second difference image based on a pixel value of each pixel of the second difference image; wherein the pixel type includes a first type or a second type, the first type and the second type of pixels have different brightness levels, and the brightness of the first type of pixels is higher than that of the second type of pixels; Counting the number of pixel rows meeting the horizontal stripe condition in the second difference image according to the pixel type of each pixel point in the second difference image as a second row number; If the second number of lines is greater than a preset second line number threshold, the presence of horizontal stripes in the second difference image is determined as a second detection result; otherwise, the absence of horizontal stripes in the second difference image is determined as a second detection result.
9. The method according to claim 8, characterized in that The determining, according to the pixel value of each pixel point of the second difference image, the pixel type of each pixel point of the second difference image includes: For each pixel of the second difference image, if a pixel value of the pixel satisfies a third condition, determining the pixel type of the pixel is the first type; if the pixel value of the pixel satisfies a fourth condition, determining the pixel type of the pixel is the second type; The third condition is that the pixel value is greater than the second pixel threshold, and the fourth condition is that the pixel value is less than the opposite number of the second pixel threshold.
10. The method according to claim 8, characterized in that The counting, according to the pixel type of each pixel point of the second difference image, of the number of pixel rows meeting the horizontal stripe condition in the second difference image as the second number of rows includes: For each pixel row of the second difference image, summing the first reference values corresponding to each designated pixel point in the pixel row to obtain a second calculation result, and if the second calculation result is greater than a second result threshold, determining that the pixel row is a pixel row belonging to a bright stripe; and if the second calculation result is less than the inverse of the second result threshold, determining that the pixel row is a pixel row belonging to a dark stripe; Based on the determined pixel rows belonging to the bright stripes and the determined pixel rows belonging to the dark stripes, determining the number of pixel rows in the second difference image that meet the horizontal stripe condition as a second number of rows; Among them, the designated pixel points are pixel points with pixel types, and the first reference value corresponding to each designated pixel point is the characterization value of the pixel type of the pixel point. The characterization value of the first type is a positive number, and the characterization value of the second type is the opposite of the characterization value of the first type.
11. The method according to claim 10, characterized in that The step of determining the number of pixel rows that meet the horizontal stripe condition in the second difference image based on the determined pixel rows belonging to the bright stripes and the determined pixel rows belonging to the dark stripes as the second number of rows includes: Correction processing is performed on the pixel rows determined to be bright stripes and the pixel rows determined to be dark stripes according to a predetermined correction processing method; wherein the correction processing method includes: if there are adjacent pixel rows among the pixel rows determined to be bright stripes, merging the adjacent pixel rows to obtain a pixel row belonging to the bright stripes; and / or, if there are adjacent pixel rows among the pixel rows determined to be dark stripes, merging the adjacent pixel rows to obtain a pixel row belonging to the dark stripes; After the correction process, the total number of pixel rows belonging to bright stripes and the total number of pixel rows belonging to dark stripes are calculated to obtain the number of pixel rows meeting the horizontal stripe condition in the second difference image as the second row number.
12. The method according to any one of claims 1 to 11, characterized in that The performing image compensation on the target infrared image in the time domain dimension to obtain an intermediate image includes: Filtering the first difference image based on a first filter to obtain a first backup image; wherein the first filter is a filter for removing shear waves; determining a difference image between the first difference image and the first spare image as a first compensation image; Filtering the first compensated image based on a second filter to obtain a first compensation value; wherein the second filter is a filter for removing vertical waves; Based on the first compensation value, image compensation in the time domain dimension is performed on the target infrared image to obtain an intermediate image.
13. The method according to any one of claims 1 to 11, characterized in that The performing image compensation on the intermediate image in a spatial dimension to obtain an image corresponding to the target infrared image after removing horizontal stripes includes: filtering the intermediate image based on a third filter to obtain a second backup image, and filtering the intermediate image based on a fourth filter to obtain a third backup image; wherein the third filter and the fourth filter are filters for removing horizontal stripes from different regions of the intermediate image; Determining a second compensated image based on the second backup image and the third backup image in a predetermined determination method; wherein the predetermined determination method includes: for each pixel point of the intermediate image, if the absolute value of the pixel value of a first pixel point corresponding to the pixel point in the second backup image is less than the absolute value of the pixel value of a second pixel point corresponding to the pixel point in the third backup image, determining an initial compensation value for the pixel point as the pixel value of the first pixel point corresponding to the pixel point; otherwise, determining the initial compensation value for the pixel point as the pixel value of the second pixel point corresponding to the pixel point, wherein both the first pixel point and the second pixel point corresponding to the pixel point are pixel points that match the position of the pixel point; Filtering the second compensated image using a fifth filter to obtain a second compensation value; wherein the fifth filter is a filter for removing vertical waves; Based on the second compensation value, image compensation is performed on the intermediate image in a spatial dimension to obtain an image corresponding to the target infrared image after removing horizontal stripes.
14. An image processing device for infrared images, characterized in that: include: an acquisition module, configured to acquire a first difference image and a second difference image corresponding to the target infrared image to be processed; wherein the first difference image is a difference image between the target infrared image and the corresponding previous frame image, and the second difference image is a difference image between the target infrared image and the target infrared image after filtering; a first determining module, configured to determine a detection result of whether horizontal stripes are present in the target infrared image based on a pixel value of each pixel point of the first difference image, and obtain a detection result in a time domain dimension; a second determining module, configured to determine a detection result of whether horizontal stripes are present in the target infrared image based on the pixel value of each pixel point of the second difference image, and obtain a detection result in a spatial dimension; a first image compensation module, configured to perform image compensation on the target infrared image in the time domain dimension to obtain an intermediate image if both the detection result in the time domain dimension and the detection result in the spatial domain dimension indicate the presence of horizontal stripes; The second image compensation module is used to perform image compensation on the intermediate image in a spatial dimension to obtain an image corresponding to the target infrared image after removing horizontal stripes.
15. The device according to claim 14, characterized in that The first determining module includes: a first detection submodule, configured to detect whether horizontal stripes exist in the first difference image based on the pixel value of each pixel point in the first difference image, and obtain a first detection result; a first setting submodule, configured to set the detection result of the target infrared image regarding whether horizontal stripes exist as the presence of horizontal stripes if the first detection result indicates the presence of horizontal stripes, thereby obtaining a detection result in a time domain dimension; The second setting submodule is configured to set the detection result of the target infrared image regarding whether there are horizontal stripes as no horizontal stripes if the first detection result indicates that no horizontal stripes exist, thereby obtaining a detection result in the time domain dimension.
16. The device according to claim 14, characterized in that The second determining module includes: a second detection submodule, configured to detect whether horizontal stripes are present in the second difference image based on the pixel value of each pixel point in the second difference image, and obtain a second detection result; a third setting submodule, configured to set the detection result of the target infrared image regarding whether horizontal stripes exist as the presence of horizontal stripes if the second detection result indicates the presence of horizontal stripes, thereby obtaining a detection result in a spatial dimension; The fourth setting submodule is configured to set the detection result of the target infrared image regarding whether there are horizontal stripes to no horizontal stripes if the second detection result indicates that no horizontal stripes exist, thereby obtaining a detection result in a spatial dimension.
17. The device according to claim 15, characterized in that The first detection submodule includes: a first determining unit, configured to determine a pixel type of each pixel of the first difference image based on a pixel value of each pixel of the first difference image; wherein the pixel type includes a first type or a second type, the first type and the second type of pixels have different brightness levels, and the brightness of the first type of pixels is higher than that of the second type of pixels; a first counting unit, configured to count, according to a pixel type of each pixel point in the first difference image, the number of pixel rows meeting a horizontal stripe condition in the first difference image, as a first row number; The second determining unit is configured to determine the presence of horizontal stripes in the first difference image as a first detection result if the first number of lines is greater than a preset first line number threshold; otherwise, determine the absence of horizontal stripes in the first difference image as the first detection result.
18. The device according to claim 17, characterized in that The first determining unit includes: a first determining subunit, configured to, for each pixel of the first difference image, determine that the pixel type of the pixel is the first type if a pixel value of the pixel satisfies a first condition, and determine that the pixel type of the pixel is the second type if the pixel value of the pixel satisfies a second condition; The first condition is that the pixel value is greater than a first pixel threshold, and the second condition is that the pixel value is less than the opposite number of the first pixel threshold.
19. The device according to claim 17, characterized in that The first statistical unit includes: a first summing subunit, configured to sum, for each pixel row of the first difference image, first reference values corresponding to designated pixels in the pixel row to obtain a first calculation result, and if the first calculation result is greater than a first result threshold, determine that the pixel row is a pixel row belonging to a bright stripe; and if the first calculation result is less than the opposite of the first result threshold, determine that the pixel row is a pixel row belonging to a dark stripe; a second determining subunit, configured to determine, based on the determined pixel rows belonging to the bright stripes and the determined pixel rows belonging to the dark stripes, the number of pixel rows in the first difference image that meet the horizontal stripe condition, as a first row number; Among them, the designated pixel points are pixel points with pixel types, and the first reference value corresponding to each designated pixel point is the characterization value of the pixel type of the pixel point. The characterization value of the first type is a positive number, and the characterization value of the second type is the opposite of the characterization value of the first type.
20. The device according to claim 19, characterized in that The second determining subunit is further configured to perform correction processing on the pixel rows determined to belong to the bright stripes and the pixel rows determined to belong to the dark stripes according to a predetermined correction processing method; wherein the correction processing method includes: if there are adjacent pixel rows among the pixel rows determined to belong to the bright stripes, merging the adjacent pixel rows to obtain a pixel row belonging to the bright stripes; and / or, if there are adjacent pixel rows among the pixel rows determined to belong to the dark stripes, merging the adjacent pixel rows to obtain a pixel row belonging to the dark stripes. After the correction process, the total number of pixel rows belonging to bright stripes and the total number of pixel rows belonging to dark stripes are calculated to obtain the number of pixel rows meeting the horizontal stripe condition in the first difference image as the first row number.
21. The device according to claim 16, characterized in that The second detection submodule includes: a third determining unit, configured to determine a pixel type of each pixel of the second difference image based on a pixel value of each pixel of the second difference image; wherein the pixel type includes a first type or a second type, the first type and the second type of pixels have different brightness levels, and the brightness of the first type of pixels is higher than that of the second type of pixels; a second counting unit, configured to count, according to the pixel type of each pixel point in the second difference image, the number of pixel rows meeting the horizontal stripe condition in the second difference image as a second row number; The fourth determining unit is configured to determine the presence of horizontal stripes in the second difference image as a second detection result if the second number of lines is greater than a preset second line number threshold; otherwise, determine the absence of horizontal stripes in the second difference image as a second detection result.
22. The device according to claim 21, characterized in that The third determining unit includes: a third determining subunit, configured to, for each pixel of the second difference image, determine that the pixel type of the pixel is the first type if a pixel value of the pixel satisfies a third condition, and determine that the pixel type of the pixel is the second type if the pixel value of the pixel satisfies a fourth condition; The third condition is that the pixel value is greater than the second pixel threshold, and the fourth condition is that the pixel value is less than the opposite number of the second pixel threshold.
23. The device according to claim 21, characterized in that The second statistical unit includes: a second summing subunit, configured to sum, for each pixel row of the second difference image, the first reference values corresponding to the respective designated pixels in the pixel row to obtain a second calculation result, and if the second calculation result is greater than a second result threshold, determine that the pixel row is a pixel row belonging to a bright stripe; and if the second calculation result is less than the inverse of the second result threshold, determine that the pixel row is a pixel row belonging to a dark stripe; a fourth determining subunit, configured to determine, based on the determined pixel rows belonging to the bright stripes and the determined pixel rows belonging to the dark stripes, the number of pixel rows in the second difference image that meet the horizontal stripe condition, as a second number of rows; Among them, the designated pixel points are pixel points with pixel types, and the first reference value corresponding to each designated pixel point is the characterization value of the pixel type of the pixel point. The characterization value of the first type is a positive number, and the characterization value of the second type is the opposite of the characterization value of the first type.
24. The device according to claim 23, characterized in that The fourth determining subunit is further configured to perform correction processing on the pixel rows determined to belong to the bright stripes and the pixel rows determined to belong to the dark stripes according to a predetermined correction processing method; wherein the correction processing method includes: if there are adjacent pixel rows among the pixel rows determined to belong to the bright stripes, merging the adjacent pixel rows to obtain a pixel row belonging to the bright stripes; and / or, if there are adjacent pixel rows among the pixel rows determined to belong to the dark stripes, merging the adjacent pixel rows to obtain a pixel row belonging to the dark stripes. After the correction process, the total number of pixel rows belonging to bright stripes and the total number of pixel rows belonging to dark stripes are calculated to obtain the number of pixel rows meeting the horizontal stripe condition in the second difference image as the second row number.
25. The device according to any one of claims 14 to 24, characterized in that The first image compensation module includes: A first filtering submodule is configured to filter the first difference image based on a first filter to obtain a first backup image; wherein the first filter is a filter for removing shear waves; a first determining submodule, configured to determine a difference image between the first difference image and the first spare image as a first compensation image; A second filtering submodule is configured to filter the first compensated image based on a second filter to obtain a first compensation value; wherein the second filter is a filter for removing vertical waves; The first image compensation submodule is configured to perform image compensation in a time domain dimension on the target infrared image based on the first compensation value to obtain an intermediate image.
26. The device according to any one of claims 14 to 24, characterized in that The second image compensation module includes: a third filtering submodule, configured to filter the intermediate image using a third filter to obtain a second backup image, and to filter the intermediate image using a fourth filter to obtain a third backup image; wherein the third filter and the fourth filter are filters for removing horizontal stripes from different regions of the intermediate image; a second determining submodule, configured to determine a second compensated image based on the second backup image and the third backup image in a predetermined determining manner; wherein the predetermined determining manner includes: for each pixel point of the intermediate image, if the absolute value of the pixel value of a first pixel point corresponding to the pixel point in the second backup image is less than the absolute value of the pixel value of a second pixel point corresponding to the pixel point in the third backup image, determining an initial compensation value of the pixel point as the pixel value of the first pixel point corresponding to the pixel point; otherwise, determining the initial compensation value of the pixel point as the pixel value of the second pixel point corresponding to the pixel point, wherein both the first pixel point and the second pixel point corresponding to the pixel point are pixel points that match the position of the pixel point; a fourth filtering submodule, configured to filter the second compensated image using a fifth filter to obtain a second compensation value; wherein the fifth filter is a filter for removing vertical waves; The second image compensation submodule is configured to perform image compensation on the intermediate image in a spatial dimension based on the second compensation value to obtain an image corresponding to the target infrared image after removing horizontal stripes.
27. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the method according to any one of claims 1 to 13 when executing a program stored in a memory.
28. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 13 is implemented.
Citation Information
Patent Citations
Infrared image cross grain removing processing method and processing device and storage device
CN110796621A
Infrared image denoising method and apparatus, and device
WO2021217392A1