Image data bit width expansion method and device, electronic equipment and storage medium
By calculating the expansion coefficient and generating fill data, the bit width expansion of the low-bit width image data is solved, and the problem of discontinuity of the histogram of the high-bit width image data is achieved, richer image information and a larger dynamic range are achieved, and image quality is improved.
Patent Information
- Application Number
- CN202510287067.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-12
- Publication Date
- 2025-06-27
AI Technical Summary
In the process of expanding the bit width of low-bit width image data to high-bit width image data, the histogram of high-bit width image data is discontinuous, with obvious jagged shapes, and a small dynamic range, which affects the image quality.
By receiving the low bit width image data, the first bit width and the second bit width, the expansion coefficient is calculated, and the filling data of each pixel point is generated based on the expansion coefficient and the bit width, the bit width expansion of the low bit width data is used to generate the high bit width image data.
It improves the histogram continuity and smoothness of high-bit width image data, increases the information richness and dynamic range of image data, and improves image quality.
Smart Images

Figure CN120219260A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular, to an image data bit-width expansion method, device, electronic device, and storage medium. Background Art
[0002] Currently, most scientific Complementary Metal Oxide Semiconductor (sCMOS) products on the market, such as scientific cameras, include a High Dynamic Range (HDR) function. The HDR data is usually converted from high and low gain data, and the bit-width of the HDR data (i.e., the bit depth occupied by the data) is higher than that of the high and low gain data. The histogram of the high-bit-width image data obtained after bit-width expansion is discontinuous and has obvious serrations. Summary of the Invention
[0003] In view of this, an object of the present invention is to provide an image data bit-width expansion method, device, electronic device, and storage medium, which can improve the continuity and smoothness of the histogram of high-bit-width image data.
[0004] To achieve the above object, the technical solutions adopted in the embodiments of the present invention are as follows:
[0005] In a first aspect, the present invention provides an image data bit-width expansion method, and the method includes:
[0006] Receiving low-bit-width image data, a first bit-width, and a second bit-width; the first bit-width is lower than the second bit-width; the low-bit-width image data includes low-bit-width data of a plurality of pixel points;
[0007] Obtaining an expansion coefficient according to the first bit-width and the second bit-width;
[0008] Obtaining the filling data of each of the pixel points according to the expansion coefficient, the first bit-width, and the second bit-width;
[0009] Generating high-bit-width image data according to the expansion coefficient, the low-bit-width data of each of the pixel points, and the corresponding filling data.
[0010] In an optional implementation manner, the obtaining the filling data of each of the pixel points according to the expansion coefficient, the first bit-width, and the second bit-width includes:
[0011] Creating an expansion pool according to the expansion coefficient; the expansion pool includes a plurality of expansion values;
[0012] Obtain multiple target expansion values corresponding to each of the pixel points from the expansion pool according to the expansion coefficient, the first bit width, and the second bit width;
[0013] Generate filling data for each of the pixel points according to the multiple target expansion values corresponding to each of the pixel points.
[0014] In an alternative embodiment, the obtaining multiple target expansion values corresponding to each of the pixel points from the expansion pool according to the expansion coefficient, the first bit width, and the second bit width includes:
[0015] Determine the filling quantity according to the expansion coefficient, the first bit width, and the second bit width;
[0016] Randomly generate target indexes corresponding to each of the pixel points according to the filling quantity;
[0017] Obtain multiple target expansion values corresponding to each of the pixel points from the expansion pool according to the target indexes.
[0018] In an alternative embodiment, the determining the filling quantity according to the expansion coefficient, the first bit width, and the second bit width includes:
[0019] Calculate the difference between the second bit width and the first bit width;
[0020] Determine the filling quantity according to the ratio of the expansion coefficient to the difference.
[0021] In an alternative embodiment, the randomly generating target indexes corresponding to each of the pixel points according to the filling quantity includes:
[0022] Generate corresponding quantities of random values for each of the pixel points according to the filling quantity;
[0023] Generate target indexes corresponding to each of the pixel points according to each random value corresponding to the pixel point and the expansion pool capacity; the expansion pool capacity is used to represent the number of expansion values in the expansion pool.
[0024] In an alternative embodiment, the generating filling data for each of the pixel points according to the multiple target expansion values corresponding to each of the pixel points includes:
[0025] Sum the multiple target expansion values corresponding to each of the pixel points to obtain the filling data for each of the pixel points.
[0026] In an alternative embodiment, the generating high-bit-width image data according to the expansion coefficient, the low-bit-width data of each of the pixel points, and the corresponding filling data includes:
[0027] Calculate the product of the low-bit-width data of each of the pixel points and the expansion coefficient;
[0028] Sum each of the products and the corresponding padding data to obtain the high-bit-width data of each of the pixel points; wherein, the high-bit-width data of all the pixel points constitutes the high-bit-width image data.
[0029] In a second aspect, the present invention provides an image data bit-width expansion device, the device comprising:
[0030] A receiving module, configured to receive low-bit-width image data, a first bit-width, and a second bit-width; the first bit-width is lower than the second bit-width; the low-bit-width image data includes low-bit-width data of a plurality of pixel points;
[0031] An expansion module, configured to obtain an expansion coefficient according to the first bit-width and the second bit-width; obtain padding data of each of the pixel points according to the expansion coefficient, the first bit-width, and the second bit-width; and generate high-bit-width image data according to the expansion coefficient, the low-bit-width data of each of the pixel points, and the corresponding padding data.
[0032] In a third aspect, the present invention provides an electronic device, comprising a processor and a memory, the memory storing a computer program that can be executed by the processor, and the processor being capable of executing the computer program to implement the image data bit-width expansion method according to any one of the foregoing embodiments.
[0033] In a fourth aspect, the present invention provides a computer-readable storage medium, having stored thereon a computer program, and when the computer program is executed by a processor, implementing the image data bit-width expansion method according to any one of the foregoing embodiments.
[0034] Compared with the prior art, the image data bit-width expansion method, device, electronic device, and storage medium provided by the embodiments of the present invention obtain an expansion coefficient according to a first bit-width and a second bit-width, obtain padding data of each pixel point according to the expansion coefficient, the first bit-width, and the second bit-width, and perform bit-width expansion on the low-bit-width data of the pixel points by using the expansion coefficient and the padding data corresponding to the pixel points to obtain high-bit-width image data. The present invention supports bit-width expansion of any low-bit-width image data to high-bit-width image data, and uses padding data to dynamically fill in intermediate data lost during the conversion from low-bit-width image data to high-bit-width image data, so that the information of the high-bit-width image data is richer, the dynamic range is larger, and the continuity and smoothness of the histogram of the high-bit-width image data are improved.
[0035] To make the above objects, features, and advantages of the present invention more obvious and understandable, the following specifically enumerates preferred embodiments and, in conjunction with the accompanying drawings, makes a detailed description as follows. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required for use in the embodiments. It should be understood that the following drawings only show certain embodiments of the present invention, and therefore should not be regarded as limiting the scope. For those of ordinary skill in the art, without creative efforts, other related drawings can also be obtained based on these drawings.
[0037] Figure 1 Fig. Figure 1 shows a schematic flowchart of a method for expanding the bit width of image data provided by an embodiment of the present invention.
[0038] Figure 2 Fig. Figure 2 shows another schematic flowchart of a method for expanding the bit width of image data provided by an embodiment of the present invention.
[0039] Figure 3 Fig. Figure 3 shows a schematic diagram of a histogram of low-bit-width image data provided by an embodiment of the present invention.
[0040] Figure 4 Fig. Figure 4 shows a schematic diagram of a histogram of high-bit-width image data provided by an embodiment of the present invention.
[0041] Figure 5 Fig. Figure 5 shows a schematic diagram of a histogram of high-bit-width image data provided by the prior art.
[0042] Figure 6 Fig. Figure 6 shows a schematic block diagram of an apparatus for expanding the bit width of image data provided by an embodiment of the present invention.
[0043] Figure 7 Fig. Figure 7 shows a schematic block diagram of an electronic device provided by an embodiment of the present invention.
[0044] Icons: 400 - Apparatus for expanding the bit width of image data; 401 - Receiving module; 402 - Expanding module; 500 - Electronic device; 510 - Memory; 520 - Processor; 530 - Communication module. Detailed embodiments
[0045] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Usually, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0046] Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed present invention, but only represents the selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.
[0047] It should be noted that relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprising", "including" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the element.
[0048] The high dynamic range function of sCMOS products involves the bit-width expansion of low-bit-width image data to high-bit-width image data. Through research by the inventors, it is found that there is currently no relatively mature and effective technical means for bit-width expansion technology. The more commonly used technology is to multiply low-bit-width image data by a set scale factor to obtain high-bit-width image data. This will result in the loss of intermediate values in the high-bit-width image data, the dynamic range of the high-bit-width image data is small, the histogram of the high-bit-width image data appears discontinuous, showing obvious "jaggedness", and the continuity and smoothness of the histogram are poor, which does not conform to the histogram characteristics. The image details generated based on the high-bit-width image data are not rich enough, affecting the image quality.
[0049] Based on this, the image data bit-width expansion method and device provided in the embodiments of the present invention obtain an expansion coefficient according to the first bit-width and the second bit-width, obtain the filling data of each pixel point according to the expansion coefficient, the first bit-width and the second bit-width, and use the expansion coefficient and the filling data corresponding to the pixel point to perform bit-width expansion on the low-bit-width data of the pixel point to obtain high-bit-width image data. The present invention supports the bit-width expansion of any low-bit-width image data to high-bit-width image data, and uses the filling data to dynamically fill the intermediate data lost during the conversion from low-bit-width image data to high-bit-width image data, so that the information of the high-bit-width image data is richer, the dynamic range is larger, and the continuity and smoothness of the histogram of the high-bit-width image data are improved.
[0050] The following will describe each embodiment of the present invention in detail with reference to the accompanying drawings.
[0051] Please refer to Figure 1 , Figure 1 which shows a schematic flowchart of an image data bit-width expansion method provided by an embodiment of the present invention. The method includes the following steps:
[0052] Step S10: Receive low-bitwidth image data, a first bitwidth, and a second bitwidth; the first bitwidth is lower than the second bitwidth; the low-bitwidth image data includes low-bitwidth data of multiple pixel points.
[0053] In an embodiment of the present invention, a high-dynamic range image is generated based on low-gain data and high-gain data. Among them, the low-gain data is suitable for capturing high-light regions and can avoid overexposure. The high-gain data is suitable for capturing low-light regions and can improve the visibility of weak signals. When the high-gain data saturates (exceeds a preset threshold), it cannot accurately reflect the details of the high-light region, and it is necessary to use the low-gain data to restore the details of the high-light region.
[0054] Since the bitwidth of the low-gain data of the image is lower than that of the HDR data, when generating HDR data using the low-gain data, the low-gain data is used as the low-bitwidth image data, and the low-bitwidth image data, the first bitwidth, and the second bitwidth are input to an electronic device (such as a scientific camera). Among them, the first bitwidth is the bitwidth value of the low-bitwidth image data, that is, the low bitwidth before bitwidth expansion. The second bitwidth is the bitwidth value of the high-bitwidth image data, that is, the bitwidth value of the HDR data, which is the high bitwidth after bitwidth expansion.
[0055] Step S20: Obtain an expansion coefficient according to the first bitwidth and the second bitwidth.
[0056] In an embodiment of the present invention, calculate the difference between the second bitwidth and the first bitwidth, and obtain the expansion coefficient according to the difference. The calculation formula for the expansion coefficient is:
[0057] TransRatio = 2 HighBit-LowBit
[0058] where TransRatio is the expansion coefficient, HighBit is the second bitwidth, and LowBit is the first bitwidth.
[0059] Assume that the second bitwidth is 16 and the first bitwidth is 12, then the difference is 4. Using the above calculation formula, it can be known that the expansion coefficient is 16.
[0060] Step S30: Obtain the filling data of each pixel point according to the expansion coefficient, the first bitwidth, and the second bitwidth.
[0061] Step S40: Generate high-bitwidth image data according to the expansion coefficient, the low-bitwidth data of each pixel point, and the corresponding filling data.
[0062] In an embodiment of the present invention, the filling data of each pixel point is generated based on the expansion coefficient, the first bitwidth, and the second bitwidth. The filling data is used to fill the intermediate data when performing bitwidth expansion on the low-bitwidth image data. The low-bitwidth data of each pixel point is subjected to bitwidth expansion processing using the expansion coefficient and the filling data to obtain high-bitwidth image data.
[0063] In summary, the image data bit-width expansion method provided by the embodiments of the present invention obtains an expansion coefficient according to the first bit-width and the second bit-width, obtains the filling data of each pixel point according to the expansion coefficient, the first bit-width and the second bit-width, and uses the expansion coefficient and the filling data corresponding to the pixel point to perform bit-width expansion on the low-bit-width data of the pixel point to obtain high-bit-width image data. The present invention supports the bit-width expansion from any low-bit-width image data to high-bit-width image data, and uses the filling data to dynamically fill the intermediate data lost during the conversion from low-bit-width image data to high-bit-width image data, making the information of the high-bit-width image data richer, the dynamic range larger, and improving the continuity and smoothness of the histogram of the high-bit-width image data.
[0064] Optionally, for how to generate the filling data of each pixel point, a possible implementation manner is provided below. Please refer to Figure 2 , Figure 1 and the sub-steps of step S30 in
[0065] Step S301: Create an expansion pool according to the expansion coefficient; the expansion pool includes multiple expansion values.
[0066] In the embodiments of the present invention, assuming that the expansion coefficient is 16, then the expansion pool is [-16, 16]. That is to say, the expansion pool is the set of integers from -16 to 16. The calculation formula for the capacity of the expansion pool is:
[0067] Capa = 2×TransRatio + 1
[0068] where Capa is the capacity of the expansion pool.
[0069] According to the calculation formula for the capacity of the expansion pool, when the expansion coefficient is 16, the capacity of the expansion pool is 33, that is, the expansion pool includes 33 expansion values.
[0070] Step S302: Obtain multiple target expansion values corresponding to each pixel point from the expansion pool according to the expansion coefficient, the first bit-width and the second bit-width.
[0071] Step S303: Generate the filling data of each pixel point according to the multiple target expansion values corresponding to each pixel point.
[0072] In the embodiments of the present invention, multiple target expansion values corresponding to each pixel point are obtained from the expansion values based on the expansion coefficient, the first bit-width and the second bit-width. Among them, the target expansion value is part or all of the expansion values in the expansion pool, and the multiple target expansion values corresponding to each pixel are not the same or not completely the same. For each pixel point, the filling data is generated using the corresponding multiple target expansion values.
[0073] It can be seen that the embodiments of the present invention can dynamically create an expansion pool according to the low bit width (i.e., the first bit width) and the high bit width (i.e., the second bit width), randomly obtain multiple target expansion values corresponding to each pixel point from the expansion pool, and use the multiple target expansion values to implement dynamic data filling, making the histogram of the high bit width image data more continuous.
[0074] Optionally, in practical applications, the expansion values correspond one-to-one with the indexes, that is, each expansion value corresponds to a unique index. For how to obtain multiple target expansion values corresponding to each pixel point, a possible implementation manner is provided below. Figure 2 The sub-steps of step S302 in
[0075] Determine the filling quantity according to the expansion coefficient, the first bit width and the second bit width; randomly generate target indexes corresponding to each pixel point according to the filling quantity; obtain multiple target expansion values corresponding to each pixel point from the expansion pool according to the target indexes.
[0076] In the embodiments of the present invention, the filling quantity is generated by using the expansion coefficient, the first bit width and the second bit width. Wherein, the filling quantity is the number of target expansion values corresponding to each pixel point. For each pixel point, multiple target indexes are randomly generated, the number of target indexes is the filling quantity, and the expansion values corresponding to the target indexes are obtained from the expansion pool to obtain multiple target expansion values corresponding to the pixel point.
[0077] It should be noted that, assuming the expansion coefficient is 16 and the expansion pool capacity is 33, then the target index is any integer between 1 and 33. For example, if the target index is 7, then the seventh expansion value -10 in the expansion pool is obtained, and -10 is used as the target expansion value corresponding to the target index.
[0078] It can be seen that the embodiments of the present invention can effectively improve the randomness and naturalness after the bit width expansion of the image data by randomly selecting the expansion values, and further can improve the quality and authenticity of the finally generated high bit width data.
[0079] Optionally, for how to obtain the filling quantity, a possible implementation manner is provided below, which may include the following steps:
[0080] Calculate the difference between the second bit width and the first bit width; determine the filling quantity according to the ratio of the expansion coefficient to the difference.
[0081] In the embodiments of the present invention, assuming the first bit width is 12 and the second bit width is 16, then the expansion coefficient is 16, the difference between the second bit width and the first bit width is 4, the ratio of the expansion coefficient to the difference is 4, and an integer not less than the ratio 4 is determined as the filling quantity. Wherein, the maximum value of the filling quantity can be set according to the actual application, and the present invention does not limit this.
[0082] As a possible implementation, for example, the expansion coefficient 16 is determined as the filling quantity, and the filling quantity is used as the number of loops. In each loop, a positive integer random number within the range of 1 to 33 is generated, and this random number is used as the target index to obtain the expansion value corresponding to the target index from the expansion pool as the target expansion value corresponding to the target index. That is to say, each pixel point undergoes 16 loops to obtain 16 target expansion values.
[0083] Optionally, for how to generate the target index, a possible implementation is provided below. It may include the following steps:
[0084] Generate corresponding random values for each pixel point according to the filling quantity; generate the target index for each pixel point according to each random value corresponding to the pixel point and the expansion pool capacity, where the expansion pool capacity is used to represent the number of expansion values in the expansion pool.
[0085] In the embodiment of the present invention, multiple random values within the positive integer range are generated for each pixel point, and the number of random values is consistent with the filling quantity. Subtract 1 from each random value and then take the modulus of the expansion pool capacity, and determine the sum of the obtained remainder and 1 as the target index corresponding to the random value. The calculation formula for the target index is:
[0086] index=(num - 1)modCapa + 1
[0087] Where index is the target index; num is the random value; Capa is the expansion pool capacity; mod is the modulo operation.
[0088] As a possible implementation, assume that the filling quantity is 5 and the expansion pool capacity is 33. Generate 5 random values for a certain pixel point, which are 1, 10, 33, 34, and 100 respectively. Use the calculation formula of the target index to generate the target indexes corresponding to the 5 random values in sequence, which are 1, 10, 33, 1, and 1 respectively.
[0089] It should be noted that due to the limitation that only positive integers can be generated by current technical means, it is necessary to obtain the expansion value in the expansion pool through the index method. If integer random values (including positive integers, negative integers, and zero) can be generated with the development of technology, then the steps related to the target index can be skipped, and any expansion value in the expansion pool can be directly randomly selected as the target expansion value.
[0090] Optionally, for how to obtain the corresponding filling data using the target expansion value, a possible implementation is provided below. Figure 2 The sub - steps of step S303 may include:
[0091] Sum the multiple target expansion values corresponding to each pixel point to obtain the filling data for each pixel point.
[0092] In an embodiment of the present invention, the filling data of each pixel is calculated, that is, the multiple target expansion values corresponding to each pixel are accumulated and summed to obtain the filling data of each pixel. The calculation formula of the filling data is:
[0093]
[0094] where TransData is the filling data; n is the filling quantity; TransSubData k is the kth target expansion value.
[0095] Optionally, for how to generate the filling data of each pixel, a possible implementation manner is provided below. Please refer to Figure 2 , Figure 1 The sub-steps of step S40 in may include:
[0096] Step S401, calculate the product of the low-bit-width data of each pixel and the expansion coefficient.
[0097] Step S402, sum each product with the corresponding filling data to obtain the high-bit-width data of each pixel; among them, the high-bit-width data of all pixels constitutes the high-bit-width image data.
[0098] In an embodiment of the present invention, the low-bit-width data of each pixel is subjected to bit-width expansion according to the calculation formula of bit-width expansion to obtain the high-bit-width data of the pixel. The calculation formula of bit-width expansion is:
[0099] PH(x,y) = PL(x,y) × TransRatio + TransData(x,y)
[0100] where (x,y) is the coordinate of the pixel; PH(x,y) is the high-bit-width data of the pixel corresponding to the coordinate (x,y); PL(x,y) is the low-bit-width data of the pixel corresponding to the coordinate (x,y); TransData(x,y) is the filling data of the pixel corresponding to the coordinate (x,y).
[0101] As a possible implementation manner, assuming that the 12-bit low-bit-width image data is expanded to 16-bit high-bit-width image data, then, the first bit-width is 12 and the second bit-width is 16. The histogram of the low-bit-width image data is as Figure 3 shown, where the horizontal axis of the histogram represents brightness and the vertical axis represents the number of pixels. Using the embodiment of the present invention to perform bit-width expansion on the low-bit-width image data, the histogram of the obtained high-bit-width image data is as Figure 4 shown. Obviously, compared with the histogram of the high-bit-width image data obtained by the prior art (as Figure 5As shown, the histogram of the high-bitwidth image data obtained in the embodiments of the present invention is more in line with the change trend of the histogram of the low-bitwidth image data, and its continuity and smoothness are significantly better than those of the prior art.
[0102] It can be seen that in the embodiments of the present invention, the bitwidth length of the low-bitwidth data is adjusted from the first bitwidth to the second bitwidth by using the expansion coefficient, and then the missing intermediate data during the conversion of the image data from the low-bitwidth to the high-bitwidth is dynamically filled by using the filling data, so that the information of the high-bitwidth image data is richer and more extensive, and the dynamic range is larger, thereby improving the continuity and smoothness of the histogram of the high-bitwidth image data.
[0103] Based on the same inventive concept, the basic principle and the technical effects generated by the image data bitwidth expansion device provided in the embodiments of the present invention are the same as those of the above embodiments. For the sake of brief description, for the parts not mentioned in this embodiment, reference can be made to the corresponding content in the above embodiments.
[0104] Please refer to Figure 6 , Figure 6 which is a block schematic diagram of an image data bitwidth expansion device 400 provided in an embodiment of the present invention. The image data bitwidth expansion device includes a receiving module 401 and an expansion module 402.
[0105] The receiving module 401 is configured to receive low-bitwidth image data, the first bitwidth, and the second bitwidth; the first bitwidth is lower than the second bitwidth; the low-bitwidth image data includes low-bitwidth data of a plurality of pixel points;
[0106] The expansion module 402 is configured to obtain an expansion coefficient according to the first bitwidth and the second bitwidth; obtain filling data of each pixel point according to the expansion coefficient, the first bitwidth, and the second bitwidth; and generate high-bitwidth image data according to the expansion coefficient, the low-bitwidth data of each pixel point, and the corresponding filling data.
[0107] In summary, the image data bitwidth expansion device provided in the embodiments of the present invention obtains an expansion coefficient according to the first bitwidth and the second bitwidth, obtains filling data of each pixel point according to the expansion coefficient, the first bitwidth, and the second bitwidth, and performs bitwidth expansion on the low-bitwidth data of the pixel points by using the expansion coefficient and the filling data corresponding to the pixel points to obtain high-bitwidth image data. The present invention supports the bitwidth expansion of any low-bitwidth image data to high-bitwidth image data, and dynamically fills the missing intermediate data during the conversion of the low-bitwidth image data to the high-bitwidth image data by using the filling data, so that the information of the high-bitwidth image data is richer, the dynamic range is larger, and the continuity and smoothness of the histogram of the high-bitwidth image data are improved.
[0108] Optionally, the extension module 402 is specifically configured to create an extension pool according to an extension coefficient; the extension pool includes a plurality of extension values; obtain a plurality of target extension values corresponding to each pixel point from the extension pool according to the extension coefficient, a first bit width, and a second bit width; and generate filling data for each pixel point according to the plurality of target extension values corresponding to each pixel point.
[0109] Optionally, the extension module 402 is specifically configured to determine a filling quantity according to the extension coefficient, the first bit width, and the second bit width; randomly generate a target index corresponding to each pixel point according to the filling quantity; and obtain a plurality of target extension values corresponding to each pixel point from the extension pool according to the target index.
[0110] Optionally, the extension module 402 is specifically configured to calculate a difference between the second bit width and the first bit width; and determine the filling quantity according to a ratio of the extension coefficient to the difference.
[0111] Optionally, the extension module 402 is specifically configured to sum the plurality of target extension values corresponding to each pixel point to obtain filling data for each pixel point.
[0112] Optionally, the extension module 402 is specifically configured to calculate a product of the low-bit width data of each pixel point and the extension coefficient; sum each product and the corresponding filling data to obtain high-bit width data for each pixel point; wherein, the high-bit width data of all pixel points constitutes high-bit width image data.
[0113] Please refer to Figure 7 , which is a block diagram of an electronic device 500 provided in an embodiment of the present invention. The electronic device 500 includes a memory 510, a processor 520, and a communication module 530. Each element of the memory 510, the processor 520, and the communication module 530 is directly or indirectly electrically connected to each other to implement data transmission or interaction. For example, these elements can be electrically connected to each other through one or more communication buses or signal lines.
[0114] Among them, the memory 510 is used to store programs or data. The memory 510 can be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc.
[0115] The processor 520 is used to read / write the data or programs stored in the memory 510 and perform corresponding functions. For example, when the computer program stored in the memory 510 is executed by the processor 520, the image data bit-width expansion method disclosed in the above embodiments can be implemented.
[0116] The communication module 530 is used to establish a communication connection between the electronic device 500 and other communication terminals through a network, and is used to send and receive data through the network.
[0117] It should be understood that Figure 7 The structure shown is only a schematic diagram of the structure of the electronic device 500, and the electronic device 500 may further include more or fewer components than those shown Figure 7 in the figure, or have a different configuration from that shown Figure 7 in the figure. Figure 7 Each component shown in the figure can be implemented by hardware, software, or a combination thereof.
[0118] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by the processor 520, the image data bit-width expansion method disclosed in the above embodiments is implemented.
[0119] An embodiment of the present invention also provides a program product. When the program product is executed by the processor 520, the image data bit-width expansion method disclosed in the above embodiments is implemented.
[0120] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are only illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions, and operations of devices, methods, and computer program products according to multiple embodiments of the present invention. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order from that marked in the accompanying drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0121] In addition, in each embodiment of the present invention, the functional modules can be integrated together to form an independent part, or each module can exist alone, or two or more modules can be integrated to form an independent part.
[0122] If the above-mentioned function is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs that can store program codes.
[0123] The above are only the preferred embodiments of the present invention and are not used to limit the present invention. For those skilled in the art, the present invention can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A method for expanding the bit width of image data, characterized in that: The method comprises: Receiving low-bit-width image data, a first bit-width and a second bit-width; the first bit-width is lower than the second bit-width; the low-bit-width image data includes low-bit-width data of a plurality of pixels; Obtaining an expansion coefficient according to the first bit width and the second bit width; Obtaining padding data for each of the pixels according to the expansion coefficient, the first bit width, and the second bit width; High-bit-width image data is generated according to the expansion coefficient, the low-bit-width data of each pixel point and the corresponding padding data.
2. The method for expanding the bit width of image data according to claim 1, characterized in that: The obtaining padding data of each pixel point according to the expansion coefficient, the first bit width and the second bit width includes: Creating an extension pool according to the extension coefficient; the extension pool includes a plurality of extension values; Acquire a plurality of target extension values corresponding to each of the pixel points from the extension pool according to the extension coefficient, the first bit width, and the second bit width; The padding data of each pixel point is generated according to a plurality of target extension values corresponding to each pixel point.
3. The method for expanding the bit width of image data according to claim 2, characterized in that: The acquiring, from the extension pool according to the extension coefficient, the first bit width, and the second bit width, a plurality of target extension values corresponding to each of the pixel points comprises: Determine a padding amount according to the expansion coefficient, the first bit width, and the second bit width; Randomly generate a target index corresponding to each pixel point according to the filling quantity; A plurality of target extension values corresponding to each of the pixel points are obtained from the extension pool according to the target index.
4. The method for expanding the bit width of image data according to claim 3, characterized in that: The determining the padding amount according to the expansion coefficient, the first bit width, and the second bit width includes: Calculating a difference between the second bit width and the first bit width; The padding amount is determined according to a ratio of the expansion coefficient to the difference.
5. The method for expanding the bit width of image data according to claim 3, characterized in that: The randomly generating a target index corresponding to each pixel point according to the filling quantity includes: Generate a corresponding number of random values corresponding to each of the pixel points according to the filling number; According to each random value corresponding to the pixel point and the capacity of the extension pool, a target index corresponding to each pixel point is generated; the capacity of the extension pool is used to characterize the number of extension values in the extension pool.
6. The method for expanding the bit width of image data according to claim 2, characterized in that: Generating the padding data of each pixel point according to the multiple target extension values corresponding to each pixel point includes: The multiple target extension values corresponding to each of the pixel points are summed to obtain the filling data of each of the pixel points.
7. The method for expanding the bit width of image data according to claim 1, characterized in that: The step of generating high-bit-width image data according to the expansion coefficient, the low-bit-width data of each pixel point and the corresponding padding data comprises: Calculating the product of the low bit width data of each pixel and the expansion coefficient; Each of the products is summed with the corresponding padding data to obtain high-bitwidth data of each of the pixels; wherein the high-bitwidth data of all the pixels constitute the high-bitwidth image data.
8. An image data bit width expansion device, characterized in that: The device comprises: A receiving module, configured to receive low-bit-width image data, a first bit-width, and a second bit-width; the first bit-width is lower than the second bit-width; the low-bit-width image data includes low-bit-width data of a plurality of pixels; An expansion module is used to obtain an expansion coefficient according to the first bit width and the second bit width; obtain padding data for each pixel according to the expansion coefficient, the first bit width and the second bit width; and generate high-bit-width image data according to the expansion coefficient, the low-bit-width data of each pixel and the corresponding padding data.
9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a computer program executable by the processor, and the processor can execute the computer program to implement the image data bit width expansion method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the image data bit width expansion method according to any one of claims 1 to 7 is implemented.