Target detection method, electronic device, and intelligent control system

By generating grayscale images and processing infrared images using multiple grayscale thresholds, the problem of infrared sensors being affected by ambient temperature in target detection is solved, achieving more accurate target detection.

CN114881978BActive Publication Date: 2025-11-28QINGDAO HISENSE SMART LIFE TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210523981.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-13
Publication Date
2025-11-28
Estimated Expiration
2042-05-13

AI Technical Summary

Technical Problem

Infrared sensors are susceptible to the influence of ambient temperature in target detection, resulting in poor detection accuracy.

Method used

By generating grayscale images and binarizing infrared images using multiple grayscale thresholds determined based on the average pixel energy value, multiple binarized images are generated to determine the location of the target object.

Benefits of technology

This effectively avoids the interference of ambient temperature on binarization processing, ensuring the accuracy of target detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114881978B_ABST
    Figure CN114881978B_ABST
Patent Text Reader

Abstract

The application discloses a target detection method, an electronic device and an intelligent control system. The electronic device can generate a grayscale image based on infrared image data collected by an infrared sensor, and process the grayscale image using multiple different grayscale threshold values to obtain multiple binary images for detecting the position of a target object. The multiple grayscale threshold values are determined based on the average value of the energy values of multiple pixels in the infrared image data. Since the energy values of the multiple pixels are related to the ambient temperature, the interference caused by the ambient temperature on the binary processing can be effectively avoided. Furthermore, the binary image can accurately reflect the temperature of each sub-region in the detection region, thereby ensuring the accuracy of target detection.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of electronics, and in particular to a target detection method, an electronic device, and an intelligent control system. BACKGROUND

[0002] As a kind of non-contact sensor, infrared sensor is widely used in target detection field.For example, in the smart home scenario, the position of user can be detected by infrared sensor, and the working state of home equipment can be adjusted according to the position of user.For example, the air direction of air conditioner can be adjusted.

[0003] In the related art, the infrared image collected by infrared sensor can be converted into a binary image, and the position of target object (such as user) can be determined based on the binary image.

[0004] However, the data collected by infrared sensor is easily affected by environmental temperature, which leads to poor accuracy of target detection. SUMMARY

[0005] The present application provides a target detection method, an electronic device and an intelligent control system, which can solve the problem of poor accuracy of target detection in the related art.The technical solution is as follows:

[0006] On the one hand, a target detection method is provided, which comprises:

[0007] Obtain the infrared image data of detection area collected by infrared sensor, the infrared image data includes the energy value of multiple pixels, the multiple pixels correspond to multiple sub-regions of the detection area one by one, and the energy value of each pixel is related to the temperature of the sub-region corresponding to the pixel;

[0008] Generate a gray scale image according to the infrared image data;

[0009] Determine multiple gray scale thresholds according to the mean value of the energy value of multiple pixels, the multiple gray scale thresholds are different from each other, and are positively correlated with the mean value of the energy value of multiple pixels;

[0010] Respectively, each gray scale threshold is used to perform binaryzation processing on the gray scale image to obtain multiple binary images;

[0011] Determine the position of target object in the detection area according to the multiple binary images.

[0012] On the other hand, an electronic device is provided, which comprises an infrared sensor and a processor.

[0013] The infrared sensor is configured to collect infrared image data of the detection area, the infrared image data including energy values of a plurality of pixels, the plurality of pixels corresponding to a plurality of sub-areas of the detection area one by one, and each energy value of the plurality of pixels being related to a temperature of a sub-area corresponding to the pixel;

[0014] The processor is configured to:

[0015] generate a grayscale image according to the infrared image data;

[0016] determine a plurality of grayscale thresholds according to the mean value of the energy values of the plurality of pixels, the plurality of grayscale thresholds being different from each other;

[0017] perform binarization processing on the grayscale image by using each of the grayscale thresholds respectively to obtain a plurality of binarization images;

[0018] determine a position of a target object in the detection area according to the plurality of binarization images.

[0019] Optionally, the processor is configured to:

[0020] determine a plurality of energy thresholds according to the mean value of the energy values of the plurality of pixels;

[0021] obtain a plurality of grayscale thresholds corresponding to the plurality of energy thresholds according to a conversion relationship between energy values and grayscale values;

[0022] wherein each energy threshold satisfies any one of the following conditions:

[0023] greater than or equal to the mean value and less than a maximum value of the energy values of the plurality of pixels;

[0024] less than the mean value and a difference between the mean value and the energy threshold being less than a difference threshold.

[0025] Optionally, a number of the plurality of energy thresholds is N, and N is an integer greater than 1.

[0026] wherein an i-th energy threshold P i satisfies: P i =P ave +x i ×(P max -P ave );

[0027] i is a positive integer not greater than N, x i represents a weight coefficient of the i-th energy threshold, P max represents the maximum value of the energy values of the plurality of pixels, and P ave represents the mean value of the energy values of the plurality of pixels.

[0028] Optionally, the processor is configured to:

[0029] The energy values of the pixels in the infrared image data are processed by using a conversion relationship between energy value and temperature value to obtain temperature image data, the temperature image data comprising temperature values of a plurality of pixels;

[0030] A grayscale image is obtained by processing the temperature values of the pixels in the temperature image data by using a conversion relationship between temperature value and grayscale value.

[0031] The conversion relationship between temperature value and grayscale value is determined based on an ambient temperature.

[0032] Optionally, the conversion relationship between temperature value and grayscale value satisfies:

[0033] G=(T-T min ) / (T max -T min )×255;

[0034] wherein G represents a grayscale value, T represents a temperature value, T min is a first temperature threshold, T max is a second temperature threshold, and the first temperature threshold and the second temperature threshold are positively correlated with the ambient temperature.

[0035] Optionally, the conversion relationship between energy value and temperature value satisfies:

[0036] T=(P-K) / R e +T B ;

[0037] wherein T represents a temperature value, P represents an energy value, K represents a reference energy value, R e represents a conversion coefficient of energy value and temperature value, and T B represents a temperature of the infrared sensor.

[0038] Optionally, the processor is configured to:

[0039] generate an initial image from the infrared image data, the initial image comprising grayscale values of a plurality of pixels, and the number of pixels in the initial image is equal to the number of pixels in the infrared image data;

[0040] filter and interpolate the initial image in sequence to obtain a grayscale image, the number of pixels in the grayscale image being greater than the number of pixels in the initial image.

[0041] Optionally, the processor is configured to:

[0042] determining at least one candidate binarization image from the plurality of binarization images, each of the candidate binarization images having a target region with an area greater than an area threshold, the target region being a region with a gray value equal to a target value;

[0043] determining a position of the target object within the target region according to the target region in the at least one candidate binarization image.

[0044] In yet another aspect, an electronic device is provided, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor implementing the target detection method according to the above aspect when executing the computer program.

[0045] In yet another aspect, a computer readable storage medium is provided, which stores a computer program, the computer program being loaded and executed by a processor to implement the target detection method according to the above aspect.

[0046] In yet another aspect, a computer program product containing instructions which, when the computer program product is executed on a computer, cause the computer to carry out the target detection method according to the above aspect.

[0047] In yet another aspect, an intelligent control system is provided, which includes a controlled device and the electronic device according to the above aspect.

[0048] The electronic device is configured to control a working state of the controlled device according to the position of the target object within the detection region.

[0049] The technical scheme provided in the present application has at least the following beneficial effects:

[0050] The present application provides a target detection method, an electronic device, and an intelligent control system. The electronic device can generate a gray scale image based on infrared image data collected by an infrared sensor, and process the gray scale image using a plurality of different gray scale thresholds to obtain a plurality of binarization images for detecting the position of a target object. The plurality of gray scale thresholds are determined based on the average value of the energy values of a plurality of pixels in the infrared image data. Since the energy values of the plurality of pixels are related to the ambient temperature, the interference caused by the ambient temperature on the binarization processing can be effectively avoided. Furthermore, the binarization images can accurately reflect the temperature of each sub-region within the detection region, thereby ensuring the accuracy of target detection. BRIEF DESCRIPTION OF DRAWINGS

[0051] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort on the basis of these drawings.

[0052] Figure 1 is a structural schematic diagram of an intelligent control system provided by an embodiment of the present application;

[0053] Figure 2 is a flowchart of a target detection method provided by an embodiment of the present application;

[0054] Figure 3 is a flowchart of another target detection method provided by an embodiment of the present application;

[0055] Figure 4 is a schematic diagram of processing an initial image by an electronic device provided by an embodiment of the present application;

[0056] Figure 5 is a schematic diagram of a plurality of binarized images obtained after binarization processing of a gray-scale image provided by an embodiment of the present application;

[0057] Figure 6 is a structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0058] In order to make the purpose, technical solutions and advantages of the present application more clear, the embodiments of the present application will be further described in detail with reference to the drawings.

[0059] Figure 1 is a structural schematic diagram of an intelligent control system provided by an embodiment of the present application. Referring to Figure 1 , the system can include an electronic device 10 and a controlled device 20. A wired or wireless communication connection is established between the electronic device 10 and the controlled device 20.

[0060] Among them, the electronic device 10 is a device with target detection function, and the electronic device 10 can adjust the working state of the controlled device 20 according to the position of the detected target object. Among them, the controlled device 20 can be an air conditioner, a lamp, a television, a door lock, a fan or an extractor hood, etc. smart home device, accordingly, the intelligent control system can be a smart home system. Or, the controlled device 20 can be a vehicle-mounted device or other types of devices.

[0061] In this embodiment of the application, the infrared sensor in the electronic device 10 can collect infrared image data of its detection area and process the infrared image data to determine whether there is a target object in the detection area.

[0062] For example, if the controlled device 20 is an air conditioner, the target object for the target detection performed by the electronic device 10 can be a user. When the electronic device 10 determines that a user exists in its detection area based on the infrared image data collected by the infrared sensor, it can control the on / off state, airflow direction, and temperature of the air conditioner based on the user's location in the detection area.

[0063] Figure 2 This is a flowchart of a target detection method provided in an embodiment of this application. This method can be applied to... Figure 1 The electronic device shown. (Reference) Figure 2 The method includes the following steps:

[0064] Step 101: Obtain infrared image data of the detection area collected by the infrared sensor.

[0065] In this embodiment, an infrared sensor is provided in the electronic device. This infrared sensor can detect its detection area in real time and generate infrared image data of the detection area. The infrared image data includes energy values ​​of multiple pixels, each pixel corresponding one-to-one with multiple sub-regions of the detection area. The energy value of each pixel is related to the temperature of its corresponding sub-region. That is, the energy value of each pixel can reflect the temperature of its corresponding sub-region; for example, the energy value of each pixel can be positively correlated with the temperature of its corresponding sub-region.

[0066] Step 102: Generate a grayscale image based on the infrared image data.

[0067] In this embodiment, the electronic device can convert the energy value of each pixel in the infrared image data into a grayscale value based on a pre-configured conversion relationship between energy value and grayscale value, thereby obtaining a grayscale image. This grayscale image includes the grayscale values ​​of multiple pixels.

[0068] Optionally, the conversion relationship between energy value and grayscale value may include: the conversion relationship between energy value and temperature value, and the conversion relationship between temperature value and grayscale value. Accordingly, the electronic device may first convert the energy values ​​of the multiple pixels into temperature values, and then convert the temperature values ​​into grayscale values ​​to obtain a grayscale image.

[0069] Step 103: Determine multiple grayscale thresholds based on the average energy values ​​of multiple pixels.

[0070] In the embodiment of the present application, the electronic device can calculate the mean value of the energy values of the plurality of pixels in the infrared image data, and determine a plurality of different gray threshold values based on the mean value. Each of the gray threshold values is positively correlated with the mean value of the energy values.

[0071] For example, the electronic device can first determine a plurality of different energy threshold values based on the mean value of the energy values of the plurality of pixels. Then, based on the conversion relationship between the energy values and the gray values, the plurality of gray threshold values corresponding to the plurality of energy threshold values are determined.

[0072] In step 104, the gray image is binarized using each of the gray threshold values respectively to obtain a plurality of binarized images.

[0073] Each of the plurality of binarized images is obtained based on a gray threshold value. In the process of binarizing the gray image using any of the gray threshold values, the electronic device can set the gray value of the pixel in the gray image whose gray value is greater than or equal to the gray threshold value to a first gray value, and set the gray value of the pixel in the gray image whose gray value is less than the gray threshold value to a second gray value. The first gray value can be 255, and the second gray value can be 0. Alternatively, the first gray value can be 0, and the second gray value can be 255.

[0074] It can be understood that, since the plurality of gray threshold values determined by the electronic device are different from each other, the plurality of binarized images determined based on the plurality of gray threshold values are also different from each other.

[0075] In the embodiment of the present application, the gray threshold value used by the electronic device when binarizing the gray image is not a fixed value, but is determined based on the mean value of the plurality of energy values in the infrared image data, and the plurality of energy values are related to the temperature. Therefore, the plurality of gray threshold values are also related to the ambient temperature of the environment in which the infrared sensor is located. Therefore, binarizing the gray image based on the plurality of gray threshold values can effectively reduce the interference of the external ambient temperature on the binarization process.

[0076] In step 105, the position of the target object in the detection area is determined according to the plurality of binarized images.

[0077] The electronic device can determine a target region in each of the binarized images, and the target region is a region whose gray value is a target value. The target value can be the first gray value. Then, the electronic device can determine the position of the target object in the detection area based on the overlapping region of the target regions in the plurality of binarized images. For example, the electronic device can determine the position of the overlapping region as the position of the target object.

[0078] It can be understood that the temperature of the target object (e.g., a user) detected by the electronic device is generally higher than the ambient temperature of the environment in which the target object is located. In the conversion relationship between the energy value and the temperature value, the temperature value is positively correlated with the energy value, and in the conversion relationship between the temperature value and the gray value, the gray value is positively correlated with the temperature value. Therefore, the gray value is also positively correlated with the energy value. If there is a target object in the detection area of the electronic device, the gray value of the area where the target object is located in the gray image generated by the electronic device is relatively high. Therefore, after the gray image is converted into a binary image, the area formed by the pixels with the target value in the binary image can be determined as the target area. The probability of the target area having a target object is greater than that of other areas in the binary image except the target area.

[0079] It can also be understood that, since the electronic device can determine a plurality of binary images based on different gray threshold values, and determine the position of the target object based on the overlapping area of the target areas of the plurality of binary images, the position of the target object determined by the electronic device can be ensured to be more accurate.

[0080] In summary, the embodiment of the present application provides a target detection method. The electronic device can generate a gray image based on the infrared image data collected by the infrared sensor, and process the gray image using a plurality of different gray threshold values to obtain a plurality of binary images for detecting the position of the target object. The plurality of gray threshold values are determined based on the average value of the energy values of a plurality of pixels in the infrared image data. Since the energy values of the plurality of pixels are related to the ambient temperature, the interference caused by the ambient temperature on the binary processing can be effectively avoided. Further, it can be ensured that the binary image can accurately reflect the temperature of each sub-area in the detection area, thereby ensuring the accuracy of target detection.

[0081] Figure 3 is a flowchart of another target detection method provided by the embodiment of the present application. The method can be applied to the electronic device shown in Figure 1 . Referring to Figure 3 , the method comprises the following steps:

[0082] Step 201: Obtain the infrared image data of the detection area collected by the infrared sensor.

[0083] In this embodiment, an infrared sensor is provided in the electronic device. This infrared sensor can detect its detection area in real time and generate infrared image data of the detection area. The infrared image data includes energy values ​​of multiple pixels, each pixel corresponding one-to-one with multiple sub-regions of the detection area. The energy value of each pixel is related to the temperature of its corresponding sub-region. That is, the energy value of each pixel can reflect the temperature of its corresponding sub-region; for example, the energy value of each pixel can be positively correlated with the temperature of its corresponding sub-region.

[0084] The infrared sensor can be an infrared thermopile sensor, which includes multiple arrays of thermocouples, enabling temperature detection over a two-dimensional region. For example, assuming the infrared thermopile sensor includes N linear thermocouple arrays, and each array includes P thermocouples, the N×P thermocouples can form a P-row, N-column area array. Here, N and P are both integers greater than 1. For example, N = 80, P = 60. Correspondingly, the detection area of ​​the infrared sensor can be divided into N×P sub-regions, with each thermocouple corresponding to one sub-region and capable of detecting the energy value of that sub-region. That is, the infrared image data can include the energy values ​​of N×P pixels, with each pixel's energy value being the energy value detected by a thermocouple. In this embodiment, the energy value detected by each thermocouple can also be called a lumen value, and the value of each lumen value detected by each thermocouple can be a number greater than or equal to 7000 and less than 8500.

[0085] Step 202: Using the conversion relationship between energy value and temperature value, process the energy value of each pixel in the infrared image data to obtain temperature image data.

[0086] In this embodiment, the electronic device can convert the energy value of each pixel in the infrared image data into a temperature value based on a pre-configured conversion relationship between energy and temperature values, thereby obtaining temperature image data, which includes the temperature values ​​of multiple pixels. For example, if the infrared sensor includes 80×60 thermocouples, then the temperature image data includes the temperature values ​​of 80×60 pixels. The conversion relationship between energy and temperature values ​​can satisfy:

[0087] T = (PK) / R e +T B Formula (1)

[0088] In formula (1), T represents the temperature value, P represents the energy value, and K represents the preset reference energy value, which can be determined based on the performance parameters of the infrared sensor. For example, this reference energy value can be 8191. erepresents a conversion coefficient between the preset energy value and the temperature value, which can be determined based on a performance parameter of the infrared sensor and an ambient temperature of an application scenario of the electronic device. The conversion coefficient R e may be greater than or equal to 20 and less than 60, for example, can be equal to 30. T B represents a reference temperature, which is related to the ambient temperature. For example, the reference temperature T B may be a temperature of a substrate of the infrared sensor, or can be the ambient temperature. In the embodiments of the present application, a temperature sensor can be arranged on the substrate to detect the temperature of the substrate.

[0089] Step 203, processing the temperature value of each pixel in the temperature image data by using the conversion relationship between the temperature value and the gray value, to obtain an initial image.

[0090] After obtaining the temperature image, the electronic device can convert the temperature value of each pixel in the temperature image data into a gray value based on the pre-configured conversion relationship between the temperature value and the gray value, to obtain an initial image. The initial image includes gray values of a plurality of pixels, and the number of pixels in the initial image is equal to the number of pixels in the temperature image data. For example, the initial image can include gray values of 80x60 pixels.

[0091] In addition, in the embodiments of the present application, the conversion relationship between the temperature value and the gray value can be determined based on the ambient temperature, that is, the conversion relationship between the temperature value and the gray value is different at different ambient temperatures. The conversion relationship between the temperature value of each pixel in the temperature image data and the gray value of each pixel in the corresponding initial image satisfies:

[0092] G = (T-T min ) / (T max -T min ) x 255 Formula (2)

[0093] In formula (2), G represents a gray value, which can be an integer greater than or equal to 0 and less than or equal to 255. T represents a temperature value, T min is a first temperature threshold, and T max is a second temperature threshold. The second temperature threshold T max is greater than the first temperature threshold T min , and the first temperature threshold T min and the second temperature threshold T max are positively correlated with the ambient temperature. That is, the higher the ambient temperature, the higher the first temperature threshold T min and the second temperature threshold T max .

[0094] Optionally, the first temperature threshold T min may be equal to the first temperature value, and the second temperature threshold T max may be a second temperature value, which is greater than the first temperature value. When the minimum value of the temperature values of the plurality of pixels in the temperature image data is greater than the second temperature value, the first temperature threshold T min may be equal to the second temperature value, and the second temperature threshold T max may be a third temperature value, which is greater than the second temperature value.

[0095] In an example, the first temperature value can be 20 degrees Celsius (℃), the second temperature value can be 32℃, and the third temperature value can be 38℃.

[0096] It can be understood that the environment in which the electronic device performs target detection is generally indoor, and the temperature value of the environment in which the electronic device is located is generally between 20℃ and 30℃, and the temperature value of the target object (for example, a person) is generally between 35℃ and 38℃. When there is a cold air flow in the environment, the temperature values of the plurality of pixels in the temperature image data will be affected by the cold air flow and will be lower. When there is a hot air flow in the environment, the temperature values of the plurality of pixels in the temperature image data will be affected by the hot air flow and will be higher. Therefore, in the process of converting the temperature values of the plurality of pixels in the temperature image data into gray scale values, the first temperature threshold T min and the second temperature threshold T max based on the minimum value of the current environment temperature can effectively reduce the influence of external environmental factors on the conversion process.

[0097] In step 204, the initial image is sequentially filtered and interpolated to obtain a gray scale image.

[0098] In the embodiments of the present application, the electronic device can perform filtering processing on the initial image to reduce noise in the initial image. Then, the electronic device can perform interpolation processing on the initial image to enlarge the size of the initial image to obtain a gray scale image. The number of pixels in the gray scale image is greater than the number of pixels in the initial image.

[0099] Optionally, in order to retain the detailed features of the initial image in the filtering process, the electronic device can use a median filtering method to filter the initial image. For example, for the gray scale value of each pixel, the gray scale values of the pixels in its 3x3 neighborhood can be used for median filtering. In an example, reference is made to (a) in FIG. 8, which is an initial image obtained based on infrared image data, Figure 4 Figure 4 (b) is the initial image after filtering processing. Figure 4

[0100] ​​And, in order to make the target object more prominent in the initial image, a bicubic interpolation algorithm can be used to enlarge the filtered initial image. Figure 4 (c) in (3) is a gray image obtained after interpolation processing. For example, for an initial image with a length of 80 pixels and a width of 60 pixels, i.e., an initial image with a resolution of 80*60, after being enlarged by 4 times by the bicubic interpolation algorithm, the resolution is 320*240. It can be understood that the larger the size of the initial image, the more pixels the target object in the initial image includes, and the easier it is to process the image.

[0101] Step 205, determining a plurality of energy thresholds according to the mean value of the energy values of the plurality of pixels.

[0102] After the above step 201, the electronic device can calculate the mean value of the energy values of the plurality of pixels in the infrared image data, and determine a plurality of mutually different energy thresholds based on the mean value. Each energy threshold can satisfy any one of the following conditions:

[0103] Condition 1: greater than or equal to the mean value, and less than the maximum value of the energy values of the plurality of pixels;

[0104] Condition 2: less than the mean value, and the difference from the mean value is less than the difference threshold.

[0105] Based on the above condition 1, the electronic device can determine a plurality of mutually different energy thresholds between the mean value and the maximum value of the energy values of the plurality of pixels. Assuming that the electronic device determines N energy thresholds, N is an integer greater than 1, then the i-th energy threshold P i satisfies:

[0106] P i = P ave +x i ×(P max -P ave ) Formula (3)

[0107] In the above formula (3), i is a positive integer not greater than N, x i represents the weight coefficient of the i-th energy threshold, P max represents the maximum value of the energy values of the plurality of pixels, and P ave represents the mean value of the energy values of the plurality of pixels. The weight coefficients of the N energy thresholds are N different coefficients set in advance, and the energy thresholds determined based on the N weight coefficients are also different. For example, assuming that N is equal to 5, the weight coefficients of the 5 energy thresholds can refer to Table 1.

[0108] Table 1

[0109] Energy threshold i=1 i=2 i=3 i=4 i=5 Weighting factor 0.8 0.6 0.4 0.2 0.1

[0110] In condition 2, the electronic device can determine a plurality of energy thresholds with a difference from the mean value less than a difference threshold among the energy values less than the mean value. The difference threshold is a pre-configured smaller value, so that the plurality of energy thresholds determined are close to the mean value. For example, the energy threshold can be 200. If the mean value of the energy values is 7800, the plurality of energy thresholds can be determined between 7600 and 7800.

[0111] In step 206, a plurality of gray threshold values corresponding to the plurality of energy threshold values are obtained according to a conversion relationship between the energy values and the gray values.

[0112] In the embodiments of the present application, the electronic device can convert the plurality of energy threshold values into gray threshold values based on the pre-configured conversion relationship between the energy values and the gray values. Since the plurality of energy threshold values are different from each other, the plurality of gray threshold values corresponding to the plurality of energy threshold values are also different from each other.

[0113] As described in steps 202 and 203, the conversion relationship between the energy values and the gray values can include a conversion relationship between the energy values and the temperature values, and a conversion relationship between the temperature values and the gray values. Accordingly, the electronic device can first convert the plurality of energy threshold values into temperature threshold values, and then convert the temperature threshold values into gray threshold values. For example, the plurality of energy threshold values can be first converted into a plurality of temperature threshold values according to formula (1), and then the plurality of temperature threshold values can be converted into a plurality of gray threshold values according to formula (2).

[0114] In step 207, the gray image is binarized by using each gray threshold value respectively to obtain a plurality of binarized images.

[0115] Each binarized image in the plurality of binarized images is obtained based on one gray threshold value. In the process of binarizing the gray image by using any gray threshold value, the electronic device can set the gray value of the pixel with a gray value greater than or equal to the gray threshold value in the gray image to a first gray value, and set the gray value of the pixel with a gray value less than the gray threshold value in the gray image to a second gray value, so as to obtain a binarized image including only the first gray value and the second gray value. The first gray value can be 255, and the second gray value can be 0. Alternatively, the first gray value can be 0, and the second gray value can be 255.

[0116] It can be understood that, since the plurality of gray threshold values determined by the electronic device are different from each other, the plurality of binarized images determined based on the plurality of gray threshold values are also different from each other. Since the gray value is positively correlated with the temperature value, the plurality of binarized images can be understood as binarized images at different temperatures.

[0117] For example, if five grayscale thresholds are determined in step 206 above, then the five binarized images determined based on these five grayscale thresholds can be as follows: Figure 5 As shown in (a) to (e) of the diagram. Figure 5 The grayscale threshold corresponding to (a) in the figure is determined based on the energy threshold with a weighting coefficient of 0.8. Figure 5 The grayscale threshold corresponding to (b) in the example is determined based on an energy threshold with a weighting coefficient of 0.6. Figure 5 The grayscale threshold corresponding to (c) is determined based on the energy threshold with a weighting coefficient of 0.4. Figure 5 The grayscale threshold corresponding to (d) in the figure is determined based on the energy threshold with a weighting coefficient of 0.2. Figure 5 The grayscale threshold corresponding to (e) is determined based on the energy threshold with a weighting coefficient of 0.1.

[0118] In this embodiment, the grayscale threshold used by the electronic device when binarizing a grayscale image is not a fixed value, but is determined based on the average of multiple energy values ​​in the infrared image data, and these multiple energy values ​​are related to temperature. Therefore, these multiple grayscale thresholds are also related to the ambient temperature of the environment where the infrared sensor is located. Thus, binarizing the grayscale image based on these multiple grayscale thresholds can effectively reduce the interference of external ambient temperature on the binarization process.

[0119] Step 208: Determine at least one candidate binarized image from a plurality of binarized images.

[0120] After determining multiple binarized images, the electronic device can identify a target region within each binarized image. This target region is a region whose grayscale value is a target value. The electronic device can then select binarized images whose target region area is greater than an area threshold as candidate binarized images. This area threshold can be an area value pre-stored in the electronic device, and the target value can be a first grayscale value.

[0121] It is understandable that the temperature of the target object (such as a user) detected by an electronic device is generally higher than the ambient temperature of the environment in which the target object is located. In the conversion relationship between energy and temperature values, temperature and energy values ​​are positively correlated, and in the conversion relationship between temperature and grayscale values, grayscale values ​​are positively correlated with temperature values. Therefore, grayscale values ​​are also positively correlated with energy values. If a target object exists in the detection area of ​​the electronic device, the grayscale value of the area containing the target object will be relatively high in the grayscale image generated by the electronic device. Therefore, after converting the grayscale image into a binary image, the area composed of pixels with a first grayscale value in the binary image can be identified as the area where the target object is located, i.e., the target area. The probability of the target object being present in this target area is greater than in other areas of the binary image besides the target area.

[0122] For example, assuming in Figure 5 In the five binarized images shown, the first grayscale value is 255, and the second grayscale value is 0. Therefore, the region formed by pixels with a grayscale value of 255 in each binarized image (i.e., the white region) is the target region. (Reference) Figure 5 It can be seen that the larger the weighting coefficient of the energy threshold, the smaller the area of ​​the white region in the binarized image; that is, the larger the grayscale threshold, the smaller the area of ​​the target region in the binarized image determined based on that grayscale threshold. Furthermore, the five white regions in these five binarized images overlap.

[0123] It is also understandable that when the area of ​​the target region in the binarized image is small, the electronic device can determine that there is no target object in the detection area corresponding to the binarized image. Therefore, no further processing of the binarized image is required. When the electronic device determines that the area of ​​the target region in multiple binarized images is less than the area threshold, it is determined that there is no target object in the detection area, and the electronic device does not need to process the multiple binarized images.

[0124] Step 209: Determine the location of the target object within the target region based on the target region in at least one candidate binarized image.

[0125] In this embodiment of the application, the electronic device can first determine the overlapping region of the target region in the at least one candidate binary image, and determine the position of the overlapping region as the position of the target object.

[0126] Alternatively, the electronic device can first determine the intersection-union ratio (IUGR) of the target regions in the at least one candidate binary images and then determine whether the IUGR is greater than a preset ratio (e.g., 0.5). The IUGR refers to the ratio of the area of ​​the intersection to the area of ​​the union of the target regions in the candidate binary images. If the IUGR is greater than the preset ratio, the electronic device can determine the overlapping area (i.e., the intersection of the target regions) of the target regions in the at least one candidate binary images as the region where the target object is located. Furthermore, the location of the target object can be determined.

[0127] If the intersection-over-union ratio (IoU) of the target regions in the at least one candidate binarized image is less than a preset ratio, the electronic device can determine that there is an interfering object other than the target object in the detection area. To accurately determine the location of the target object, the electronic device can process the overlapping areas of the target regions in the at least one candidate binarized image based on a pre-stored target detection algorithm to determine the location of the target object.

[0128] For example, the electronic device pre-stores a reference shape, which can be determined based on the shape of the target object. The electronic device can determine, as the region where the target object is located, a region in the overlapping region where the shape matches the reference shape. Alternatively, the electronic device pre-stores a reference temperature value, which can be determined based on the temperature (e.g., the temperature of a human face) of the target object. The electronic device can determine, as the region where the target object is located, a region in the overlapping region where the temperature value matches the pre-stored reference temperature value. Alternatively, the electronic device can combine the shape and the temperature, and determine, as the region where the target object is located, a region in the overlapping region where the shape matches the reference shape and the temperature matches the reference temperature value.

[0129] In an embodiment of the present application, the electronic device can further control the working state of the controlled device based on the determined position of the target object. For example, the electronic device can control the controlled device to be turned on, or adjust the orientation of the controlled device.

[0130] Alternatively, after determining the position of the target object, the electronic device can further obtain the temperature of the region corresponding to the position of the target object in the temperature image data (i.e., the temperature of the target object), and then control the working state of the controlled device based on the temperature of the region.

[0131] For example, assuming that the controlled device is an air conditioner, after detecting the target object (i.e., the user) in the detection region, the electronic device can control the air conditioner to switch from the default off state to the on state. Alternatively, the electronic device can control the air direction of the air conditioner according to the position of the user, so that the air direction of the air conditioner is aligned with or deviates from the user. Alternatively, the electronic device can adjust the temperature of the air conditioner according to the detected temperature of the user. In this way, the experience of the user can be effectively ensured.

[0132] In an embodiment of the present application, the electronic device can determine a plurality of binary images based on a plurality of different grayscale threshold values, and determine the position of the target object based on the target region of at least one of the plurality of binary images. In this way, the determined position of the target object can be more accurate.

[0133] It should be understood that the order of the steps of the target detection method provided by the embodiments of the present application can be adjusted appropriately. For example, steps 205 and 206 described above can be performed before step 202. Alternatively, steps 205 and 202 can be performed synchronously. Alternatively, step 204 described above can be deleted according to the situation, that is, the electronic device does not need to perform filtering processing and interpolation processing on the initial image. Alternatively, step 208 described above can be deleted according to the situation, that is, the electronic device can directly determine the position of the target object based on the target regions in the plurality of binarization images. Any person skilled in the art within the technical range disclosed in the present application can easily think of a changed method, which should be covered in the protection scope of the present application, and thus will not be described here.

[0134] In summary, the embodiments of the present application provide a target detection method. An electronic device can generate a grayscale image based on infrared image data collected by an infrared sensor, and process the grayscale image using a plurality of different grayscale thresholds to obtain a plurality of binarization images for detecting the position of a target object. The plurality of grayscale thresholds are determined based on the average of the energy values of the plurality of pixels in the infrared image data. Since the energy values of the plurality of pixels are related to the ambient temperature, the interference caused by the ambient temperature on the binarization processing can be effectively avoided. Further, it can be ensured that the binarization images can accurately reflect the temperature of each sub-region in the detection region, thereby ensuring the accuracy of target detection.

[0135] Figure 6 FIG. 1 is a structural schematic diagram of an electronic device provided by an embodiment of the present application. Referring to FIG. 1, Figure 6 The electronic device includes an infrared sensor 110 and a processor 120.

[0136] The infrared sensor 110 is configured to collect infrared image data of a detection region. The infrared image data includes energy values of a plurality of pixels, and the plurality of pixels correspond one-to-one to a plurality of sub-regions of the detection region. The energy value of each pixel is related to the temperature of the sub-region corresponding to the pixel.

[0137] The processor 120 is configured to:

[0138] generate a grayscale image based on the infrared image data;

[0139] determine a plurality of grayscale thresholds based on the average of the energy values of the plurality of pixels, wherein the plurality of grayscale thresholds are different from each other;

[0140] perform binarization processing on the grayscale image using each grayscale threshold respectively to obtain a plurality of binarization images;

[0141] determine the position of a target object in the detection region based on the plurality of binarization images.

[0142] Optionally, the processor 120 is configured to:

[0143] determine a plurality of energy thresholds according to a mean value of the energy values of the plurality of pixels;

[0144] obtain a plurality of grayscale thresholds corresponding to the plurality of energy thresholds according to a conversion relationship between the energy values and the grayscale values;

[0145] wherein each energy threshold satisfies any one of the following conditions:

[0146] greater than or equal to the mean value and less than a maximum value of the energy values of the plurality of pixels;

[0147] less than the mean value and a difference between the mean value and the energy threshold is less than a difference threshold.

[0148] Optionally, the number of the plurality of energy thresholds is N, N is an integer greater than 1;

[0149] wherein the i-th energy threshold P i satisfies:

[0150] P i = P ave +x i ×(P max -P ave ) Formula (3)

[0151] i is a positive integer not greater than N, x i represents a weight coefficient of the i-th energy threshold, P max represents the maximum value of the energy values of the plurality of pixels, P ave represents the mean value of the energy values of the plurality of pixels.

[0152] Optionally, the processor 120 is configured to:

[0153] process the energy values of each pixel in the infrared image data by using a conversion relationship between the energy values and temperature values to obtain temperature image data, the temperature image data including temperature values of a plurality of pixels;

[0154] process the temperature values of each pixel in the temperature image data by using a conversion relationship between the temperature values and grayscale values to obtain a grayscale image;

[0155] wherein the conversion relationship between the temperature values and the grayscale values is determined based on an ambient temperature.

[0156] Optionally, the conversion relationship between the temperature values and the grayscale values satisfies:

[0157] G = (T-T min ) / (T max -T min ) × 255 Formula (2)

[0158] wherein G represents a grayscale value, T represents a temperature value, T min is a first temperature threshold, T max is a second temperature threshold, and the first temperature threshold and the second temperature threshold are both positively correlated with an ambient temperature.

[0159] Optionally, the conversion relationship between the energy value and the temperature value satisfies:

[0160] T = (P - K) / R e + T B Equation (1)

[0161] wherein T represents a temperature value, P represents an energy value, K represents a reference energy value, R e represents a conversion coefficient of the energy value and the temperature value, T B represents a temperature of the infrared sensor.

[0162] Optionally, the processor 120 is configured to:

[0163] generate an initial image according to the infrared image data, the initial image comprising grayscale values of a plurality of pixels, and a number of pixels in the initial image being equal to a number of pixels in the infrared image data;

[0164] filter and interpolate the initial image in sequence to obtain a grayscale image, a number of pixels in the grayscale image being greater than the number of pixels in the initial image.

[0165] Optionally, the processor 120 is configured to:

[0166] determine at least one candidate binarization image from the plurality of binarization images, each candidate binarization image having an area of a target region greater than an area threshold, the target region being a region with a target value of the grayscale value;

[0167] determine a position of a target object within the target region according to the target region in the at least one candidate binarization image.

[0168] In summary, the embodiments of the present application provide an electronic device which can generate a grayscale image based on infrared image data collected by an infrared sensor, and process the grayscale image using a plurality of different grayscale thresholds to obtain a plurality of binarization images for detecting the position of a target object. The plurality of grayscale thresholds are determined based on the average value of the energy values of a plurality of pixels in the infrared image data. Since the energy values of the plurality of pixels are related to the ambient temperature, the interference of the ambient temperature on the binarization processing can be effectively avoided. Furthermore, the binarization images can accurately reflect the temperature of each sub-region in the detection region, thereby ensuring the accuracy of the target detection.

[0169] It can be understood that the electronic device provided by the above embodiments is only used as an example for the division of the above functional modules, and in actual application, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the electronic device is divided into different functional modules to complete all or part of the functions described above.

[0170] In addition, the electronic device and the target detection method provided by the above embodiments belong to the same concept, and the specific implementation process is shown in the method embodiments, which will not be repeated here.

[0171] The electronic device provided by the embodiments of the present application includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the target detection method provided by the above embodiments is implemented, for example Figure 2 or Figure 3 the method shown.

[0172] The embodiments of the present application provide a computer readable storage medium, and the computer readable storage medium stores a computer program. The computer program is loaded and executed by a processor to implement the target detection method provided by the above embodiments, for example Figure 2 or Figure 3 the method shown.

[0173] The embodiments of the present application also provide a computer program product containing instructions, which, when executed on the computer, cause the computer to execute the target detection method provided by the above embodiments, for example Figure 2 or Figure 3 the method shown.

[0174] Those of ordinary skill in the art can understand that all or part of the steps of the above embodiments can be completed by hardware, or by a program instructing related hardware, and the program can be stored in a computer readable storage medium, and the storage medium mentioned above can be a read-only memory, a disk or an optical disk.

[0175] It should be understood that the term "at least one" in the present application means one or more, and the term "multiple" in the present application means two or more.

[0176] In the present application, the terms "first", "second", and the like are used to distinguish the same items or similar items with basically the same function and effect, and it should be understood that there is no logical or time sequence between "first", "second", and "n", and the number and execution order are not limited.

[0177] The above merely provides exemplary embodiments of the present application, but is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A target detection method, characterized in that, The method includes: Infrared image data of the detection area collected by an infrared sensor is acquired. The infrared image data includes the energy values ​​of multiple pixels. The multiple pixels correspond one-to-one with multiple sub-regions of the detection area. The energy value of each pixel is related to the temperature of the sub-region corresponding to the pixel. A grayscale image is generated based on the infrared image data; multiple energy thresholds are determined based on the average energy values ​​of the multiple pixels, each energy threshold being greater than or equal to the average value and less than the maximum energy value of the multiple pixels; or, each energy threshold being less than the average value and the difference from the average value being less than a difference threshold; multiple grayscale thresholds corresponding to the multiple energy thresholds are obtained based on the conversion relationship between energy values ​​and grayscale values, the multiple grayscale thresholds being different from each other and all being positively correlated with the average energy values ​​of the multiple pixels; The grayscale image is binarized using each of the grayscale thresholds to obtain multiple binarized images. Each binarized image is obtained based on any one of the multiple grayscale thresholds. At least one candidate binarized image is determined from the multiple binarized images. The area of ​​the target region in each candidate binarized image is greater than an area threshold. The target region is the region where the grayscale value is the target value. Determine the overlapping region of the target region in the at least one candidate binarized image, and determine the position of the overlapping region as the position of the target object within the detection region, or... The intersection-over-union ratio (IoU) of the target regions in the at least one candidate binary images is determined. The IoU is the ratio of the area of ​​the intersection to the area of ​​the union of the target regions in each candidate binary image. If the IoU is greater than a preset ratio, the overlapping area of ​​the target regions in the at least one candidate binary images is determined as the region where the target object is located, thus obtaining the position of the target object. If the IoU is less than a preset ratio, it is determined that there are interfering objects other than the target object in the detection region. Based on a pre-stored target detection algorithm, the overlapping area of ​​the target regions in the at least one candidate binary images is processed to determine the position of the target object. When the area of ​​the target region in all of the determined binarized images is less than the area threshold, it is determined that the target object does not exist in the detection area, and no processing is required on the multiple binarized images.

2. The method according to claim 1, characterized in that, The number of the plurality of energy thresholds is N, where N is an integer greater than 1; Wherein, the i-th energy threshold satisfy: i is a positive integer not greater than N. This represents the weighting coefficient for the i-th energy threshold. This represents the maximum energy value of the plurality of pixels. This represents the average energy value of the plurality of pixels.

3. The method according to any one of claims 1 to 2, characterized in that, The step of generating a grayscale image based on the infrared image data includes: By using the conversion relationship between energy value and temperature value, the energy value of each pixel in the infrared image data is processed to obtain temperature image data, which includes the temperature values ​​of multiple pixels. By using the conversion relationship between temperature value and grayscale value, the temperature value of each pixel in the temperature image data is processed to obtain a grayscale image; The conversion relationship between the temperature value and the grayscale value is determined based on the ambient temperature.

4. The method according to claim 3, characterized in that, The conversion relationship between the temperature value and the grayscale value satisfies: ; in, Represents grayscale value, Indicates the temperature value. The first temperature threshold, The second temperature threshold is defined as the first temperature threshold, and both the first and second temperature thresholds are positively correlated with the ambient temperature.

5. The method according to claim 3, characterized in that, The conversion relationship between energy value and temperature value satisfies: ; in, Indicates the temperature value. Indicates energy value. Indicates the reference energy value. This represents the conversion factor between energy and temperature values. This indicates the temperature of the infrared sensor.

6. The method according to any one of claims 1 to 2, characterized in that, The step of generating a grayscale image based on the infrared image data includes: An initial image is generated based on the infrared image data. The initial image includes grayscale values ​​of multiple pixels, and the number of pixels in the initial image is equal to the number of pixels in the infrared image data. The initial image is sequentially filtered and interpolated to obtain a grayscale image, wherein the number of pixels in the grayscale image is greater than the number of pixels in the initial image.

7. An electronic device, characterized in that, The electronic device includes an infrared sensor and a processor; The infrared sensor is used to collect infrared image data of the detection area. The infrared image data includes the energy values ​​of multiple pixels. The multiple pixels correspond one-to-one with multiple sub-regions of the detection area. The energy value of each pixel is related to the temperature of the sub-region corresponding to the pixel. The processor is used for: Generate a grayscale image based on the infrared image data; Based on the average energy values ​​of the plurality of pixels, a plurality of energy thresholds are determined, each of the energy thresholds being greater than or equal to the average value and less than the maximum energy value of the plurality of pixels; or, each of the energy thresholds being less than the average value and the difference from the average value being less than the difference threshold. Based on the conversion relationship between energy value and gray value, multiple gray value thresholds corresponding to the multiple energy thresholds are obtained. The multiple gray value thresholds are different from each other and are all positively correlated with the mean of the energy values ​​of the multiple pixels. The grayscale image is binarized using each of the grayscale thresholds to obtain multiple binarized images, each of which is obtained based on any one of the multiple grayscale thresholds. At least one candidate binarized image is determined from the plurality of binarized images, wherein the area of ​​the target region in each candidate binarized image is greater than an area threshold, and the target region is a region whose gray value is a target value; Determine the overlapping region of the target region in the at least one candidate binarized image, and determine the position of the overlapping region as the position of the target object within the detection region, or... Determine the intersection-union ratio of the target regions in the at least one candidate binarized image, wherein the intersection-union ratio is the ratio of the area of ​​the intersection to the area of ​​the union of the target regions in each candidate binarized image; If the intersection-union ratio is greater than a preset ratio, then the overlapping region of the target region in the at least one candidate binarized image is determined as the region where the target object is located, so as to obtain the position of the target object; If the intersection-union ratio is less than a preset ratio, it is determined that there is an interfering object other than the target object in the detection area. Based on the pre-stored target detection algorithm, the overlapping area of ​​the target area in the at least one candidate binarized image is processed to determine the position of the target object. When the area of ​​the target region in all of the determined binarized images is less than the area threshold, it is determined that the target object does not exist in the detection area, and no processing is required on the multiple binarized images.

8. An intelligent control system, characterized in that, The system includes: a controlled device, and an electronic device as described in claim 7; The electronic device is used to control the working state of the controlled device according to the position of the target object within the detection area.

Citation Information

Patent Citations

  • Fast target positioning method and device

    CN107657639A

  • Air conditioner and human body area detection method

    CN114119451A

  • Air conditioner and hand area detection method

    CN114387611A