Infrared image heat source area detection method and device, electronic equipment and storage medium
By determining the ribbon of each pixel and calculating the pixel proportion of the ribbon in the infrared image, the problem of being unable to accurately identify the heat source area in the infrared image in the prior art is solved, and fast and real-time heat source detection is achieved.
Patent Information
- Application Number
- CN202110601321.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-31
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2041-05-31
AI Technical Summary
Existing infrared image recognition methods cannot accurately identify whether there is a heat source area in the infrared image, mainly due to the lack of effective edge information and texture structure.
By acquiring an infrared image, determining the corresponding ribbon for each pixel, calculating the pixel proportion of each ribbon, and determining whether there is a heat source area according to the preset requirements.
It realizes rapid and real-time analysis of whether there is a heat source area in the infrared image, and has the advantages of small calculation amount and strong anti-noise ability.
Smart Images

Figure CN113269760B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of infrared detection technology, and in particular to a method and device for detecting a heat source area in an infrared image, an electronic device, and a storage medium. Background Art
[0002] Infrared imaging equipment is often used to determine whether there is a heat source in the environment. It is widely used in the military, metallurgy, and firefighting fields. Infrared equipment will generate a large number of infrared images. How to automatically determine whether there is a heat source in the infrared image and determine the location information of the heat source has become an important topic in infrared image research. Infrared images are different from natural images. They do not have clear edge details and texture structures, and can only rely on color changes to present heating objects. Most existing image recognition methods rely on edge information to calculate image elements such as gradients, which makes most recognition methods based on natural images not outstanding in infrared images. Therefore, related technologies cannot accurately identify whether there is a heat source in infrared images.
[0003] As can be seen from the above, the infrared image heat source area detection method in the related art has the technical problem of being unable to accurately identify whether there is a heat source in the infrared image. Summary of the invention
[0004] In order to solve the above-mentioned technical problem of being unable to accurately identify whether a heat source exists in an infrared image, the present application provides a method and device for detecting a heat source area in an infrared image, an electronic device and a storage medium.
[0005] In a first aspect, an embodiment of the present application provides a method for detecting a heat source area in an infrared image, comprising:
[0006] Acquire infrared images required for heat source location determination;
[0007] Determine a color band corresponding to each pixel in the infrared image, wherein the color band is used to indicate a temperature range, the temperature difference of the temperature range corresponding to each color band is the same, and for each color band, the color of the pixel corresponding to the color band is one of all the colors included in the color band;
[0008] By determining the pixels in the infrared image corresponding to each of the color bands, a pixel ratio of all pixels corresponding to each of the color bands in all pixels in the infrared image is obtained;
[0009] When it is determined that the pixel proportions corresponding to each of the color bands meet the preset requirements, it is determined that a heat source area exists in the infrared image.
[0010] Optionally, as in the aforementioned method, before determining the color band corresponding to each pixel in the infrared image, the method further includes:
[0011] determining a temperature bar for identifying the infrared image, wherein each color in the temperature bar is used to indicate a unique temperature;
[0012] The temperature strip is evenly divided according to a preset number of color bands to obtain at least two color bands.
[0013] Optionally, as in the aforementioned method, determining the color band corresponding to each pixel in the infrared image includes:
[0014] The following steps are performed for any pixel in the infrared image:
[0015] The color component sum of the pixel is obtained by calculating the sum of the red value, the green value and the blue value in the RBG value of the color of the pixel;
[0016] For each of the color bands, the color component sum of each color included in the color band is calculated according to the RBG value of each color included in the color band; the color component sum of the color band is averaged according to the number of colors included in the color band to obtain the color component average of the color band;
[0017] The color band corresponding to the pixel is determined in all the color bands based on the sum of the color components of the pixel and an average value of the color components of each of the color bands.
[0018] Optionally, as in the aforementioned method, when the pixel ratio corresponding to each color band meets a preset requirement, determining that a heat source area exists in the infrared image includes:
[0019] According to the pixel proportion corresponding to each of the color bands, a first color band set is determined from all the color bands, wherein the sum of the pixel proportions of the respective color bands in the first color band set is greater than or equal to a first preset threshold, and the temperature indicated by the color bands in the first color band set is higher than the temperature indicated by other color bands in the infrared image except the first color band set;
[0020] According to the pixel ratio of each of the color bands, a second color band set is determined from all the color bands, wherein the sum of the pixel ratios of the respective color bands in the second color band set is greater than or equal to a second preset threshold, and the temperature indicated by the color bands in the second color band set is lower than the temperature indicated by other color bands in the infrared image except the second color band set;
[0021] When the color band difference between the first target color band in the first color band set and the second target color band in the second color band set is greater than or equal to a third preset threshold, it is determined that the heat source area exists in the infrared image, wherein the first target color band is the color band indicating the lowest temperature among all the color bands in the first color band set, and the second target color band is the color band indicating the highest temperature among all the color bands in the second color band set, and the color band difference is used to indicate the number of color bands spaced between the first target color band and the second target color band, and the temperature indicated by the spaced color bands is lower than the temperature indicated by the first target color band and higher than the temperature indicated by the second target color band.
[0022] Optionally, as in the aforementioned method, after determining that the heat source area exists in the infrared image, the method further includes:
[0023] The heat source area is determined in the infrared image according to the distribution of target pixels in the infrared image, wherein the target pixels are pixels corresponding to the color bands in the first color band set.
[0024] Optionally, as in the aforementioned method, determining the heat source area in the infrared image according to the distribution of the target pixels in the infrared image includes:
[0025] Determine remaining pixels in the infrared image except the target pixel;
[0026] Determining a saturation component value of the target pixel, and determining a saturation component value of the remaining pixels;
[0027] Binarization is performed on the infrared image to obtain a binarized image, wherein the pixel value of a first pixel corresponding to the target pixel in the binarized image is a first preset value after the saturation component value of the target pixel is binarized, and the pixel value of a second pixel corresponding to the target pixel in the binarized image is a second preset value after the saturation component value of the remaining pixels is binarized;
[0028] The heat source area is determined in the infrared image based on the first pixel and the second pixel in the binary image.
[0029] Optionally, as in the aforementioned method, determining the heat source area in the infrared image based on the first pixel and the second pixel in the binary image includes:
[0030] Determine a target area in the binary image by a dilation-erosion method according to a first preset value of the first pixel and a second preset value of the second pixel, wherein a density of the first pixels in the target area assigned the first preset value is higher than a preset threshold;
[0031] The heat source area is determined in the infrared image according to the position information of the target area.
[0032] In a second aspect, an embodiment of the present application provides an infrared image heat source area detection device, comprising:
[0033] An acquisition module, used to acquire infrared images required for heat source location determination;
[0034] A corresponding module, used for determining a color band corresponding to each pixel in the infrared image, wherein the color band is used to indicate a temperature range, the temperature difference of the temperature range corresponding to each color band is the same, and for each color band, the color of the pixel corresponding to the color band is one of all the colors included in the color band;
[0035] A proportion module, used for obtaining the pixel proportion of all pixels corresponding to each color band in all pixels of the infrared image by determining the pixels in the infrared image corresponding to each color band;
[0036] A determination module is used to determine that there is a heat source area in the infrared image when it is determined that the pixel ratio corresponding to each of the color bands meets a preset requirement.
[0037] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;
[0038] The memory is used to store computer programs;
[0039] The processor is used to implement any of the methods described above when executing the computer program.
[0040] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the storage medium includes a stored program, wherein the program executes a method as described in any of the preceding items when executed.
[0041] The above technical solution provided by the embodiment of the present application has the following advantages compared with the prior art:
[0042] The method provided in the embodiment of the present application only needs to determine the color band corresponding to each pixel in the infrared image and obtain the pixel ratio corresponding to each color band, and then determine whether there is a heat source area in the infrared image based on the pixels of the color band. Therefore, it is possible to quickly analyze whether there is a heat source area in the infrared image without performing complex mathematical transformations. This method has the advantages of small computational complexity, good real-time performance, and strong resistance to external noise. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0045] Figure 1 A flowchart of a method for detecting heat source areas in infrared images provided in an embodiment of the present application;
[0046] Figure 2 A flowchart of a method for detecting heat source areas in infrared images provided by another embodiment of the present application;
[0047] Figure 3 A flowchart of a method for detecting heat source areas in infrared images provided by another embodiment of the present application;
[0048] Figure 4 A flowchart of a method for detecting heat source areas in infrared images provided by another embodiment of the present application;
[0049] Figure 5 A flowchart of a method for detecting heat source areas in infrared images provided by another embodiment of the present application;
[0050] Figure 6 A block diagram of an infrared image heat source area detection device provided in an embodiment of the present application;
[0051] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0053] According to one aspect of an embodiment of the present application, a method for detecting a heat source area in an infrared image is provided. Optionally, in this embodiment, the above-mentioned method for detecting a heat source area in an infrared image can be applied to a hardware environment consisting of a terminal and / or a server. The server is connected to the terminal via a network, and can be used to provide services for the terminal or a client installed on the terminal. A database can be set on the server or independently of the server to provide data storage services for the server.
[0054] The above network may include but is not limited to at least one of the following: wired network, wireless network. The above wired network may include but is not limited to at least one of the following: wide area network, metropolitan area network, local area network, and the above wireless network may include but is not limited to at least one of the following: WIFI (Wireless Fidelity), Bluetooth. The terminal may not be limited to a PC, a mobile phone, a tablet computer, etc.
[0055] The infrared image heat source area detection method of the embodiment of the present application can be executed by a server, a terminal, or a server and a terminal together. The infrared image heat source area detection method of the embodiment of the present application can be executed by a terminal or by a client installed thereon.
[0056] Taking the infrared image heat source area detection method of this embodiment executed by the terminal as an example, Figure 1 An infrared image heat source area detection method provided in an embodiment of the present application includes the following steps:
[0057] Step S101, acquiring an infrared image for which a heat source position needs to be determined.
[0058] The infrared image heat source area detection method in this embodiment can be applied to scenarios where it is necessary to determine whether a heat source area exists in an infrared image acquired by an infrared camera. In addition, it can also be used to determine whether a heat source area exists in infrared images acquired by other devices.
[0059] The heat source position may be a position in the infrared image that indicates a higher temperature relative to the environment captured by the infrared image. For example, when the environment captured by the infrared image is a human activity environment, the heat source position may be the position of a person captured by the infrared image; when the environment captured by the infrared image is a running computing device, the heat source position may be the position of a CPU or GPU captured by the infrared image, and so on.
[0060] After the infrared camera acquires the infrared image, the terminal executing the method of this embodiment can acquire the infrared image from the infrared camera.
[0061] Step S102, determining the color band corresponding to each pixel in the infrared image, wherein the color band is used to indicate the temperature range, the temperature difference of the temperature range corresponding to each color band is the same, and for each color band, the color of the pixel corresponding to the color band is one of all the colors included in the color band.
[0062] After acquiring the infrared image, each pixel in the infrared image needs to be analyzed to determine whether there is a heat source area.
[0063] Since the temperature of different objects is indicated by different colors in infrared images, each pixel has a corresponding color. For example, each temperature between a specified high temperature and a specified low temperature can be indicated by each color from yellow to purple.
[0064] The color band may be a color band composed of multiple colors with a gradual change process, used to indicate a certain temperature range. For example, color band 1 may be gradually changed from yellow to orange to indicate a temperature range corresponding to 50°C to 41°C, with a temperature difference of 9°C (i.e., 50°C-41°C=9°C), and color band 2 may be gradually changed from orange to red to indicate a temperature range corresponding to 40°C to 31°C, with a temperature difference of 9°C (i.e., 40°C-31°C=9°C), and generally, there is no intersection between the colors of different color bands, so the temperature range indicated by each color band is also different, but the temperature difference indicated by each color band is the same.
[0065] Since the color band includes all colors in transition between two colors, and each pixel only displays one color, a pixel must correspond to a unique color band, and a color band can correspond to multiple pixels.
[0066] Step S103 , by determining the pixels in the infrared image corresponding to each color band, the pixel ratio of all pixels corresponding to each color band in all pixels in the infrared image is obtained.
[0067] After determining the color band corresponding to each pixel, the pixel in the infrared image corresponding to each color band can be determined, so the number of all pixels corresponding to each color band can be obtained, and then the pixel ratio of all pixels corresponding to each color band in all pixels in the infrared image can be obtained from the total number of pixels in the infrared image.
[0068] For example, when the infrared image has a resolution of 300×400 and the number of pixels corresponding to color band 1 is 1200, the pixel ratio of all pixels corresponding to color band 1 in all pixels of the infrared image is 6000 / (300×400)=0.05.
[0069] Step S104, when it is determined that the pixel ratios corresponding to the respective color bands meet the preset requirements, it is determined that a heat source area exists in the infrared image.
[0070] After the pixel ratio corresponding to each color band is obtained, and when it is determined that the pixel ratio corresponding to each color band meets the preset requirements, it can be determined that there is a heat source area in the infrared image.
[0071] The preset requirement may be a condition related to the pixel ratio corresponding to the color band used to determine the presence of a heat source region in the infrared image. For example, the preset requirement may be: the pixel ratio corresponding to the color band with the highest indicated temperature range reaches a first preset lower limit; or the pixel ratio corresponding to the at least one color band with the highest indicated temperature range reaches a second preset lower limit, and the pixel ratio corresponding to the at least one color band with the lowest indicated temperature range reaches a third preset lower limit, etc. Conversely, when the pixel ratio corresponding to each color band meets the preset requirement, it is determined that a heat source region exists in the infrared image.
[0072] Therefore, using the method in this embodiment, it is only necessary to determine the color band corresponding to each pixel in the infrared image and obtain the pixel ratio corresponding to each color band, and then determine whether there is a heat source area in the infrared image based on the pixels of the color band. Therefore, without performing complex mathematical transformations, it is possible to quickly analyze whether there is a heat source area in the infrared image. This method has the advantages of small computational complexity, good real-time performance, and strong resistance to external noise.
[0073] like Figure 2 As shown, as an optional implementation, as in the above method, before the step S101 determines the color band corresponding to each pixel in the infrared image, the method further includes the following steps:
[0074] Step S201 : determining a temperature bar for identifying an infrared image, wherein each color in the temperature bar is used to indicate a unique temperature.
[0075] Infrared images are images that indicate different temperatures through different colors. Therefore, before taking an infrared image, it is necessary to predetermine the temperature bar set when taking the infrared image. The temperature bar indicates the color corresponding to each temperature, and there is a one-to-one correspondence between temperature and color. For example, the temperature bar can be a color image that gradually changes from yellow to purple.
[0076] Step S202, evenly divide the temperature bar according to a preset number of color bands to obtain at least two color bands.
[0077] After the temperature bar is obtained, multiple color bands can be obtained based on the temperature bar.
[0078] The preset number of color bands can be the number of color bands that are pre-set and required to be obtained. Optionally, the temperature bar covers all colors that can be presented by the infrared image, and the collected temperature bars gradually change from yellow to purple, representing from high temperature to low temperature. Since the color on the temperature bar is gradual, it is impossible to strictly define the starting and ending range of a color. Therefore, the temperature bar can be evenly divided into n color bands from one end of the temperature bar along the direction of the color gradient. Suppose the number of pixels in the color gradient direction is N, then the number of color bands d = N / n, where d is the average number of pixels of each color band along the color gradient direction. Generally, in order to make the number of pixels of each color band consistent, N can be divided by n.
[0079] Through the method in this embodiment, multiple color bands can be quickly divided, and each color band can be made to have a continuous transition in color, so that each pixel in the infrared image can correspond to a color band including its color.
[0080] like Figure 3 As shown, as an optional implementation, as in the above method, the step S102 of determining the color band corresponding to each pixel in the infrared image includes the following steps:
[0081] For each pixel in the infrared image, the following steps are performed:
[0082] Step S301, obtaining the color component sum of the pixel by calculating the sum of the red value, the green value and the blue value in the RBG value of the pixel color.
[0083] After acquiring the infrared image, the RGB value of the color displayed by each pixel can be determined (the RGB color mode is a color standard in the industry, which obtains a variety of colors by changing the three color channels of red (R), green (G), and blue (B) and superimposing them on each other).
[0084] After determining the RGB value corresponding to the pixel, the red value, green value, and blue value corresponding to the pixel can be determined, and finally the red value, green value, and blue value are added together to obtain the color component sum of the pixel.
[0085] For example, the color component and s corresponding to the pixel can be calculated according to the following formula: pi :
[0086] s pi =r pi +g pi +b pi ;
[0087] When the color of pixel A is yellow, its RGB value is (255, 255, 0), that is, the red value, green value, and blue value are 255, 255, and 0 respectively, so the sum of the color components is 510.
[0088] Step S302, for each color band, according to the RBG value of each color included in the color band, calculate the color component sum of each color included in the color band; calculate the average value of the color component sum of the color band according to the number of colors included in the color band to obtain the color component average value of the color band.
[0089] After each color band is determined, for each color band, the color component sum of each color included in the color band can be calculated for the RBG value of each color included in the color band. Optionally, the pixels in the color band included in the color band can be determined, and then the RBG value of the color of the pixels in each color band can be obtained, wherein the corresponding color component sum of the pixels in each color band can be calculated with reference to the example shown in step S301.
[0090] After obtaining the color component sum of each color, the color component sum of each color may be averaged to obtain the color component average of the color band.
[0091] For example, the color component average s of the color band can be calculated by the following formula Bj :
[0092]
[0093] Among them, K is the color band B j The number of pixels in the color band.
[0094] Since the colors of pixels in each color band only change along the direction of the color gradient, and the number of pixels in each row of the color band is the same, when the colors of pixels in the color band change along the longitudinal direction, only one pixel in each row of the color band can be taken to calculate the sum of the color components, without calculating the sum of the color components of all the pixels in the color band. That is, only one color component sum is calculated for each color, and the accuracy of the average color component of the color band can still be guaranteed.
[0095] Step S303: Based on the color component of the pixel and the average color component of each color band, determine the color band corresponding to the pixel in all color bands.
[0096] After calculating the color component sum of the pixel and the color component average of each color band, the color band corresponding to the pixel can be determined among all color bands by judging which color band's color component average is closest to the color component sum of the pixel.
[0097] For example, it can be calculated by the following formula Color band f j :
[0098]
[0099] That is, the target color component average value closest to the color component of the pixel is determined among all color component average values, and then the color band corresponding to the target color component average value is used as the color band corresponding to the pixel.
[0100] Through the method in this embodiment, the color band corresponding to the pixel can be quickly determined in all color bands, thereby improving the overall efficiency of determining the heat source area.
[0101] As an optional implementation, as in the above method, when it is determined that the pixel ratios corresponding to each color band meet the preset requirements, the step S104 determines that there is a heat source area in the infrared image, including the following steps:
[0102] Step S401, determining a first color band set from all color bands based on the pixel ratio corresponding to each color band, wherein the sum of the pixel ratios of the individual color bands in the first color band set is greater than or equal to a first preset threshold, and the temperature indicated by the color bands in the first color band set is higher than the temperature indicated by other color bands in the infrared image except the first color band set.
[0103] After obtaining the pixel ratio corresponding to each color band, the pixel ratio corresponding to each color band in the infrared image can be determined.
[0104] The first color band set may include one or more color bands. The first color band set is a set of color bands corresponding to the infrared image (the color band corresponding to any pixel in the infrared image is the color band corresponding to the infrared image), indicating the highest temperature, and the sum of pixel proportions greater than or equal to the first preset threshold. The sum of pixel proportions is the sum of pixel proportions corresponding to each color band in the first color band set.
[0105] The first preset threshold may be a preset value of a minimum pixel ratio corresponding to the sum of pixel ratios of each color band in the first color band set.
[0106] The pixel proportions corresponding to each color band can be determined in descending order of the indicated temperature, and then accumulated in sequence until the sum of the pixel proportions is greater than a first preset threshold, and then the first color band set can be obtained based on the traversed color bands.
[0107] Step S402, determining a second color band set from all the color bands according to the pixel ratio of each color band, wherein the sum of the pixel ratios of the respective color bands in the second color band set is greater than or equal to a second preset threshold, and the temperature indicated by the color bands in the second color band set is lower than the temperature indicated by the other color bands in the infrared image except the second color band set;
[0108] The second color band set may include one or more color bands. The second color band set is a set of color bands corresponding to the infrared image (the color band corresponding to any pixel in the infrared image is the color band corresponding to the infrared image), indicating the lowest temperature, and the sum of pixel proportions greater than or equal to the second preset threshold. The sum of pixel proportions is the sum of pixel proportions corresponding to each color band in the second color band set.
[0109] The second preset threshold may be a preset value of a minimum pixel ratio corresponding to the sum of pixel ratios of each color band in the second color band set.
[0110] The pixel proportions corresponding to each color band can be determined in order from low to high according to the indicated temperature, and then accumulated in sequence until the sum of the pixel proportions is greater than a second preset threshold, and then the second color band set can be obtained according to the traversed color band.
[0111] Step S403, when the color band difference between the first target color band in the first color band set and the second target color band in the second color band set is greater than or equal to a third preset threshold, it is determined that there is a heat source area in the infrared image, wherein the first target color band is the color band indicating the lowest temperature among all the color bands in the first color band set, and the second target color band is the color band indicating the highest temperature among all the color bands in the second color band set, and the color band difference is used to indicate the number of color bands spaced between the first target color band and the second target color band, and the temperature indicated by the spaced color bands is lower than the temperature indicated by the first target color band and higher than the temperature indicated by the second target color band.
[0112] Because most of the color bands in an infrared image are neither hot nor cold (in the case of no heat-generating objects, there is actually almost no difference in the color bands, and they all appear as one color, which is neither hot nor cold. If there is a heat-generating object, there will be differences between the color bands. The heat-generating object is located at the hottest color band, and the part without the heat-generating object is relatively cold), the proportion of hot and cold color bands is very small, so 10% can be used to define which color bands belong to hot color bands and which color bands belong to cold color bands. When the color band difference between the first target color band and the second target color band is large, the probability of a heat-generating object in the infrared image is high. If the color band difference is small, it proves that there is no heat-generating object.
[0113] The third preset threshold may be a preset number of color bands with the smallest interval between the hottest color band (ie, the first color band set) and the coldest color band (ie, the second color band set).
[0114] Optionally, the color bands in the first color band set whose sum of pixel proportions is greater than a first preset threshold value P1 (for example, 10%) may be defined as hot color bands, that is, {B1, B2, ..., B h} for the thermal band to meet Similarly, the color bands in the second color band set whose sum of pixel proportions is greater than the second preset threshold value P2 (eg, 10%) may be regarded as cold color bands, that is, {B c ,…,B n} for the cold band If the color band difference ch between the hot color band and the cold color band is ≥T, where T is a third preset threshold, it is determined that there is a heat source area in the image, otherwise there is no heat source area.
[0115] For example, after determining the first color band set and the second color band set in the infrared image, the color band difference between the first color band set and the second color band set can be determined. And the color band difference can be the number of color bands spaced between the first target color band in the first color band set and the second target color band in the second color band set. For example, when the temperature strip is divided into n color bands, the color bands are arranged in order from high to low temperature: color band 1, color band 2, color band 3, color band 4... color band (n-1), color band n; and the pixel proportions corresponding to color band 1, color band 2, color band 3, color band 4... color band (n-1), color band n are 2%, 6%, 2%, 5%... 5%, 5% respectively. When the first preset threshold is 10% and the second preset threshold is 10%, the sum of the pixel proportions of the first color band set composed of color band 1, color band 2, and color band 3 reaches 10%, and the sum of the pixel proportions of the second color band set composed of color band (n-1) and color band n also reaches 10%; if the third preset threshold is 3, when the color band difference between color band 3 and color band (n-1) is greater than or equal to 3 (that is, (n-1)-3≥3), it can be determined that there is a heat source area in the infrared image.
[0116] Through the method in this embodiment, it is possible to quickly determine whether a heat source area exists in the infrared image based on the pixel proportions corresponding to each color band, thereby effectively improving the efficiency of the determination.
[0117] As an optional implementation, as in the above method, after determining in step S104 that there is a heat source area in the infrared image, the method further includes the following steps:
[0118] Step S501, determining a heat source area in the infrared image according to the distribution of target pixels in the infrared image, wherein the target pixels are pixels corresponding to the color bands in the first color band set.
[0119] After the first color band set corresponding to the infrared image is determined, the heat source area can be determined in the infrared image based on the pixels corresponding to the color bands in the first color band set.
[0120] The target pixel is a pixel corresponding to a color band in the first color band set. Therefore, all the target pixels can be determined by determining all the pixels corresponding to each color band in the first color band set.
[0121] Since each pixel in the infrared image is located at a specified position, the position of each target pixel in the infrared image can be obtained, and then the distribution of the target pixels in the infrared image can be determined. Based on the distribution, the area where the target pixels in the infrared image are concentrated can be obtained. In general, the higher the concentration of target pixels in an area, the higher the probability that it is a heat source area. Therefore, the heat source area can be determined in the infrared image based on the distribution of the target pixels in the infrared image.
[0122] Through the method in this embodiment, the position of the heat source area can be quickly determined based on the target pixels in the infrared image, which can effectively improve the efficiency of positioning.
[0123] like Figure 4 As shown, as an optional implementation, as in the above method, the step S501 of determining the heat source area in the infrared image according to the distribution of the target pixels in the infrared image includes the following steps:
[0124] Step S601, determining the remaining pixels except the target pixel in the infrared image.
[0125] After determining the target pixel in the infrared image, the remaining pixels except the target pixel can be determined.
[0126] Step S602, determining the saturation component value of the target pixel, and determining the saturation component values of the remaining pixels.
[0127] After determining the target pixel and the remaining pixels in the infrared image, based on the HSI color space (HIS (Hue-Saturation-Intensity) color model uses three parameters H, S, and I to describe color characteristics, where H defines the frequency of the color, called hue; S represents the depth of the color, called saturation; I represents intensity or brightness), the heat source area and the non-heat source area have obvious differences in the saturation component S. Therefore, the infrared image can be first transformed from the RGB color space to the HSI color space, and then the saturation component value of the target pixel and the saturation component value of the remaining pixels can be determined.
[0128] Step S603, binarize the infrared image to obtain a binarized image, wherein the pixel value of the first pixel corresponding to the target pixel in the binarized image is the first preset value after the saturation component value of the target pixel is binarized, and the pixel value of the second pixel corresponding to the target pixel in the binarized image is the second preset value after the saturation component value of the remaining pixels is binarized.
[0129] After obtaining the saturation component value of the target pixel and determining the saturation component values of the remaining pixels, in order to further distinguish the target pixel from the remaining pixels, the infrared image can be binarized according to the idea of known segmentation to obtain a binarized image, and the image size of the binarized image is consistent with the infrared image. The first pixel corresponding to the target pixel in the binarized image is a pixel whose position is consistent with the target pixel, and the second pixel corresponding to the target pixel in the binarized image is a pixel whose position is consistent with the remaining pixels. The pixel value of the first pixel is obtained by binarizing the saturation component value of the corresponding target pixel into a first preset value (that is, the first preset value), and the pixel value of the second pixel is obtained by binarizing the saturation component value of the corresponding remaining pixels into a second preset value (that is, the second preset value).
[0130] For example, the pixel value of the target pixel may be binarized to 255, and the pixel values of the remaining pixels may be binarized to 0 to obtain a binary image.
[0131] Step S604: determining a heat source area in the infrared image based on the first pixel and the second pixel in the binary image.
[0132] After determining the first pixel and the second pixel in the binary image, the first pixel whose pixel value is the first preset value can be connected based on the pixel values of the first pixel and the second pixel to obtain a sheet-like area connected by the target pixels, and based on the sheet-like area, a heat source area corresponding to the sheet-like area can be obtained in the infrared image.
[0133] Through the method in this embodiment, based on the binarization method, the heat source area can be quickly determined in the infrared image, thereby improving the efficiency of positioning.
[0134] like Figure 5 As shown, as an optional implementation, as in the aforementioned method, the step S604 of determining the heat source area in the infrared image based on the first pixel and the second pixel in the binary image includes the following steps:
[0135] Step S701, determining a target area in a binary image by a dilation-erosion method according to a first preset value of a first pixel and a second preset value of a second pixel, wherein a density of first pixels in the target area assigned the first preset value is higher than a preset threshold;
[0136] After the binary image corresponding to the infrared image is obtained, the target area can be determined in the binary image based on whether the pixel value of each pixel in the binary image is the first preset value or the second preset value.
[0137] The preset threshold may be a preset minimum density value corresponding to the density of the first pixel in the target area.
[0138] The dilation and erosion method belongs to the category of mathematical morphology in image processing. Its function is to link discrete points into a surface.
[0139] For example, the binarized infrared image is first expanded, using a rectangular structural element of 1×13. By expanding the binarized image (i.e., the binarized infrared image), the object part with a heat source has a relatively high temperature, so the pixel points with a value of 255 (i.e., the target pixel of the first preset value) are relatively dense. Therefore, after the expansion, the pixel points with a value of 255 will be a piece. However, the part without a heat source may also be connected into a sheet area. But in general, the area of the sheet area connected by the part without a heat source is definitely smaller than the area of the sheet area with a heat source. Therefore, it is necessary to use the corrosion method again, and the structural element used for corrosion is generally smaller than the structural element used for collision. Optionally, a 1×5 structural element can be used. At this time, the sheet area without a heat source is easily eroded because of its relatively small area, while the part with a heat source will not be eroded because its area is larger than the area of the current structural element. After the above expansion and corrosion steps, only the area with a heat source is connected into a sheet in the entire image, and then the target area is obtained.
[0140] Step S702: determining a heat source area in the infrared image according to the position information of the target area.
[0141] Since the binary image is a binarized image corresponding to the heat source area, after the target area in the binary image is determined, the heat source area can be determined in the infrared image based on the position information of the target area.
[0142] For example, when the target area is obtained and the target area is a rectangular area, the coordinate information of the pixels at the four corners of the target area can be determined, and the coordinate information can be used as the position information of the target area. Then, based on the pixels corresponding to the position information in the infrared image, the heat source area can be determined in the infrared image.
[0143] Through the method in this embodiment, the heat source area in the infrared image can be located by using the binarization and expansion corrosion method, which has the advantages of small calculation amount, good real-time performance, and strong resistance to external noise.
[0144] like Figure 6 As shown, according to an embodiment of another aspect of the present application, there is also provided an infrared image heat source area detection device, comprising:
[0145] Acquisition module 1, used to acquire infrared images for heat source location determination;
[0146] Corresponding module 2 is used to determine the color band corresponding to each pixel in the infrared image, wherein the color band is used to indicate the temperature range, the temperature difference of the temperature range corresponding to each color band is the same, and for each color band, the color of the pixel corresponding to the color band is one of all the colors included in the color band;
[0147] A proportion module 3 is used to obtain the pixel proportion of all pixels corresponding to each color band in all pixels of the infrared image by determining the pixels in the infrared image corresponding to each color band;
[0148] The determination module 4 is used to determine that there is a heat source area in the infrared image when it is determined that the pixel ratio corresponding to each color band meets the preset requirement.
[0149] Specifically, the specific process of each module in the device of the embodiment of the present invention realizing its function can be referred to the relevant description in the method embodiment, which will not be repeated here.
[0150] According to another embodiment of the present application, there is also provided an electronic device, including: Figure 7 As shown, the electronic device may include: a processor 1501 , a communication interface 1502 , a memory 1503 and a communication bus 1504 , wherein the processor 1501 , the communication interface 1502 , and the memory 1503 communicate with each other via the communication bus 1504 .
[0151] Memory 1503, used for storing computer programs;
[0152] The processor 1501 is used to implement the steps of the above method embodiment when executing the program stored in the memory 1503.
[0153] The bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0154] The communication interface is used for communication between the above electronic device and other devices.
[0155] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0156] 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, discrete hardware components.
[0157] An embodiment of the present application further provides a computer-readable storage medium, the storage medium including a stored program, wherein the method steps of the above method embodiment are executed when the program is run.
[0158] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0159] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A method for detecting heat source areas in infrared images, characterized in that: include: Acquire infrared images required for heat source location determination; Determine a color band corresponding to each pixel in the infrared image, wherein the color band is used to indicate a temperature range, the temperature difference of the temperature range corresponding to each color band is the same, and for each color band, the color of the pixel corresponding to the color band is one of all the colors included in the color band; By determining the pixels in the infrared image corresponding to each of the color bands, a pixel ratio of all pixels corresponding to each of the color bands in all pixels in the infrared image is obtained; When it is determined that the pixel ratio corresponding to each of the color bands meets the preset requirements, it is determined that there is a heat source area in the infrared image: according to the pixel ratio corresponding to each of the color bands, a first color band set is determined from all the color bands, wherein the sum of the pixel ratios of the color bands in the first color band set is greater than or equal to a first preset threshold, and the temperature indicated by the color bands in the first color band set is higher than the temperature indicated by other color bands in the infrared image except the first color band set; according to the pixel ratio of each of the color bands, a second color band set is determined from all the color bands, wherein the sum of the pixel ratios of the color bands in the second color band set is greater than or equal to a second preset threshold, and the temperature indicated by the color bands in the second color band set is lower than the temperature indicated by the infrared image The temperature indicated by other color bands in the infrared image except the second color band set; when the color band difference between the first target color band in the first color band set and the second target color band in the second color band set is greater than or equal to a third preset threshold, it is determined that the heat source area exists in the infrared image, wherein the first target color band is the color band indicating the lowest temperature among all the color bands in the first color band set, and the second target color band is the color band indicating the highest temperature among all the color bands in the second color band set, and the color band difference is used to indicate the number of color bands spaced between the first target color band and the second target color band, and the temperature indicated by the spaced color bands is lower than the temperature indicated by the first target color band and higher than the temperature indicated by the second target color band.
2. The method according to claim 1, characterized in that Before determining the color band corresponding to each pixel in the infrared image, the method further includes: determining a temperature bar for identifying the infrared image, wherein each color in the temperature bar is used to indicate a unique temperature; The temperature strip is evenly divided according to a preset number of color bands to obtain at least two color bands.
3. The method according to claim 1, characterized in that Determining the color band corresponding to each pixel in the infrared image comprises: The following steps are performed for any pixel in the infrared image: The color component sum of the pixel is obtained by calculating the sum of the red value, the green value and the blue value in the RBG value of the color of the pixel; For each of the color bands, the color component sum of each color included in the color band is calculated according to the RBG value of each color included in the color band; the color component sum of the color band is averaged according to the number of colors included in the color band to obtain the color component average of the color band; The color band corresponding to the pixel is determined in all the color bands based on the color component sum of the pixel and an average color component value of each of the color bands.
4. The method according to claim 1, characterized in that: After determining that the heat source area exists in the infrared image, the method further includes: The heat source area is determined in the infrared image according to the distribution of target pixels in the infrared image, wherein the target pixels are pixels corresponding to the color bands in the first color band set.
5. The method according to claim 4, characterized in that Determining the heat source area in the infrared image according to the distribution of the target pixels in the infrared image includes: Determining remaining pixels in the infrared image except the target pixel; Determining a saturation component value of the target pixel, and determining a saturation component value of the remaining pixels; Binarization is performed on the infrared image to obtain a binarized image, wherein the pixel value of a first pixel corresponding to the target pixel in the binarized image is a first preset value after the saturation component value of the target pixel is binarized, and the pixel value of a second pixel corresponding to the target pixel in the binarized image is a second preset value after the saturation component value of the remaining pixels is binarized; The heat source area is determined in the infrared image based on the first pixel and the second pixel in the binary image.
6. The method according to claim 5, characterized in that The determining the heat source area in the infrared image based on the first pixel and the second pixel in the binary image includes: Determine a target area in the binary image by a dilation-erosion method according to a first preset value of the first pixel and a second preset value of the second pixel, wherein a density of the first pixels in the target area assigned the first preset value is higher than a preset threshold; The heat source area is determined in the infrared image according to the position information of the target area.
7. An infrared image heat source area detection device, characterized in that: include: An acquisition module, used to acquire infrared images required for heat source location determination; A corresponding module, used for determining a color band corresponding to each pixel in the infrared image, wherein the color band is used to indicate a temperature range, the temperature difference of the temperature range corresponding to each color band is the same, and for each color band, the color of the pixel corresponding to the color band is one of all the colors included in the color band; A proportion module, used for obtaining the pixel proportion of all pixels corresponding to each color band in all pixels of the infrared image by determining the pixels in the infrared image corresponding to each color band; A determination module, used to determine that there is a heat source area in the infrared image when it is determined that the pixel ratio corresponding to each of the color bands meets the preset requirements: determine a first color band set from all the color bands according to the pixel ratio corresponding to each of the color bands, wherein the sum of the pixel ratios of each color band in the first color band set is greater than or equal to a first preset threshold, and the temperature indicated by the color bands in the first color band set is higher than the temperature indicated by other color bands in the infrared image except the first color band set; determine a second color band set from all the color bands according to the pixel ratio of each of the color bands, wherein the sum of the pixel ratios of each color band in the second color band set is greater than or equal to a second preset threshold, and the temperature indicated by the color bands in the second color band set is lower than the temperature indicated by the first color band set. The temperatures indicated by the color bands other than the second color band set in the infrared image; when the color band difference between the first target color band in the first color band set and the second target color band in the second color band set is greater than or equal to a third preset threshold, it is determined that the heat source area exists in the infrared image, wherein the first target color band is the color band indicating the lowest temperature among all the color bands in the first color band set, and the second target color band is the color band indicating the highest temperature among all the color bands in the second color band set, and the color band difference is used to indicate the number of color bands spaced between the first target color band and the second target color band, and the temperature indicated by the spaced color bands is lower than the temperature indicated by the first target color band and higher than the temperature indicated by the second target color band.
8. An electronic device, characterized in that: include: A processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; The memory is used to store computer programs; The processor is used to implement the method according to any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, characterized in that: The storage medium includes a stored program, wherein the program executes the method according to any one of claims 1 to 6 when executed.
Citation Information
Patent Citations
Safety monitoring method and equipment, and computer readable storage medium
CN110501914A