Method and device for improving image testing efficiency, medium and equipment
By converting the numerical value of each pixel point in the 32float_mono image into data smaller than the original numerical bytes, a new image is formed for testing, which solves the problem of low image testing efficiency, and achieves savings in data storage space and improving testing efficiency.
Patent Information
- Application Number
- CN202411149191.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-12-27
AI Technical Summary
32float_mono image format has high data accuracy and excessive memory usage, resulting in inefficient image testing.
By obtaining the numerical value of each pixel point in the image, converting it into binary data smaller than the original numerical byte, forming a new image for testing, saving storage space, and improving testing efficiency.
The converted images save data storage space during testing, improve the running efficiency of the test software, and thus improve the image testing efficiency.
Smart Images

Figure CN119211515A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of camera module testing, and in particular to a method, device, medium and equipment for improving image testing efficiency. Background Art
[0002] The image output size of traditional CMOS chips is generally 10bit or 12bit, but for some special chips, in order to improve the precision and accuracy of stored data, some camera modules will output images in 32float_mono format.
[0003] Before the camera module leaves the factory, it will undergo a series of quality inspections, among which the inspection of the images taken by the camera module is one of the quality inspection methods. However, the images obtained in the 32float_mono output format will occupy a larger memory due to the high precision of the stored data. Therefore, when testing the images, the operating efficiency of the test software will be greatly reduced, affecting the test efficiency.
[0004] Based on this, a method is currently needed to improve the testing efficiency of images for the 32float_mono image format. Summary of the invention
[0005] In view of the problems existing in the prior art, the embodiments of the present invention provide a method, device, medium and equipment for improving image testing efficiency, so as to solve or partially solve the technical problems in the prior art that images in 32float_mono format have high data accuracy and occupy too much memory, thereby affecting the image testing efficiency.
[0006] A first aspect of the present invention provides a method for improving image testing efficiency, the method comprising:
[0007] Obtaining a first value of each pixel in the first target image in the memory;
[0008] Convert each of the first values into a second value, and assign the second value to a pointer variable of a preset type; the bytes corresponding to the pointer variable of the preset type are smaller than the bytes occupied by the first value;
[0009] A second target image formed by each of the second values is tested.
[0010] In the above solution, the step of obtaining a first value of each pixel in the first target image in the memory includes:
[0011] The first target image is read in a byte stream manner to obtain a first current value corresponding to each pixel;
[0012] Each of the first current values is converted into a corresponding first value.
[0013] In the above solution, the first target image is read in a byte stream manner to obtain the first current value corresponding to each pixel, including:
[0014] Reading the first target image line by line to obtain values corresponding to all bytes;
[0015] The first current value corresponding to each pixel is extracted according to the byte position occupied by each pixel.
[0016] In the above solution, converting each of the first current values into a corresponding first value includes:
[0017] For any first current value, convert the first current value into binary data;
[0018] Determining the exponent and mantissa of the binary data;
[0019] Calculating the value of the mantissa using standard binary floating point arithmetic;
[0020] According to the formula value = 1 × 2 k ×m determines the first numerical value value; wherein, k is the exponent, and m is the value of the mantissa.
[0021] In the above solution, converting each of the first values into a second value includes:
[0022] For any first value, round the first value to obtain a corresponding second current value;
[0023] The second current value is converted into hexadecimal data, and the hexadecimal data is the second value.
[0024] In the above solution, after assigning the second value to a pointer variable of a preset type, the method further includes:
[0025] The second value is stored in the memory using the pointer variable.
[0026] A second aspect of the present invention provides a device for improving image testing efficiency, the device comprising:
[0027] An acquisition unit, used for acquiring a first value of each pixel in the first target image in the memory;
[0028] A first conversion unit, configured to convert each of the first values into a second value, and assign the second value to a pointer variable of a preset type; the bytes corresponding to the pointer variable of the preset type are smaller than the bytes occupied by the first value;
[0029] A testing unit is used to test the second target image formed by each of the second values.
[0030] In the above solution, the acquisition unit is specifically used for:
[0031] Based on the format of the first target image, the first target image is read in a byte stream manner to obtain a first current value corresponding to each pixel;
[0032] Each of the first current values is converted into a corresponding first value.
[0033] According to a third aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the steps of any one of the methods described in the first aspect are implemented.
[0034] According to a fourth aspect of the present invention, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any one of the methods described in the first aspect are implemented.
[0035] The present invention provides a method, device, medium and equipment for improving image testing efficiency. The method includes: obtaining a first value in a memory of each pixel point in a first target image; converting each of the first values into a second value, and assigning the second value to a pointer variable of a preset type; the byte corresponding to the pointer variable of the preset type is smaller than the byte occupied by the first value; testing a second target image formed by each of the second values; in this way, after converting the first value into the second value, the second value is assigned to a pointer variable of the preset type for storage. Since the byte corresponding to the pointer variable of the preset type is smaller than the byte occupied by the first value, data storage space can be saved. Therefore, when testing the second target image, the operating efficiency of the test software can be improved, thereby improving the test efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0037] Figure 1A schematic diagram of a method flow for improving image testing efficiency according to an embodiment of the present invention is shown;
[0038] Figure 2 A schematic diagram of the structure of a device for improving image testing efficiency according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0039] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0040] The present invention provides a method for improving image testing efficiency, such as Figure 1 As shown, the method mainly includes the following steps:
[0041] S110, obtaining a first value of each pixel in the first target image in the memory.
[0042] In one implementation, obtaining a first value of each pixel in the first target image in a memory includes:
[0043] The first target image is read in a byte stream manner to obtain a first current value corresponding to each pixel;
[0044] Convert each first current value to a corresponding first value.
[0045] In one implementation, the first target image is read in a byte stream manner to obtain a first current value corresponding to each pixel, including:
[0046] Reading the first target image line by line to obtain values corresponding to all bytes;
[0047] The first current value corresponding to each pixel is extracted according to the byte position occupied by each pixel.
[0048] Specifically, the format of the first target image is 32float_mono format, which is: npAry_Y_img = 0.3*imgDemosaic_R + 0.59*imgDemosaic_G + 0.11*imgDemosaic_B. It can be seen that the pixel value npAry_Y_img of each pixel obtained according to this formula is a float single-precision floating point number, and a single-precision floating point number occupies 4 bytes in the computer memory. That is, the first current value corresponding to a pixel will occupy 4 bytes.
[0049] Therefore, for the first target image, the first current value corresponding to each pixel point may be read row by row until the entire image is completely read.
[0050] For example, assuming that the size of the first target image is 4000*3000, after reading the first target image, 4000*3000*4=24000000 bytes can be obtained, and the byte position corresponding to each pixel is different. Therefore, the current byte position occupied by the pixel can be found according to the position of the pixel, and then the first current value in the current byte position can be extracted.
[0051] For example, the byte positions occupied by the first pixel are byte0 to byte3, the byte positions occupied by the second pixel are byte4 to byte7, etc. Then, when determining the first current value corresponding to the first pixel, the value in byte0 to byte3 can be extracted.
[0052] After the first current value is determined, the first current value needs to be converted into the first value.
[0053] In one implementation, converting each first current value into a corresponding first value includes:
[0054] For any first current value, convert the first current value into binary data;
[0055] Determine the exponent and mantissa of binary data;
[0056] Calculating the value of the mantissa using standard binary floating point arithmetic;
[0057] According to the formula value = 1 × 2 k ×m determines the first numerical value value; wherein k is the exponent and m is the value of the mantissa.
[0058] Specifically, since the first current value is hexadecimal data, the present invention needs to convert the hexadecimal data into binary data, and then determine the first value according to the binary data.
[0059] For example, suppose the 4 bytes of hexadecimal data read are 0x71, 0xfd, 0x83, 0x42. Since the computer memory is stored in little-endian mode, the value is 0x4283fd71, which is converted to binary as follows: 01000010 1000 00111111 1101 0111 0001. This binary number is decomposed into the following components: Sign bit (1 bit): 0 (indicating a positive number); Exponent (8 bits): 10000101 (133, decimal); Mantissa (23 bits): 0000011111110101110001; Among them, the actual exponent should be the exponent minus the offset, specifically: 133-127 (offset) = 6. Therefore, the actual exponent is 6.
[0060] Then according to the IEEE 754 standard, the mantissa is calculated to be: 1.0310938358306885. Finally, according to the formula value = 1 × 2 6 ×1.0310938358306885=67.990005.
[0061] In this way, the first value corresponding to each pixel is obtained.
[0062] S111, converting each of the first numerical values into a second numerical value, and assigning the second numerical value to a pointer variable of a preset type; the bytes corresponding to the pointer variable of the preset type are smaller than the bytes occupied by the first numerical value.
[0063] It is understandable that the first value is still floating-point data. Therefore, in order to reduce the memory occupancy of the data, the present invention also needs to convert the first value to obtain a second value, and assign the second value to a pointer variable of a preset type; the bytes corresponding to the pointer variable of the preset type are smaller than the bytes occupied by the first value.
[0064] Among them, the pointer variable of the preset type can be an unsinged short type. Since the unsinged short type pointer stipulates that it only occupies 2 bytes when storing data, the memory usage can be reduced when storing each pixel point.
[0065] In one embodiment, converting each first value into a second value includes:
[0066] For any first value, round the first value to obtain the corresponding second current value;
[0067] The second current value is converted into hexadecimal data, and the hexadecimal data is the second value.
[0068] In one embodiment, after assigning the second value to the pointer variable of the preset type, the method further includes:
[0069] The second value is stored in memory using a pointer variable.
[0070] For example, assuming the first value is 612.23, 612.23 will be rounded to 612. Then 612 will be converted into hexadecimal data (the second value), which is 0x264. Finally, 0x264 will be assigned to the pointer of the unsingedshort type.
[0071] Due to the characteristics of the unsinged short pointer itself, only 2 bytes are needed to store a set of data. Therefore, when the second value is 0x264, 0x02 is stored in one byte and 0x64 is stored in another byte.
[0072] In this way, the storage space required for each pixel point is converted from 4 bytes to 2 bytes, thereby reducing the space occupied by the first target image.
[0073] S112: testing a second target image formed by each of the second values.
[0074] It is understandable that when all the second values are stored, a new image (second target image) is obtained. When the second target image is subsequently tested using the test software, the second target image saves data storage space, thereby improving the operating efficiency of the test software, improving the image testing efficiency, and thus improving the quality inspection efficiency of the camera module.
[0075] Based on the same inventive concept as in the above-mentioned embodiment, this embodiment also provides a device for improving the efficiency of image testing, such as Figure 2 As shown, the device comprises:
[0076] An acquisition unit 21 is used to acquire a first value of each pixel in a first target image in a memory;
[0077] A first conversion unit 22 is used to convert each of the first values into a second value, and assign the second value to a pointer variable of a preset type; the bytes corresponding to the pointer variable of the preset type are smaller than the bytes occupied by the first value;
[0078] The testing unit 23 is used to test the second target image formed by each of the second values.
[0079] In one implementation, the acquiring unit 21 is specifically configured to:
[0080] Based on the format of the first target image, the first target image is read in a byte stream manner to obtain a first current value corresponding to each pixel;
[0081] Each of the first current values is converted into a corresponding first value.
[0082] Since the device introduced in the embodiment of the present invention is a device used to implement the method for improving the efficiency of image testing in the embodiment of the present invention, based on the method introduced in the embodiment of the present invention, a person skilled in the art can understand the specific structure and deformation of the device, so it is not described here. All devices used in the method of the embodiment of the present invention belong to the scope of protection of the present invention.
[0083] Based on the same inventive concept, this embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any step of the method described above when executing the computer program.
[0084] Based on the same inventive concept, this embodiment provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the methods described above are implemented.
[0085] Through one or more embodiments of the present invention, the present invention has the following beneficial effects or advantages:
[0086] The present invention provides a method, device, medium and equipment for improving image testing efficiency. The method includes: obtaining a first value in a memory of each pixel point in a first target image; converting each of the first values into a second value, and assigning the second value to a pointer variable of a preset type; the byte corresponding to the pointer variable of the preset type is smaller than the byte occupied by the first value; testing a second target image formed by each of the second values; in this way, after converting the first value into the second value, the second value is assigned to a pointer variable of the preset type for storage. Since the byte corresponding to the pointer variable of the preset type is smaller than the byte occupied by the first value, data storage space can be saved. Therefore, when testing the second target image, the operating efficiency of the test software can be improved, thereby improving the test efficiency.
[0087] The algorithm and display provided herein are not inherently related to any particular computer, virtual system or other device. Various general purpose systems can also be used together with the teachings based on this. According to the above description, it is obvious that the structure required for constructing such systems. In addition, the present invention is not directed to any specific programming language either. It should be understood that various programming languages can be utilized to realize the content of the present invention described herein, and the description of the above specific languages is for disclosing the best mode of the present invention.
[0088] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0089] Similarly, it should be understood that in order to streamline the present disclosure and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the intention that the claimed invention requires more features than those explicitly recited in each claim. More specifically, as reflected in the claims below, inventive aspects lie in less than all the features of the individual embodiments disclosed above. Therefore, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, with each claim itself serving as a separate embodiment of the present invention.
[0090] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.
[0091] In addition, those skilled in the art will appreciate that, although some embodiments herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and form different embodiments. For example, in the claims below, any one of the claimed embodiments may be used in any combination.
[0092] The various component embodiments of the present invention can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all functions of some or all components in a gateway, proxy server, or system according to an embodiment of the present invention. The present invention can also be implemented as a device or apparatus program (e.g., a computer program and a computer program product) for executing part or all of the methods described herein. Such a program implementing the present invention can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
[0093] It should be noted that the above embodiments illustrate the present invention rather than limit it, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising a number of different elements and by means of a suitably programmed computer. In a unit claim enumerating a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc., does not indicate any order. These words may be interpreted as names.
[0094] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0095] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for improving image testing efficiency, characterized in that: The method comprises: Obtaining a first value of each pixel in the first target image in the memory; Convert each of the first values into a second value, and assign the second value to a pointer variable of a preset type; the bytes corresponding to the pointer variable of the preset type are smaller than the bytes occupied by the first value; A second target image formed by each of the second values is tested.
2. The method according to claim 1, characterized in that The step of obtaining a first value of each pixel in the first target image in the memory includes: The first target image is read in a byte stream manner to obtain a first current value corresponding to each pixel; Each of the first current values is converted into a corresponding first value.
3. The method according to claim 2, characterized in that The step of reading the first target image in a byte stream manner to obtain a first current value corresponding to each pixel point includes: Reading the first target image line by line to obtain values corresponding to all bytes; The first current value corresponding to each pixel is extracted according to the byte position occupied by each pixel.
4. The method according to claim 2, characterized in that The converting each of the first current values into a corresponding first value comprises: For any first current value, convert the first current value into binary data; Determining the exponent and mantissa of the binary data; Calculating the value of the mantissa using standard binary floating point arithmetic; According to the formula value = 1 × 2 k ×m determines the first numerical value value; wherein, k is the exponent, and m is the value of the mantissa.
5. The method according to claim 1, characterized in that The converting each of the first values into a second value comprises: For any first value, round the first value to obtain a corresponding second current value; The second current value is converted into hexadecimal data, and the hexadecimal data is the second value.
6. The method according to claim 1, characterized in that After assigning the second value to the pointer variable of a preset type, the method further includes: The second value is stored in the memory using the pointer variable.
7. A device for improving image testing efficiency, characterized in that: The device comprises: An acquisition unit, used for acquiring a first value of each pixel in the first target image in the memory; A first conversion unit, configured to convert each of the first values into a second value, and assign the second value to a pointer variable of a preset type; the bytes corresponding to the pointer variable of the preset type are smaller than the bytes occupied by the first value; A testing unit is used to test the second target image formed by each of the second values.
8. The device according to claim 7, characterized in that The acquisition unit is specifically used for: Based on the format of the first target image, the first target image is read in a byte stream manner to obtain a first current value corresponding to each pixel; Each of the first current values is converted into a corresponding first value.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the method according to any one of claims 1 to 6 are implemented.
