A data storage method for human infrared images
By optimizing the floating-point number format based on the accuracy of temperature values in human infrared images, the problem of large file sizes when storing human infrared images in float16 format is solved, achieving more efficient file compression and transmission.
Patent Information
- Application Number
- CN202410352463.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-26
- Publication Date
- 2026-11-06
- Estimated Expiration
- 2044-03-26
AI Technical Summary
The existing float16 format results in large compressed files when storing and transmitting human infrared images, leading to low transmission efficiency.
Based on the accuracy of temperature values in human infrared images, the number of bits in the mantissa and exponent of the floating-point number format is determined, and the storage format is optimized to adapt to the DICOM standard and computer storage requirements, thereby reducing the size of the storage file.
By optimizing the floating-point number format, the compressibility and transmission efficiency of compressed files have been improved, reducing file size while meeting the requirements for accurate temperature representation.
Smart Images

Figure CN118312633B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electronic digital data processing technology, and in particular to a data storage method for human infrared images. Background Technology
[0002] When medical digital imaging and communication (Dicom) uses 16 bits to store single-pixel information of medical images, and the medical image is a human infrared image, the single-pixel information is temperature information. On the one hand, human body temperature is often a decimal, and it is not possible to directly store human body temperature information using an integer format. On the other hand, although the existing float16 format (including 1 sign bit, 5 exponent bits, and 10 mantissa bits) can represent decimals, when using the float16 format to store the above-mentioned temperature information, if the corresponding storage file is compressed and transmitted using existing compression methods, there is a problem of low transmission efficiency due to the large size of the compressed file. Summary of the Invention
[0003] The purpose of this invention is to provide a data storage method for human infrared images, so as to reduce the size of compressed files while meeting users' requirements for accurate temperature representation.
[0004] According to a first aspect of the present invention, a method for storing infrared images of a human body is provided, comprising the following steps:
[0005] S100, acquire target temperature data A, A = (a1, a2, ..., a... n ,…,a N ), a n Let a be the temperature value of the nth pixel in the infrared image of the target human body. n The format is a decimal number.
[0006] S200, obtain the precision p of A.
[0007] S300, obtain the preset precision range list B, B = (b 10 -u+1,…,b m ,…,b 10 ), b m For z m The corresponding precision range, b m =[pre m ,pre m-1 ), pre m For z m Precision at max(|A|), pre m-1 For z m-1 The precision at max(|A|), where max() takes the maximum value, z mz is a 16-bit binary floating-point number with m decimal places. m-1 B is a 16-bit binary floating-point number with m-1 decimal places, where m ranges from 10-u+1 to 10, and u is the number of precision ranges included in B.
[0008] S400, iterate through B, if p∈b m Then the value of m will be assigned to the first digit w1.
[0009] S500, obtain the second digit y, y = 15 - w1.
[0010] S600, iterate through A, and a n Convert to the format corresponding to the target floating-point number to obtain the converted result q. n The number of bits in the fractional part of the target floating-point number is w1, and the number of bits in the exponent part of the target floating-point number is y.
[0011] S700, q n Store it.
[0012] Compared with the prior art, the present invention has at least the following beneficial effects:
[0013] This invention determines the format of the floating-point number to be converted based on the precision of the temperature value to be stored. First, the precision of the temperature value to be stored is matched with a preset precision range. Then, the number of bits in the mantissa portion of the format corresponding to the floating-point number to be converted is obtained based on the precision range of the temperature value to be stored. Finally, the number of bits in the exponent portion of the format corresponding to the floating-point number to be converted is determined based on the number of bits in the mantissa portion. Thus, this invention obtains a floating-point number format that meets the precision requirements of the temperature value to be stored. Converting each temperature value into a floating-point number of this format for storage not only conforms to the characteristic of DICOM using 16 bits to store single-pixel information but also adapts to the requirement of computer storage using 8-bit units for data storage. Furthermore, this invention preferably uses a floating-point number format with a smaller bit depth while meeting accuracy requirements. Since floating-point numbers can represent a relatively wide range, and the temperature values of pixels in the infrared image of the target human body are relatively small relative to this range, and the range of the overall body surface temperature of the human body is small under normal detection conditions, when the temperature value of a pixel is represented by a floating-point number with a relatively wide representable range, the integer part of the floating-point number corresponding to the temperature values of different pixels is relatively short and the values are similar, and the exponent part has a small range of variation. This can improve the file's compressibility ratio, which is beneficial for reducing the size of the compressed file obtained when compressing the stored temperature data using existing compression methods, and can improve the efficiency of subsequent transmission of compressed files. Attached Figure Description
[0014] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0015] Figure 1 A flowchart illustrating a method for storing infrared images of the human body, provided in an embodiment of the present invention. Detailed Implementation
[0016] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0017] According to the present invention, a data storage method for human infrared images is provided, such as... Figure 1 As shown, it includes the following steps:
[0018] S100, acquire target temperature data A, A = (a1, a2, ..., a... n ,…,a N ), a n Let a be the temperature value of the nth pixel in the infrared image of the target human body. n The format is a decimal number.
[0019] Specifically, the target human infrared image is the human infrared image to be stored. Those skilled in the art will understand that any existing method for acquiring human infrared images falls within the protection scope of this invention.
[0020] Optional, a n The range of values for is [-45, 45], that is, -45 ≤ a n ≤45.
[0021] In this embodiment, a n The format is a decimal number, for example, a n =30.1 or a n =28.9.
[0022] S200, obtain the precision p of A.
[0023] As a first optional implementation, the precision p of A is a value input by the user. For example, p is 0.01.
[0024] As a second optional implementation, the precision p of A is the maximum value that satisfies a preset condition, wherein the preset condition is to make each a n / p are all integers.
[0025] As a third optional implementation method, the process of obtaining p includes:
[0026] S210, arranging the temperature values in A in ascending order, we get A' = (a 1,new ,a 2,new ,…,a n,new ,…,a N,new ), a n,new This is the nth smallest temperature value in A.
[0027] It should be understood that a 1,new This is the first smallest temperature value in A, i.e., the smallest temperature value in A; a 2,new This is the second smallest temperature value in A; and so on, a N-1,new This is the (N-1)th smallest temperature value in A, i.e., the second largest temperature value in A; a N,new It is the Nth smallest temperature value in A, which is also the largest temperature value in A.
[0028] S220, obtain the temperature difference sequence R, R = (r1, r2, ..., r j ,…,r N-1 ), r j For the j-th temperature difference, r j =a j+1,new -a j,new a j,new Let a be the j-th smallest temperature value in A. j+1,new Let be the (j+1)th smallest temperature value in A, where j ranges from 1 to N-1.
[0029] S230, iterate through R, if r j If r ≠ 0, then r j The value is added to the preset first temperature difference set R', which is initialized as an empty set.
[0030] S240, get p, p = min(R'), min() is to get the minimum value.
[0031] The above S210-S230 provides a method for automatically obtaining p, which is suitable for scenarios where the user does not input p.
[0032] S300, obtain the preset precision range list B, B = (b 10 -u+1,…,b m ,…,b 10 ), b m For zm The corresponding precision range, b m =[pre m ,pre m-1 ), pre m For z m Precision at max(|A|), pre m-1 For z m-1 The precision at max(|A|), where max() takes the maximum value, z m z is a 16-bit binary floating-point number with m decimal places. m-1 B is a 16-bit binary floating-point number with m-1 decimal places, where m ranges from 10-u+1 to 10, and u is the number of precision ranges included in B.
[0033] In this embodiment, u is an empirical value. Optionally, 2≤u≤5, and preferably, u=4.
[0034] For 16-bit floating-point numbers, the precision is highest at min(|A|), min() is the minimum value, and the precision is lowest at max(|A|). Therefore, in this embodiment, the precision of the 16-bit floating-point number in the range of temperature values of pixels in the infrared image of the target human body is determined to be the precision of the 16-bit floating-point number at max(|A|). This ensures that the precision of the 16-bit floating-point number in the range of temperature values of pixels in the infrared image of the target human body meets the precision requirements.
[0035] Specifically, pre m The methods for obtaining it include: if max(|A|) < 1, then Otherwise, proceed to S310.
[0036] S310, obtain the preset index list G, G = (2 1 ,2 2 ,2 3 ,2 4 ,2 5 ,2 6 ).
[0037] S320, iterate through G, if G contains 2... 1 If the preset conditions are met, then pre m Determined to be 2 0 ×2 -m If G contains 2 2 If the preset conditions are met, then pre m Determined to be 2 1 ×2 -m If G contains 2 3 If the preset conditions are met, then pre m Determined to be 2 2 ×2 -mIf G contains 2 4 If the preset conditions are met, then pre m Determined to be 2 3 ×2 -m If G contains 2 5 If the preset conditions are met, then pre m Determined to be 2 4 ×2 -m If G contains 2 6 If the preset conditions are met, then pre m Determined to be 2 5 ×2 -m The preset conditions include: being greater than max(|A|) and being the minimum value among the exponents in G that satisfy being greater than max(|A|).
[0038] Based on S310-S320, the precision pre of a 16-bit floating-point number with m decimal places at max(A) can be obtained. m As a specific implementation, max(|A|) = 40, and 2 of G satisfy the preset condition. 6 ,pre m =2 5 ×2 -m When m = 10, pre 10 =2 -5 When m = 9, pre9 = 2 -4 When m = 8, pre8 = 2 -3 .
[0039] S400, iterate through B, if p∈b m Then the value of m will be assigned to the first digit w1.
[0040] S500, obtain the second digit y, y = 15 - w1.
[0041] S600, iterate through A, and a n Convert to the format corresponding to the target floating-point number to obtain the converted result q. n The number of bits in the fractional part of the target floating-point number is w1, and the number of bits in the exponent part of the target floating-point number is y.
[0042] Those skilled in the art will recognize that the method for converting a decimal fraction to the existing float16 format (including 1 sign bit, 5 exponent bits, and 10 mantissa bits) is prior art and will not be described in detail here. In this embodiment, when the mantissa of the 16-bit floating-point number is not 10, the process of converting the decimal fraction to an improved 16-bit floating-point number (i.e., a 16-bit floating-point number whose mantissa is not 10) (i.e., S600) includes: if a n If q is 0, then nEach bit is 0; otherwise, proceed to S610.
[0043] S610, a n Perform binary format conversion to obtain a n The corresponding binary format a' n .
[0044] Those skilled in the art will understand that existing methods for converting decimal fractions to binary format fall within the scope of protection of this invention.
[0045] S620, obtain a n The corresponding binary sign bit s, when a n If the value is negative, s takes the value 1; otherwise, s takes the value 0.
[0046] S630, a' n Convert the absolute value of a to a” n ×2 w Format, a” n Let w be a binary number with an integer part of 1, and let w be the value of a'. n The absolute value of is converted to the exponent of 2.
[0047] S640, obtain a n The corresponding initial exponent part d n d n =w+2 y-1 -1,d n It is in binary format; if d n >2 y -1, execute S650; if d n If the value is less than 1, proceed to S680; otherwise, proceed to S660.
[0048] S650, d n Let y be the maximum value of an unsigned binary integer.
[0049] S660, obtain a n The corresponding initial mantissa part e n e n For a” n The fractional part of the binary number.
[0050] S670, s, d' n and e' n By splicing the first and last parts together, we get q. n ,d' n To make d n The target exponent portion obtained by storing y bits is padded with leading zeros if there are insufficient digits; e' n To make e n The target mantissa is obtained by storing the first w1 bits, and if there are not enough bits, 0 is added; execute S700.
[0051] S680, updated d n "For 0, a" n Move right 2-2 y-1 -w bits get e n , s, d' n and e' n By splicing the first and last parts together, we get q. n ,d' n To make d n The target exponent portion obtained by storing y bits is padded with leading zeros if there are insufficient digits; e' n To make e n The target mantissa is obtained by storing the first w1 bits, and if there are not enough bits, it is padded with 0s.
[0052] S700, q n Store it.
[0053] Those skilled in the art will understand that any storage method in the prior art falls within the protection scope of this invention.
[0054] It should be understood that after storing the temperature information of each pixel in the human infrared image, there is still a process where the user reads the temperature information of each pixel in the human infrared image. To facilitate user retrieval, it is also necessary to... n Convert to decimal format, and use the converted result q' n This is the temperature value displayed to the user.
[0055] This embodiment determines the format of the floating-point number to be converted based on the precision of the temperature value to be stored. First, the precision of the temperature value to be stored is matched with a preset precision range. The number of bits in the mantissa of the format of the floating-point number to be converted is obtained according to the precision range of the temperature value to be stored. Then, the number of bits in the exponent of the format of the floating-point number to be converted is determined according to the number of bits in the mantissa. Thus, this embodiment obtains a floating-point number format that meets the precision of the temperature value to be stored. Each temperature value is converted into a floating-point number of this format for storage, which not only conforms to the characteristic of DICOM using 16 bits to store single pixel information, but also adapts to the requirement of computer storage using 8 bits as the unit of data. Furthermore, this embodiment preferably uses a floating-point number format with a smaller bit depth while meeting accuracy requirements. Since floating-point numbers can represent a relatively wide range, and the temperature values of pixels in the infrared image of the target human body are relatively small compared to this range, and the range of the overall body surface temperature of the human body is small under normal detection conditions, when the temperature value of a pixel is represented by a floating-point number with a relatively wide representable range, the integer part of the floating-point number corresponding to the temperature values of different pixels is relatively short and the values are similar, and the exponent part has a small range of variation. This can improve the file's compressibility ratio, which is beneficial for reducing the size of the compressed file obtained when compressing the stored temperature data using existing compression methods later, and can improve the efficiency of subsequent transmission of compressed files.
[0056] In this embodiment, S400 further includes: if p does not belong to any b in B m Then it enters S800.
[0057] S800, iterate through A, and a n After magnification by 1000 times and binary conversion, we get s. n s n The number of digits is 16.
[0058] S900, will s n Store it.
[0059] Those skilled in the art will understand that any storage method in the prior art falls within the protection scope of this invention.
[0060] In this embodiment, p does not belong to any b in B. m s was stored in the case n s n It is to a n The integer format stored in binary after being magnified 1000 times, this s n With a n There is a one-to-one correspondence; therefore, this embodiment achieves the condition that p does not belong to any b in B. m In the case of a n Storage.
[0061] It should be noted that after storing the temperature information of each pixel in the human infrared image, there is still a process where the user reads the temperature information of each pixel in the human infrared image. To facilitate user reading, it is also necessary to... n Convert to decimal format, because s n It is to a n The value is obtained by magnifying it 1000 times and then converting it to binary. Therefore, in this embodiment, s n Convert to a decimal integer, then reduce by a factor of 1000, and calculate the reduced result s'. n This is the temperature value displayed to the user.
[0062] In this embodiment, s n As is known to those skilled in the art, the methods for converting binary integers to decimal integers in the prior art fall within the protection scope of this invention.
[0063] In a preferred embodiment, S100 and S200 further include:
[0064] S110, obtain the preset comparison temperature value tem.
[0065] Preferably, tem is the median or mean of the target temperature data A, such that a' n The value that is closer to 0 makes the final stored q n The accuracy is higher. Those skilled in the art will know that the method for obtaining the median is existing technology and will not be described in detail here.
[0066] S120, acquire the difference target temperature data A', A' = (a'1, a'2, ..., a') n ,…,a' N ), a' n The temperature value a of the nth pixel in the infrared image of the target human body. n The difference between tem and a' n =a n -tem,a' n The format is a decimal number.
[0067] S130, replace the target temperature data A with the difference target temperature data A'.
[0068] In the preferred embodiment described above, S700 further includes: storing tem to later reconstruct the temperature values of the pixels in the infrared image of the target human body based on tem.
[0069] While specific embodiments of the invention have been described in detail by way of example, those skilled in the art should understand that the examples are for illustrative purposes only and not intended to limit the scope of the invention. It should also be understood that various modifications can be made to the embodiments without departing from the scope and spirit of the invention. The scope of the invention is defined by the appended claims.
Claims
1. A method for storing infrared images of the human body, characterized in that, Includes the following steps: S100, obtaining target temperature data A, A=(a1, a2, …, an), an is the temperature value of the nth pixel point of the target human infrared image, and the format of a is a decimal fraction; n , N , n , n S200, obtain the precision p of A; S300, obtain the preset precision range list B, B=(b 10-u+1 ,…,b m ,…,b 10 ), b m For z m The corresponding precision range, b m =[pre m ,pre m-1 ), pre m For z m Precision at max(|A|), pre m-1 For z m-1 The precision at max(|A|), where max() is the maximum value, z m z is a 16-bit binary floating-point number with m decimal places. m-1 B is a 16-bit binary floating-point number with m-1 decimal places, where m ranges from 10-u+1 to 10, and u is the number of precision ranges included in B. S400, iterate through B, if p∈b m Then the value of m is assigned to the first digit w1; S500, obtain the second digit y, y=15-w1; S600, iterate through A, and a n Convert to the format corresponding to the target floating-point number to obtain the converted result q. n The number of bits in the fractional part of the target floating-point number is w1, and the number of bits in the exponent part of the target floating-point number is y. S700, q n Store; pre m The methods for obtaining it include: if max(|A|)≥1, then proceed to S310; S310, obtain the preset index list G, G=(2 1 ,2 2 ,2 3 ,2 4 ,2 5 ,2 6 ); S320, iterate through G, if G contains 2... 1 If the preset conditions are met, then pre m Determined to be 2 0 ×2 -m If G contains 2 2 If the preset conditions are met, then pre m Determined to be 2 1 ×2 -m If G contains 2 3 If the preset conditions are met, then pre m Determined to be 2 2 ×2 -m If G contains 2 4 If the preset conditions are met, then pre m Determined to be 2 3 ×2 -m If G contains 2 5 If the preset conditions are met, then pre m Determined to be 2 4 ×2 -m If G contains 2 6 If the preset conditions are met, then pre m Determined to be 2 5 ×2 -m The preset conditions include: being greater than max(|A|) and being the minimum value among the exponents in G that satisfy being greater than max(|A|).
2. The data storage method for human infrared images according to claim 1, characterized in that, pre m The methods for obtaining this include: if max(|A|) < 1, then pre m = .
3. The data storage method for human infrared images according to claim 1, characterized in that, S600 includes: if a n If q is 0, then n All bits are 0; otherwise, proceed to S610. S610, a n Perform binary format conversion to obtain a n The corresponding binary format a' n ; S620, obtain a n The corresponding binary sign bit s, when a n s takes the value 1 when the number is negative, otherwise s takes the value 0; S630, a' n The absolute value of a is converted to a'' n ×2 w Format, a'' n Let w be a binary number with an integer part of 1, and let w be the value of a'. n The absolute value of 2 is converted to the power of 2. S640, obtain a n The corresponding initial exponent part d n d n =w+2 y-1 -1,d n It is in binary format; if d n >2 y -1, execute S650; if d n If the value is less than 1, proceed to S680; otherwise, proceed to S660. S650, d n Set the maximum value of a y-bit unsigned binary integer; S660, obtain a n The corresponding initial mantissa part e n e n For a'' n The fractional part of the binary number; S670, s, d' n and e' n By splicing the first and last parts together, we get q. n ,d' n To make d n The target exponent portion obtained by storing y bits is padded with leading zeros if there are insufficient digits; e' n To make e n The target mantissa is obtained by storing the first w1 bits, and if there are not enough bits, it is padded with 0s; execute S700; S680, updated d n =0, a'' n Move right 2-2 y-1 -w bits get e n , s, d' n and e' n By splicing the first and last parts together, we get q. n ,d' n To make d n The target exponent portion obtained by storing y bits is padded with leading zeros if there are insufficient digits; e' n To make e n The target mantissa is obtained by storing the first w1 bits, and if there are not enough bits, it is padded with 0s.
4. The data storage method for human infrared images according to claim 1, characterized in that, p is the maximum value that satisfies a preset condition, where the preset condition is to make each a n / p are all integers.
5. The data storage method for human infrared images according to claim 1, characterized in that, -45≤a n ≤45。 6. The data storage method for human infrared images according to claim 1, characterized in that, 2≤u≤5。 7. The data storage method for human infrared images according to claim 6, characterized in that, u=4。 8. The data storage method for human infrared images according to claim 1, characterized in that, Between S100 and S200, there is also: S110, obtain the preset comparison temperature value tem; S120, acquire the difference target temperature data A', A'=(a'1,a'2,…,a' n ,…,a' N ), a' n The temperature value a of the nth pixel in the infrared image of the target human body. n The difference between tem and a' n =a n -tem,a' n The format is decimal; S130, replace the target temperature data A with the difference target temperature data A'.
9. The data storage method for human infrared images according to claim 8, characterized in that, tem is the median or mean of the target temperature data A.
10. The data storage method for human infrared images according to claim 8, characterized in that, The S700 also includes: storing tem.
Citation Information
Patent Citations
Method for improving transmission efficiency of low-precision floating-point number
CN113254259A
Image data storage method and device, electronic equipment and storage medium
CN114282026A
