This application claims priority of Taiwanese Patent Application No. 110120771, filed on Jun. 8, 2021.
The disclosure relates to a method, a system and computer-readable storage medium for measuring distance, and more particularly to a method, a system and computer-readable storage medium for measuring distance between a human face and an image capturing device.
As the world becomes entangled in a pandemic, a wide variety of technology has been in development to address the needs to combat the pandemic. One of the needs is to measure body temperatures of people entering specific places (e.g., an administration building, retail stores, offices, MRT stations, etc.) without involving human contact. Therefore, temperature measuring devices have been installed at entrances of those places. In some occasions, forehead thermometers are employed, and everyone entering those places may be instructed to move his/her forehead in front of the forehead thermometers, so as to obtain a temperature on the forehead thereof.
It is noted that accuracy of the measurement of the temperature on the forehead may vary greatly based on a distance between the person and the forehead thermometer. Accordingly, a depth camera or multiple cameras may be disposed near the forehead thermometer so as to obtain the distance between the person and the forehead thermometer.
Therefore, an object of the disclosure is to provide a method for measuring distance that can be implemented using a single charge-couple device (CCD) camera.
According to one embodiment of the disclosure, the method is implemented using a processor that executes a software program, and includes:
receiving an image captured by an image capturing device;
identifying and extracting a human face in the image;
identifying two eyes and a mouth included in the human face;
defining a region using the two eyes and the mouth, and calculating a number of pixels contained in the region; and
calculating a distance between the human face and the image capturing device based on the number of pixels contained in the region and a resolution of the image capturing device.
Another object of the disclosure is to provide a system that is capable of implementing the above-mentioned method.
According to one embodiment of the disclosure, the system includes:
an image capturing device configured to capture images; and
an image processing device that is coupled to the image capturing device, and that includes a processor that is programmed to
Another object of the disclosure is to provide a non-transitory computer-readable storage medium that stores instructions that, when executed by a processor, cause the processor to implement steps of the above-mentioned method.
Other features and advantages of the disclosure will become apparent in the following detailed description of the embodiments with reference to the accompanying drawings, of which:
Before the disclosure is described in greater detail, it should be noted that where considered appropriate, reference numerals or terminal portions of reference numerals have been repeated among the figures to indicate corresponding or analogous elements, which may optionally have similar characteristics.
Throughout the disclosure, the term “coupled to” may refer to a direct connection among a plurality of electrical apparatus/devices/equipments via an electrically conductive material (e.g., an electrical wire), or an indirect connection between two electrical apparatus/devices/equipments via another one or more apparatus/device/equipment, or wireless communication.
The image capturing device 1 may be embodied using a charge-coupled device (CCD) camera, which has a relatively lower cost to install.
The image processing device 2 includes a processor 22, a data storage unit 24 and a communicating unit 26.
The processor 22 may include, but not limited to, a single core processor, a multi-core processor, a dual-core mobile processor, a microprocessor, a microcontroller, a digital signal processor (DSP), a field-programmable gate array (FPGA), an application specific integrated circuit (ASIC), a radio-frequency integrated circuit (RFIC), etc.
The data storage unit 24 may be embodied using a memory device such as random access memory (RAM), read only memory (ROM), programmable ROM (PROM), firmware, flash memory, etc. The data storage unit 24 may store a software program including instructions that, when executed by a processor (e.g., the processor 22), cause the processor 22 to implement a number of operations as described below.
The communication unit 26 may include at least one of a radio-frequency integrated circuit (RFIC), a short-range wireless communication module supporting a short-range wireless communication network using a wireless technology of Bluetooth® and/or Wi-Fi, etc., or a mobile communication module supporting telecommunication using Long-Term Evolution (LTE), the third generation (3G) and/or fifth generation (5G) of wireless mobile telecommunications technology, and/or the like.
In use, the system 100 may be installed at a specific location, such as an entrance to a building, a public transit station, a retail store, etc., with a forehead thermometer (not shown), so as to obtain a temperature on a forehead of a person who places his/her forehead in front of the forehead thermometer at a distance of, for example, 3 to 5 centimeters. In this embodiment, the forehead thermometer and the image capturing device 1 are disposed at a height such that most people will be able to place their foreheads in front of the forehead thermometer without excessive effort, and such that the images captured by the image capturing device 1 may contain the faces of the approaching people. For example, the height may be approximately 1.5 meters.
In this embodiment, the system 100 further includes a proximity sensor (not depicted in the drawings) that is coupled to the processor 22, and that may be embodied using an optical proximity sensor. After the system 100 is powered on, the processor 22 is configured to execute the software application, and then activate the proximity sensor.
When the processor 22 determines that an object has come within a pre-determined distance from the system 100 (e.g., within 70 centimeters) according to data from the proximity sensor, in step S1, the processor 22 activates the image capturing device 1 so as to allow the image capturing device 1 to continuously capture images, and receives the images from the image capturing device 1.
For example, the communication unit 26 may be configured to receive the images from the image capturing device 1 and then transmit the images thus received to the processor 22, enabling the processor 22 to perform image processing.
It is noted that in some embodiments, the image capturing device 1 and the image processing device 2 may be embodied using separate devices that are connected via a wired or wireless connection, in which case, the images captured by the image capturing device 1 are transmitted to the image processing device 2 for subsequent processing. Alternatively, the image capturing device 1 and the image processing device 2 may be integrated into a single device.
In step S2, in response to receipt of an image captured by the image capturing device 1, the processor 22 identifies and extracts a human face in the image. In this embodiment, the processor 22 employs an image processing library that is available in the Open Source Computer Vision Library (Open CV) so as to identify and extract the human face, but the manner for identifying and extracting the human face is not limited to such.
In step S3, the processor 22 identifies two eyes and a mouth included in the human face. In this embodiment, the processor 22 employs the facial landmark model which may be a Dlib 68 Points Face landmarks Detection Model that is programmed in Python and that is available in the Dlib library, but the manner for identifying two eyes and a mouth included in the human face is not limited to the disclosure herein.
In step S4, the processor 22 defines a specific region using the two eyes and the mouth identified in step S3.
Specifically, in this embodiment, the processor 22 may first define a centre point of an upper lip of the mouth, and a centre point for each of the two eyes. Using the example of
In step S5, the processor 22 calculates a number of pixels contained in the region 30.
In this embodiment, the processor 22 may first calculate an area of the region 30 using three edges (i.e., the edge P1P2, P1P3 and P2P3) thereof. Specifically, the processor 22 may first determine a length of each of the three edges, and then apply the Heron formula as shown below:
where A represents the area, and a, b, c respectively represent the lengths of the three edges. Then, using the area thus calculated, the processor 22 determines how many pixels there are in the region 30. It is noted that the technique used for obtaining the number of pixels in the region 30 is readily known in the art, and details thereof are omitted herein for the sake of brevity.
Then, in step S6, the processor 22 calculates a distance between the human face and the image capturing device 1, based on the number of pixels in the region 30 and a resolution of the image capturing device 1 using a linear equation. Specifically, the distance between the human face and the image capturing device 1 is negatively correlated to the number of pixels in the region 30.
Specifically, the distance is calculated using the following equation:
D=70.949−(0.0013*X*2073600)/Z
where D represents the distance, X represents the number of pixels included in the region 30, and Z represents the resolution of the image capturing device 1.
It is noted that the above-mentioned equation used for calculating the distance between the human face and the image capturing device 1 may be obtained by, prior to the implementation of the method, first capturing a plurality of images each with the person being a specific distance apart from the image capturing device 1, then calculating the number of pixels in the region 30 in each of the images in the same manner as step S5, and then performing a linear regression analysis so as to determine the linear equation that can represent a relationship among the distance between the human face and the image capturing device 1, the number of pixels in the region 30, and the resolution of the image capturing device 1.
The following Table 1 lists the results of the number of pixels in the region 30 in each of the images according to one embodiment of the disclosure, where the resolution of the image capturing device 1 is 1920*1080=2073600.
Based on the above numbers, a linear regression analysis (e.g., using Microsoft Excel®) may be performed to determine the linear equation that represents the relationship between the distance between the human face and the image capturing device 1 and the number of pixels in the region 30, given that the resolution of the image capturing device 1 is 1920*1080=2073600. As seen in
It is noted that for image capturing devices with different resolutions, the above equation may also be adjusted based on the resolution of the image capturing device 1, so as to obtain the following adjusted equation: D=70.949−(0.0013*X*2073600)/Z). As such, when the number of pixels in the region 30 is known for a specific image, the corresponding distance between the human face and the image capturing device I can be calculated, which may then be used to determine whether a temperature on a forehead measured by the forehead thermometer needs to be adjusted based on the distance. This configuration may subsequently improve the accuracy of the measurement of the temperature on a forehead.
According to one embodiment of the disclosure, there is provided a non-transitory computer-readable storage medium that stores instructions that, when executed by a processor, cause the processor to implement steps of a method as shown in
To sum up, embodiments of the disclosure provide a method, a system and a computer-readable storage medium for measuring a distance between a human face and an image capturing device. By utilizing the method as shown above, the measuring of the distance may be implemented using a single CCD camera, with accuracy that is comparable to using a depth camera or multiple cameras. This enables large scale implementation of the system at a relatively lower cost.
In the description above, for the purposes of explanation, numerous specific details have been set forth in order to provide a thorough understanding of the embodiments. It will be apparent, however, to one skilled in the art, that one or more other embodiments maybe practiced without some of these specific details. It should also be appreciated that reference throughout this specification to “one embodiment,” “an embodiment,” an embodiment with an indication of an ordinal number and so forth means that a particular feature, structure, or characteristic may be included in the practice of the disclosure. It should be further appreciated that in the description, various features are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of various inventive aspects, and that one or more features or specific details from one embodiment may be practiced together with one or more features or specific details from another embodiment, where appropriate, in the practice of the disclosure.
While the disclosure has been described in connection with what are considered the exemplary embodiments, it is understood that this disclosure is not limited to the disclosed embodiments but is intended to cover various arrangements included within the spirit and scope of the broadest interpretation so as to encompass all such modifications and equivalent arrangements.
Number | Date | Country | Kind |
---|---|---|---|
110120771 | Jun 2021 | TW | national |