A method of image processing, related apparatus, device and storage medium
By using a conversion relationship with a quantization coefficient of 6 in image format conversion, the YUV format image is converted into RGB format image, and 8-bit data operation is adopted, which solves the problem of high computing resource consumption under the ITU-R BT.601 standard and improves the conversion efficiency.
Patent Information
- Application Number
- CN202110322536.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-25
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2041-03-25
AI Technical Summary
Image format conversion based on the ITU-R BT.601 standard consumes a lot of computing resources, resulting in low efficiency.
The YUV format image is converted using a conversion relationship with a quantization coefficient of 6 to generate an RGB format image, and each color channel uses 8-bit data operation.
It saves data computing power and improves the efficiency of image format conversion.
Smart Images

Figure CN115131445B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the fields of cloud computing technology and image processing technology, and in particular to an image processing method, related apparatus, equipment, and storage medium. Background Art
[0002] With the development of communication network technology, people's demand for video images is increasing, and image encoding and decoding technology has been widely used. In computer vision algorithm processing, there is frequent conversion between different color spaces, whether at the acquisition end and the algorithm end, or between various modules within the algorithm end.
[0003] Currently, commonly used color conversion standards in the industry include the International Telecommunication Union (ITU)-Radiocommunication Sector (R) Broadcasting service television (BT.601) standard. The ITU-R BT.601 standard is a solution for engineering data implementation. While preserving data fidelity, it combines the computing characteristics of computers, quantifies the data to a certain extent, and improves the conversion formula, achieving a compromise between format conversion loss and engineering implementation.
[0004] However, data conversion based on the ITU-R BT.601 standard still requires preserving as many decimal places as possible to ensure accuracy, i.e., performing operations based on 32-bit data. Therefore, more time and computing resources are consumed for format conversion, resulting in low efficiency of image format conversion. Summary of the Invention
[0005] The embodiments of the present application provide an image processing method, related apparatus, device, and storage medium. When converting an image in YUV format based on the BT.601 standard, the quantization coefficient is set to 6, and a target image in RGB format can be obtained. Each color channel in the target image uses 8-bit data operation, thereby saving data calculation amount and improving the efficiency of image format conversion.
[0006] In view of this, the present application provides, on one hand, a method for image processing, comprising:
[0007] Acquire first color-coded data of the image to be converted, wherein the first color-coded data includes first original component data, second original component data, and third original component data;
[0008] For the first original component data and the third original component data included in the first color-coded data, determining the first target channel data by adopting the first channel data conversion relationship of the second color code, wherein the first channel data conversion relationship is determined according to the first channel data quantization conversion relationship and a quantization coefficient, and the quantization coefficient is 6;
[0009] For the first original component data, the second original component data, and the third original component data included in the first color-coded data, second target channel data is determined by adopting a second channel data conversion relationship of the second color code, wherein the second channel data conversion relationship is determined according to a second channel data quantization conversion relationship and a quantization coefficient;
[0010] For the first original component data and the second original component data included in the first color-coded data, determining third target channel data by adopting a third channel data conversion relationship of the second color code, wherein the third channel data conversion relationship is determined according to a third channel data quantization conversion relationship and a quantization coefficient;
[0011] A converted target image is generated according to the first target channel data, the second target channel data, and the third target channel data.
[0012] Another aspect of the present application provides an image processing method, comprising:
[0013] Acquire second color-coded data of the image to be converted, wherein the second color-coded data includes first original channel data, second original channel data, and third original channel data;
[0014] For the first original channel data, the second original channel data, and the third original channel data included in the second color-coded data, determining the first target component data by adopting the first component data conversion relationship of the first color code, wherein the first component data conversion relationship is determined according to the first component data quantization conversion relationship and a quantization coefficient, and the quantization coefficient is 7;
[0015] For the first original channel data, the second original channel data, and the third original channel data included in the second color-coded data, determining the second target component data by adopting the second component data conversion relationship of the first color code, wherein the second component data conversion relationship is determined according to the second component data quantization conversion relationship and the quantization coefficient;
[0016] For the first original channel data, the second original channel data, and the third original channel data included in the second color-coded data, determining third target component data by adopting a third component data conversion relationship of the first color code, wherein the third component data conversion relationship is determined according to a third component data quantization conversion relationship and a quantization coefficient;
[0017] A converted target image is generated according to the first target component data, the second target component data, and the third target component data.
[0018] Another aspect of the present application provides an image processing device, comprising:
[0019] An acquisition module, configured to acquire first color-coded data of an image to be converted, wherein the first color-coded data includes first original component data, second original component data, and third original component data;
[0020] a determining module configured to determine, for the first original component data and the third original component data included in the first color-coded data, first target channel data by adopting a first channel data conversion relationship of the second color code, wherein the first channel data conversion relationship is determined according to a first channel data quantization conversion relationship and a quantization coefficient, and the quantization coefficient is 6;
[0021] The determining module is further configured to determine, for the first original component data, the second original component data, and the third original component data included in the first color-coded data, second target channel data by adopting a second channel data conversion relationship of the second color code, wherein the second channel data conversion relationship is determined according to a second channel data quantization conversion relationship and a quantization coefficient;
[0022] The determining module is further configured to determine, for the first original component data and the second original component data included in the first color-coded data, third target channel data by adopting a third channel data conversion relationship of the second color code, wherein the third channel data conversion relationship is determined according to a third channel data quantization conversion relationship and a quantization coefficient;
[0023] The conversion module is used to generate a converted target image according to the first target channel data, the second target channel data and the third target channel data.
[0024] In one possible design, in another implementation of another aspect of the embodiment of the present application,
[0025] The acquisition module is further configured to acquire a first channel data quantization conversion relationship before acquiring the first color coding data of the image to be converted;
[0026] The acquisition module is also used to obtain the quantitative conversion relationship of the second channel data;
[0027] The acquisition module is also used to obtain the quantitative conversion relationship of the third channel data;
[0028] The determination module is further configured to determine a magnification factor according to the quantization coefficient, wherein the magnification factor is 2 to the Kth power, and K is the quantization coefficient;
[0029] The acquisition module is further used to obtain the first channel data conversion relationship according to the first channel data quantification conversion relationship and the magnification;
[0030] The acquisition module is further used to obtain the second channel data conversion relationship according to the second channel data quantification conversion relationship and the magnification;
[0031] The acquisition module is further used to quantify the conversion relationship and the magnification factor according to the third channel data, and acquire the third channel data conversion relationship.
[0032] In one possible design, in another implementation of another aspect of the embodiment of the present application,
[0033] The acquisition module is specifically configured to amplify the first channel data quantization conversion relationship by using a magnification factor to obtain the first channel data conversion relationship. The first channel data conversion relationship satisfies the following relationship:
[0034] R=74*(Y-16)+102*(V–128)>>6;
[0035] Among them, R represents red channel data, Y represents brightness data, and V represents concentration data;
[0036] The acquisition module is specifically used to amplify the second channel data quantization conversion relationship by using a magnification factor to obtain the second channel data conversion relationship. The second channel data conversion relationship satisfies the following relationship:
[0037] G=74*(Y-16)–25*(V-128)–25*(U-128)>>6;
[0038] Among them, G represents green channel data, Y represents brightness data, V represents concentration data, and U represents chromaticity data;
[0039] The acquisition module is specifically used to amplify the third channel data quantization conversion relationship by using a magnification factor to obtain the third channel data conversion relationship. The third channel data conversion relationship satisfies the following relationship:
[0040] B=74*(Y-16)+129*(U-128)>>6;
[0041] Among them, B represents blue channel data, Y represents brightness data, and U represents chrominance data.
[0042] In one possible design, in another implementation of another aspect of the embodiment of the present application,
[0043] The acquisition module is further configured to acquire a first channel data quantization conversion relationship before acquiring the first color coding data of the image to be converted;
[0044] The acquisition module is also used to obtain the quantitative conversion relationship of the second channel data;
[0045] The acquisition module is also used to obtain the quantitative conversion relationship of the third channel data;
[0046] The determination module is further configured to determine a magnification factor and a tail constant according to the quantization coefficient, wherein the magnification factor is 2 to the power of K, the tail constant is 2 to the power of (K-1), and K is the quantization coefficient;
[0047] The acquisition module is further used to acquire the first channel data conversion relationship according to the first channel data quantization conversion relationship, the magnification factor and the tail constant;
[0048] The acquisition module is further used to obtain the second channel data conversion relationship according to the second channel data quantization conversion relationship, the magnification factor and the tail constant;
[0049] The acquisition module is further used to acquire the third channel data conversion relationship according to the third channel data quantization conversion relationship, magnification and tail constant.
[0050] In one possible design, in another implementation of another aspect of the embodiment of the present application,
[0051] An acquisition module is specifically used to amplify the quantitative conversion relationship of the first channel data by using a magnification factor;
[0052] The quantization conversion relationship of the amplified first channel data is added to the tail constant to obtain the first channel data conversion relationship. The first channel data conversion relationship satisfies the following relationship:
[0053] R=(74*(Y-16)+102*(V–128)+32)>>6;
[0054] Among them, R represents red channel data, Y represents brightness data, and V represents concentration data;
[0055] An acquisition module is specifically used to amplify the quantization conversion relationship of the second channel data by using a magnification factor;
[0056] The quantization conversion relationship of the amplified second channel data is added to the tail constant to obtain the second channel data conversion relationship. The second channel data conversion relationship satisfies the following relationship:
[0057] G=(74*(Y-16)–25*(V-128)–25*(U-128)+32)>>6;
[0058] Among them, G represents green channel data, Y represents brightness data, V represents concentration data, and U represents chromaticity data;
[0059] An acquisition module is specifically used to amplify the quantization conversion relationship of the third channel data by using a magnification factor;
[0060] The quantization conversion relationship of the amplified third channel data is added to the tail constant to obtain the third channel data conversion relationship. The third channel data conversion relationship satisfies the following relationship:
[0061] B=(74*(Y-16)+129*(U-128)+32)>>6;
[0062] Among them, B represents blue channel data, Y represents brightness data, and U represents chrominance data.
[0063] In one possible design, in another implementation of another aspect of the embodiments of the present application, the image processing apparatus further includes a processing module;
[0064] An acquisition module is specifically used to acquire an image to be converted through an image acquisition device, wherein the image to be converted is an image in YUV format;
[0065] Acquire first color coding data according to the image to be converted;
[0066] a processing module configured to generate a converted target image based on the first target channel data, the second target channel data, and the third target channel data, and then perform beautification processing on the target image if an image processing instruction is received;
[0067] If an image storage instruction is received, the target image is stored;
[0068] If an image training instruction is received, the target image is used as a training sample to perform model training.
[0069] Another aspect of the present application provides an image processing device, comprising:
[0070] An acquisition module, configured to acquire second color-coded data of the image to be converted, wherein the second color-coded data includes first original channel data, second original channel data, and third original channel data;
[0071] a determination module, configured to determine, for the first original channel data, the second original channel data, and the third original channel data included in the second color-coded data, first target component data by adopting a first component data conversion relationship of the first color code, wherein the first component data conversion relationship is determined according to a first component data quantization conversion relationship and a quantization coefficient, and the quantization coefficient is 7;
[0072] The determining module is further configured to determine, for the first original channel data, the second original channel data, and the third original channel data included in the second color-coded data, the second target component data by adopting the second component data conversion relationship of the first color code, wherein the second component data conversion relationship is determined according to the second component data quantization conversion relationship and the quantization coefficient;
[0073] The determining module is further configured to determine, for the first original channel data, the second original channel data, and the third original channel data included in the second color-coded data, third target component data by adopting a third component data conversion relationship of the first color code, wherein the third component data conversion relationship is determined according to a third component data quantization conversion relationship and a quantization coefficient;
[0074] The conversion module is used to generate a converted target image according to the first target component data, the second target component data and the third target component data.
[0075] In one possible design, in another implementation of another aspect of the embodiment of the present application,
[0076] The acquisition module is further configured to acquire the quantitative conversion relationship of the first component data before acquiring the second color coding data of the image to be converted;
[0077] The acquisition module is further used to obtain the quantization conversion relationship of the second component data;
[0078] The acquisition module is further used to obtain the quantization conversion relationship of the third component data;
[0079] The determination module is further configured to determine a magnification factor according to the quantization coefficient, wherein the magnification factor is 2 to the Kth power, and K is the quantization coefficient;
[0080] The acquisition module is further configured to acquire the first component data conversion relationship according to the first component data quantification conversion relationship and the magnification factor;
[0081] The acquisition module is further used to acquire the second component data conversion relationship according to the second component data quantification conversion relationship and the magnification;
[0082] The acquisition module is further used to acquire the third component data conversion relationship according to the third component data quantification conversion relationship and the magnification factor.
[0083] In one possible design, in another implementation of another aspect of the embodiment of the present application,
[0084] The acquisition module is specifically configured to amplify the first component data quantization conversion relationship by using a magnification factor to obtain a first component data conversion relationship, wherein the first component data conversion relationship satisfies the following relationship:
[0085] Y=(32*R+65*G+13*B+2048)>>7;
[0086] Among them, Y represents brightness data, R represents red channel data, G represents green channel data, and B represents blue channel data;
[0087] The acquisition module is specifically configured to amplify the second component data quantization conversion relationship by using a magnification factor to obtain a second component data conversion relationship, wherein the second component data conversion relationship satisfies the following relationship:
[0088] U=(-19*R-37*G+56*B+16384)>>7;
[0089] Among them, U represents chromaticity data, R represents red channel data, G represents green channel data, and B represents blue channel data;
[0090] The acquisition module is specifically configured to amplify the third component data quantization conversion relationship by using a magnification factor to obtain a third component data conversion relationship, where the third component data conversion relationship satisfies the following relationship:
[0091] V=(56*R-47*G-9*B+16384)>>7;
[0092] Among them, V represents concentration data, R represents red channel data, G represents green channel data, and B represents blue channel data.
[0093] In one possible design, in another implementation of another aspect of the embodiment of the present application,
[0094] The acquisition module is further configured to acquire the quantitative conversion relationship of the first component data before acquiring the second color coding data of the image to be converted;
[0095] The acquisition module is further used to obtain the quantization conversion relationship of the second component data;
[0096] The acquisition module is further used to obtain the quantization conversion relationship of the third component data;
[0097] The determination module is further configured to determine a magnification factor and a tail constant according to the quantization coefficient, wherein the magnification factor is 2 to the power of K, the tail constant is 2 to the power of (K-1), and K is the quantization coefficient;
[0098] The acquisition module is further configured to acquire the first component data conversion relationship according to the first component data quantization conversion relationship, the magnification factor, and the tail constant;
[0099] The acquisition module is further used to acquire the second component data conversion relationship according to the second component data quantization conversion relationship, the magnification factor and the tail constant;
[0100] The acquisition module is further used to acquire the third component data conversion relationship according to the third component data quantization conversion relationship, the magnification factor and the tail constant.
[0101] In one possible design, in another implementation of another aspect of the embodiment of the present application,
[0102] An acquisition module, specifically configured to amplify the first component data quantization conversion relationship by using a magnification factor;
[0103] The quantization conversion relationship of the amplified first component data is added to the tail constant to obtain the first component data conversion relationship. The first component data conversion relationship satisfies the following relationship:
[0104] Y=(32*R+65*G+13*B+2112)>>7;
[0105] Among them, Y represents brightness data, R represents red channel data, G represents green channel data, and B represents blue channel data;
[0106] An acquisition module, specifically configured to amplify the quantized conversion relationship of the second component data by using a magnification factor;
[0107] The quantization conversion relationship of the amplified second component data is added to the tail constant to obtain the second component data conversion relationship. The second component data conversion relationship satisfies the following relationship:
[0108] U=(-19*R-37*G+56*B+16448)>>7;
[0109] Among them, Y represents brightness data, R represents red channel data, G represents green channel data, and B represents blue channel data;
[0110] An acquisition module, specifically configured to amplify the quantized conversion relationship of the third component data by using a magnification factor;
[0111] The quantization conversion relationship of the amplified third component data is added to the tail constant to obtain the third component data conversion relationship. The third component data conversion relationship satisfies the following relationship:
[0112] V=(56*R-47*G-9*B+16448)>>7;
[0113] Among them, Y represents brightness data, R represents red channel data, G represents green channel data, and B represents blue channel data.
[0114] Another aspect of the present application provides a computer device, comprising: a memory, a processor, and a bus system;
[0115] Wherein, the memory is used to store programs;
[0116] The processor is used to execute the program in the memory, and the processor is used to perform the above-mentioned methods according to the instructions in the program code;
[0117] The bus system is used to connect the memory and the processor so that the memory and the processor can communicate with each other.
[0118] Another aspect of the present application provides a computer-readable storage medium, wherein instructions are stored in the computer-readable storage medium. When the computer-readable storage medium is run on a computer, the computer is enabled to execute the above-mentioned methods.
[0119] Another aspect of the present application provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the above aspects.
[0120] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0121] In an embodiment of the present application, a method for image processing is provided, which first obtains the first color coding data of the image to be converted, and then determines the first target channel data by adopting the first channel data conversion relationship of the second color coding for the first original component data and the third original component data included in the first color coding data, and determines the second target channel data by adopting the second channel data conversion relationship of the second color coding for the first original component data, the second original component data and the third original component data included in the first color coding data, and determines the third target channel data by adopting the third channel data conversion relationship of the second color coding for the first original component data and the second original component data included in the first color coding data, and finally, generates the converted target image by combining the first target channel data, the second target channel data and the third target channel data. In the above manner, when converting the YUV format image based on the BT.601 standard, the quantization coefficient is set to 6, and the target image in RGB format can be obtained, and each color channel in the target image uses 8-bit data operation, which saves the amount of data operation compared to the existing 16-bit data or 32-bit data, thereby improving the efficiency of image format conversion. BRIEF DESCRIPTION OF THE DRAWINGS
[0122] Figure 1 A schematic diagram of a framework of the image processing method in an embodiment of the present application;
[0123] Figure 2 This is a schematic diagram of the architecture of the image processing system in an embodiment of the present application;
[0124] Figure 3 This is a schematic diagram of an embodiment of the image processing method in the embodiment of the present application;
[0125] Figure 4 A schematic diagram of overall data quantification in the embodiments of this application;
[0126] Figure 5 A schematic diagram of a process for implementing image processing based on data quantization in an embodiment of the present application;
[0127] Figure 6 This is a schematic diagram of another embodiment of the image processing method in the embodiment of the present application;
[0128] Figure 7 This is another flowchart of image processing based on data quantization in an embodiment of the present application;
[0129] Figure 8 This is a schematic diagram comparing the effects before and after quantization of data in an embodiment of the present application;
[0130] Figure 9FIG. 1 is a schematic diagram of an image processing device according to an embodiment of the present application;
[0131] Figure 10 FIG. 1 is a schematic diagram of an image processing device according to an embodiment of the present application;
[0132] Figure 11 FIG. 1 is a schematic diagram of an image processing device according to an embodiment of the present application;
[0133] Figure 12 FIG. 1 is a schematic diagram of an image processing device according to an embodiment of the present application. DETAILED DESCRIPTION
[0134] The embodiment of the present application provides a kind of image processing method, related device, equipment and storage medium, when based on BT.601 standard to YUV format image conversion, quantization coefficient is set as 6, can obtain the target image of RGB format, and each color channel in the target image uses 8 bit data operation, thereby saving the operation amount of data, to improve image format conversion efficiency.
[0135] The terms "first", "second", "third", "fourth" and the like in the description, claims and drawings of the present application (if any) are used to distinguish similar objects, and do not necessarily have to be described in a particular order or sequence. It should be understood that the data used in this way can be exchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented, for example, in an order other than those illustrated or described herein. In addition, the terms "include" and "correspond to" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0136] With the development of communication network technology, people's demand for images is increasing. Converting image color spaces has become an important means of image and video encoding and decoding. A common image color space is the red-green-blue (RGB) format. The RGB format is an industry color standard that produces a variety of colors by varying and superimposing the three color channels of red, green, and blue. This standard covers almost all colors that can be perceived by human vision and is one of the most widely used color systems. Another common image color space is the luminance-chrominance (YUV) format. The YUV color space is a color encoding method adopted by the European television system. Color television uses the luminance signal Y to solve the compatibility problem between color TVs and black-and-white TVs, allowing black-and-white TVs to receive color TV signals. It is understood that YUV is also known as YCbCr. YCbCr was developed as part of the ITU-R BT.601 standard during the development of the World Digital Organization's video standard. "Y" represents luminance, while Cb and Cr both refer to color. In this application, YUV will be used for description.
[0137] In computer vision algorithm processing, there are frequent conversions between different color spaces, whether in the acquisition end and the algorithm end, or between the various modules within the algorithm end. For easier understanding, please refer to Figure 1 , Figure 1 This is a framework diagram of the image processing method in the embodiment of the present application. As shown in the figure, it is assumed that the acquisition end collects data in YUV format, and the algorithm processing requires data in RGB format. At this time, the data in YUV format needs to be converted into data in RGB format. One type of algorithm processing is an algorithm processing in the direction of computational vision, which is suitable for the engineering implementation of a feedforward neural network inference engine that is not very sensitive to color differences. For example, data in YUV format is more sensitive to the outline of a person, but not very sensitive to color differences. However, in some machine learning algorithms, color information may also need to be learned. Therefore, it is necessary to convert the data in YUV format into data in RGB format. After algorithm processing, the data obtained is still in RGB format. If transmission or other processing is required, the data in RGB format can also be converted into data in YUV format.
[0138] It is understandable that Figure 1 The input and output shown can be the input and output of the entire algorithm module, or the input and output of a certain algorithm function. If it is the input and output of the entire algorithm module, then Figure 1 The algorithmic processing in represents the algorithmic processing of the entire algorithm. If it is the input and output of a certain algorithmic function, then Figure 1 The algorithmic processing in represents the algorithmic processing of the function.
[0139] It can be seen that the mutual conversion between RGB format data and YUV format data is indispensable. The key to format conversion is not only to ensure the fidelity of the converted color data as much as possible, but also to require the conversion efficiency to be as high as possible. This is especially critical when the product engineering is implemented, especially when the original image resolution is large, format conversion is likely to become a performance bottleneck of the product. Based on this, the present application provides an image processing method that can improve the efficiency of mutual conversion between RGB format data and YUV format data. It can be understood that the RGB format data in the present application can specifically refer to images in RGB format, and the YUV format data can specifically refer to images in YUV format.
[0140] The present application can also use cloud computing to achieve parallel processing of format conversion, thereby further improving the efficiency of format conversion. Cloud computing refers to the delivery and use model of Internet Technology (IT) infrastructure, which means obtaining required resources through the network in an on-demand and easily scalable manner; in a broad sense, cloud computing refers to the delivery and use model of services, which means obtaining required services through the network in an on-demand and easily scalable manner. Such services can be IT and software, Internet-related, or other services. Cloud computing is the product of the integration of the development of traditional computer and network technologies such as grid computing, distributed computing, parallel computing, utility computing, network storage technologies, virtualization, and load balancing.
[0141] Driven by the growth of the internet, real-time data streams, and the diversification of connected devices, as well as the demand for search services, social networks, mobile commerce, and open collaboration, cloud computing has rapidly developed. Unlike previous parallel and distributed computing, the emergence of cloud computing will fundamentally revolutionize the entire internet model and enterprise management model.
[0142] Cloud computing is a type of cloud technology. Cloud technology refers to a managed technology that unifies hardware, software, and network resources within a wide or local area network (WAN) to enable data computing, storage, processing, and sharing. Cloud technology is a general term for network, information technology, integration technology, management platform technology, and application technology, all based on the cloud computing business model. It can form a resource pool for on-demand, flexible and convenient use. Cloud computing technology will become a crucial support. Backend services for technical network systems, such as video websites, image websites, and more portals, require significant computing and storage resources. With the rapid development and application of the internet industry, every item will likely have its own unique identifier, requiring transmission to backend systems for logical processing. Data of varying levels will be processed separately, and data from various industries will require robust system support, which can only be achieved through cloud computing.
[0143] The image processing method provided in this application can be applied to images such as Figure 2 The image processing system shown is shown in Figure 2 , Figure 2 This is an architectural diagram of an image processing system in an embodiment of the present application. As shown in the figure, the image processing system may include a server and a terminal device. The server involved in this application may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. The terminal device may be a smart phone, tablet computer, laptop computer, PDA, personal computer, smart TV, smart watch, etc., but is not limited to this. The terminal device and the server may be directly or indirectly connected via wired or wireless communication, and this application does not limit this. The number of servers and terminal devices is also not limited.
[0144] Exemplarily, a YUV format image is collected by a terminal device, and the YUV format image is converted locally on the terminal device to obtain an RGB format image.
[0145] Exemplarily, an RGB format image is collected by a terminal device, and the RGB format image is converted locally on the terminal device to obtain a YUV format image.
[0146] Exemplarily, a YUV format image is captured by a terminal device, and then the terminal device sends the YUV format image to a server, and the server converts the YUV format image to obtain an RGB format image.
[0147] Exemplarily, the terminal device captures an RGB format image, and then sends the RGB format image to the server, which converts the RGB format image to obtain a YUV format image.
[0148] In combination with the above introduction, the following will introduce the solution for converting YUV format images into RGB format images, and introduce the image processing method in this application. Figure 3 , an embodiment of the image processing method in the embodiment of the present application includes:
[0149] 101. Acquire first color-coded data of an image to be converted, wherein the first color-coded data includes first original component data, second original component data, and third original component data;
[0150] In this embodiment, an image processing apparatus obtains an image to be converted, which is in YUV format. Therefore, based on the image to be converted, first color-coded data corresponding to the image can be obtained. The first color-coded data includes first original component data, second original component data, and third original component data. Because the image to be converted includes multiple pixels, each pixel having a set of first color-coded data, in this application, the first color-coded data may refer to the first color-coded data of a pixel in the image to be converted, or may include the first color-coded data of each pixel in the image to be converted.
[0151] It should be noted that this application uses the example of the first color encoding being in YUV format and the second color encoding being in RGB format for description, but this should not be construed as limiting this application. Based on this, the first raw component data may be raw Y component data, the second raw component data may be raw U component data, and the third raw component data may be raw V component data.
[0152] It should be noted that the image processing device can be deployed on a server, on a terminal device, or on an image processing system composed of a server and a terminal device, and this application does not limit this.
[0153] It should be noted that the images to be converted involved in this application include but are not limited to bitmap (Bitmap, BMP) images, Graphics Interchange Format (Graphics Interchange Format, GIF) images, Joint Photographic Expert Group (JointPhotographic Expert Group, JPEG) images and Portable Network Graphics (Portable Network Graphics, PNG) images, etc., and are not limited here.
[0154] 102. Determine first target channel data by using a first channel data conversion relationship of the second color code for the first original component data and the third original component data included in the first color code data, wherein the first channel data conversion relationship is determined according to a first channel data quantization conversion relationship and a quantization coefficient, and the quantization coefficient is 6;
[0155] In this embodiment, the image processing device converts the first color-coded data for each pixel in the image to be converted using the corresponding channel data conversion relationship. Since the image needs to be converted into RGB format, the converted R channel data (i.e., the first target channel data) can be calculated based on the first color-coded data for each pixel.
[0156] Specifically, taking any pixel point as an example, the image processing device substitutes the first original component data and the third original component data in the first color coding data corresponding to the pixel point into the first channel data conversion relationship based on the first channel data conversion relationship, thereby obtaining the converted R channel data (i.e., the first target channel data). Among them, the first channel data conversion relationship is determined according to the first channel data quantization conversion relationship and the quantization coefficient. The first channel data quantization conversion relationship is determined based on the ITU-R BT.601 standard and will be introduced in detail in subsequent embodiments. The quantization coefficient can realize the quantization of the corresponding operation data. In this application, in the process of converting the YUV format image to the RGB format image, the quantization coefficient used is 6.
[0157] 103. Determine second target channel data by using a second channel data conversion relationship of the second color code for the first original component data, the second original component data, and the third original component data included in the first color code data, wherein the second channel data conversion relationship is determined based on a second channel data quantization conversion relationship and a quantization coefficient.
[0158] In this embodiment, similar to step 102, the image processing device converts the first color-coded data for each pixel in the image to be converted using the corresponding channel data conversion relationship. Since the image needs to be converted into RGB format, the converted G channel data (i.e., the second target channel data) can be calculated based on the first color-coded data for each pixel.
[0159] Specifically, taking any pixel as an example, the image processing device substitutes the first original component data, the second original component data, and the third original component data in the first color-coded data corresponding to the pixel into the second channel data conversion relationship based on the second channel data conversion relationship, thereby obtaining the converted G channel data (i.e., the second target channel data). Among them, the second channel data conversion relationship is determined according to the second channel data quantization conversion relationship and the quantization coefficient. The second channel data quantization conversion relationship is determined based on the ITU-R BT.601 standard and will be introduced in detail in subsequent embodiments. The quantization coefficient can realize the quantization of the corresponding operation data. In this application, in the process of converting the YUV format image to the RGB format image, the quantization coefficient used is 6.
[0160] 104. Determine third target channel data by using a third channel data conversion relationship of the second color coding for the first original component data and the second original component data included in the first color coding data, wherein the third channel data conversion relationship is determined based on a third channel data quantization conversion relationship and a quantization coefficient.
[0161] In this embodiment, similar to steps 102 and 103, the image processing device converts the first color-coded data for each pixel in the image to be converted using the corresponding channel data conversion relationship. Since the image needs to be converted into RGB format, the converted B channel data (i.e., the third target channel data) can be calculated based on the first color-coded data for each pixel.
[0162] Specifically, taking any pixel as an example, the image processing device substitutes the first original component data, the second original component data and the third original component data in the first color coding data corresponding to the pixel into the third channel data conversion relationship based on the third channel data conversion relationship, thereby obtaining the converted B channel data (i.e., the third target channel data). Among them, the third channel data conversion relationship is determined according to the third channel data quantization conversion relationship and the quantization coefficient. The third channel data quantization conversion relationship is determined based on the ITU-R BT.601 standard and will be introduced in detail in subsequent embodiments. The quantization coefficient can realize the quantization of the corresponding operation data. In this application, in the process of converting the YUV format image to the RGB format image, the quantization coefficient used is 6.
[0163] It should be noted that there is no limitation on the execution order of steps 102 to 104 .
[0164] 105. Generate a converted target image according to the first target channel data, the second target channel data, and the third target channel data.
[0165] In this embodiment, the image processing apparatus can obtain a converted RGB image based on the first target channel data, the second target channel data, and the third target channel data corresponding to each pixel point. The RGB image is the target image.
[0166] It should be noted that, in this application, the first color encoding is in YUV format and the second color encoding is in RGB format as an example, the first target channel data is the target R channel data, the second target channel data is the target G channel data, and the third target channel data is the target B channel data.
[0167] In an embodiment of the present application, a method for image processing is provided. By using the above method, when converting a YUV format image based on the BT.601 standard, the quantization coefficient is set to 6, and a target image in RGB format can be obtained. Each color channel in the target image is operated using 8-bit data, which saves data calculations compared to existing 16-bit data or 32-bit data, thereby improving the efficiency of image format conversion.
[0168] Optionally, in the above Figure 3 On the basis of the corresponding embodiments, in another optional embodiment provided by the embodiment of the present application, before obtaining the first color coding data of the image to be converted, the following may be further included:
[0169] Obtaining a quantitative conversion relationship of the first channel data;
[0170] Obtaining a quantitative conversion relationship of the second channel data;
[0171] Obtaining the quantitative conversion relationship of the third channel data;
[0172] Determine the magnification factor according to the quantization coefficient, wherein the magnification factor is 2 to the Kth power, and K is the quantization coefficient;
[0173] Acquire a first channel data conversion relationship according to the first channel data quantification conversion relationship and the magnification;
[0174] According to the second channel data quantification conversion relationship and the magnification factor, a second channel data conversion relationship is obtained;
[0175] The third channel data conversion relationship is obtained according to the third channel data quantification conversion relationship and the magnification.
[0176] This embodiment introduces a method for constructing a data conversion relationship between the three RGB channels. Before constructing the data conversion relationship for each channel, data quantization is required. Data quantization includes two parts: overall data quantization and computational data quantization. The overall data quantization method is described below.
[0177] Specifically, for ease of explanation, seeFigure 4 , Figure 4 This is a schematic diagram of the overall data quantization in an embodiment of the present application. As shown in the figure, in the first color-coded data, the value range of the Y component data, the U component data, and the V component data is usually [0, 255]. In the second color-coded data, the value range of the R channel data, the G channel data, and the B channel data is also usually [0, 255]. Among them, 0 and 255 are respectively located at the two ends of the data, 0 represents black, 255 represents white, and the values between 0 and 255 represent the transition color from black to white. Different colors can be represented by different numerical combinations. Combined with the biological characteristics of the human eye, the human eye is much less sensitive to black and white than to intermediate colors. On the other hand, since data quantization will bring about a loss of conversion accuracy, considering these two factors together, the data can be quantized, sacrificing the pixel value representation range around 0 and 255, and representing the intermediate colors as accurately as possible.
[0178] Based on the ITU-R BT.601 standard, the quantized R channel data value range is set to [16, 235], the quantized G channel data value range is set to [16, 235], and the quantized B channel data value range is set to [16, 235]. The quantized Y component data value range is set to [16, 235], the quantized U component data value range is set to [16, 240], and the quantized V component data value range is set to [16, 240]. The quantization formula is as follows:
[0179] R'=R*219 / 256+16=0.8555*R+16; (Formula 1)
[0180] G'=G*219 / 256+16=0.8555*G+16; (Formula 2)
[0181] B'=B*219 / 256+16=0.8555*B+16; (Formula 3)
[0182] Wherein, R' represents the quantized R channel data, R represents the unquantized R channel data, G' represents the quantized G channel data, G represents the unquantized G channel data, B' represents the quantized B channel data, and B represents the unquantized B channel data.
[0183] Based on the ITU-R BT.601 standard, a simplified formula for converting the first color-coded data into the second color-coded data can be obtained, that is, the unquantized conversion formula is:
[0184] R'=Y+1.4075*(V-128); (Formula 4)
[0185] G'=Y-0.3455*(U-128)-0.7169*(V-128); (Equation 5)
[0186] B'=Y+1.779*(U-128); (Formula 6)
[0187] By combining Formula 1 to Formula 6, the first channel data quantization conversion relationship, the second channel data quantization conversion relationship, and the third channel data quantization conversion relationship can be obtained.
[0188] It should be noted that, in addition, it is also necessary to obtain a quantization coefficient, determine the amplification factor based on the quantization coefficient, and combine the amplification factor and the data quantization conversion relationship of each channel to obtain the data conversion relationship of each channel.
[0189] Based on this, see Figure 5 , Figure 5 This is a flow chart of image processing based on data quantization in an embodiment of the present application. As shown in the figure, linear transformation can be used to make the R channel data, G channel data and B channel data within a certain range through quantization. Quantization usually needs to be performed before the data enters the conversion formula to play a role in preserving accuracy, that is, Figure 5 The process shown.
[0190] Secondly, in an embodiment of the present application, a method for constructing a data conversion relationship between the three RGB channels is provided. Through the above method, based on the color conversion standard commonly used in computer vision, namely ITU-R BT.601, after the data is quantized, it is possible to combine the chip architecture characteristics of different platforms to achieve rapid color conversion, thereby improving conversion efficiency while minimizing the color loss caused by format conversion.
[0191] Optionally, in the above Figure 3 On the basis of the corresponding embodiments, in another optional embodiment provided by the embodiment of the present application, the first channel data quantization conversion relationship satisfies the following relationship:
[0192] R=1.164*(Y-16)+1.596*(V–128);
[0193] Among them, R represents red channel data, Y represents brightness data, and V represents concentration data;
[0194] The second channel data quantization conversion relationship satisfies the following relationship:
[0195] G=1.164*(Y-16)-0.813*(V-128)-0.391(U-128);
[0196] Among them, G represents green channel data, Y represents brightness data, V represents concentration data, and U represents chromaticity data;
[0197] The third channel data quantization conversion relationship satisfies the following relationship:
[0198] B=1.164*(Y-16)+2.018*(U-128);
[0199] Among them, B represents blue channel data, Y represents brightness data, and U represents chrominance data;
[0200] Acquiring the first channel data conversion relationship according to the first channel data quantification conversion relationship and the magnification factor may specifically include:
[0201] The first channel data quantization conversion relationship is amplified by using an amplification factor to obtain a first channel data conversion relationship. The first channel data conversion relationship satisfies the following relationship:
[0202] R=74*(Y-16)+102*(V–128)>>6;
[0203] Among them, R represents red channel data, Y represents brightness data, and V represents concentration data;
[0204] Acquiring the second channel data conversion relationship according to the second channel data quantification conversion relationship and the magnification factor may specifically include:
[0205] The second channel data quantization conversion relationship is amplified by using the magnification factor to obtain the second channel data conversion relationship. The second channel data conversion relationship satisfies the following relationship:
[0206] G=74*(Y-16)–25*(V-128)–25*(U-128)>>6;
[0207] Among them, G represents green channel data, Y represents brightness data, V represents concentration data, and U represents chromaticity data;
[0208] Acquiring the third channel data conversion relationship according to the third channel data quantification conversion relationship and the magnification factor may specifically include:
[0209] The third channel data quantization conversion relationship is amplified by using the magnification factor to obtain the third channel data conversion relationship. The third channel data conversion relationship satisfies the following relationship:
[0210] B=74*(Y-16)+129*(U-128)>>6;
[0211] Among them, B represents blue channel data, Y represents brightness data, and U represents chrominance data.
[0212] This embodiment introduces a method for determining the data conversion relationship between the three RGB channels. As can be seen from the above embodiment, based on the ITU-R BT.601 standard, an unquantized conversion formula for converting the first color-coded data into the second color-coded data can be obtained. Combining Formulas 1 to 6, the data quantization conversion relationship of each channel can be obtained respectively. The data quantization conversion relationship of the first channel is expressed as:
[0213] R = 1.164*(Y-16)+1.596*(V–128); (Formula 7)
[0214] The second channel data quantization conversion relationship is expressed as:
[0215] G=1.164*(Y-16)-0.813*(V-128)-0.391(U-128); (Formula 8)
[0216] The third channel data quantization conversion relationship is expressed as:
[0217] B=1.164*(Y-16)+2.018*(U-128); (Formula 9)
[0218] Among them, R represents R channel data, G represents G channel data, B represents B channel data, Y represents Y component data, U represents U component data, and V represents V component data.
[0219] Summarizing Formula 7 to Formula 9, we can obtain the data conversion relationship shown in Table 1.
[0220] Table 1
[0221] Y-16 U-128 V-128 R 1.164 0 1.596 G 1.164 -0.391 -0.813 B 1.164 2.018 0
[0222] It can be seen that the value subtracted from the Y component data is smaller, while the values subtracted from the U component data and the V component data are larger. This is because the first color-coded data itself needs to be converted from an analog signal to a digital signal, the voltage has positive and negative signs, and the value range of the U component data and the V component data also corresponds to [-128, 127].
[0223] Further quantization can be performed based on Formulas 7 to 9. Since the value range of the first color-coded data and the second color-coded data is [0, 255], unsigned 8-bit data can be used for storage in a computer. The product of two 8-bit values will be expanded to a 16-bit value. Therefore, the parameters in Table 1 can also be quantized to signed 16-bit values. It should be noted that their effective value is still 8 bits. To avoid overflow when using a signed 16-bit value after multiplying two 8-bit data, the maximum possible value of the product needs to be considered when quantizing the parameters shown in Table 1.
[0224] Specifically, for the quantization conversion relationship of the third channel data, when Y=255 and U=255, the maximum value is generated. So we start to try different quantization coefficients. Assume that the quantization coefficient is set to 7, that is, the parameter *(1<<7) in Table 1, where << represents a left shift operation. Thus, we get the following results:
[0225] 1.164*(1<<7)≈148;
[0226] 2.018*(1<<7)≈258;
[0227] Therefore, B = 148*(255-16) + 258*(255-128) = 68138 > max(int16) = 32767, which will cause overflow. Assume that the quantization coefficient is set to 6, that is, the parameter * (1<<6) in Table 1, thus, the following results are obtained:
[0228] 1.164*(1<<6)≈74;
[0229] 2.018*(1<<6)≈129;
[0230] Therefore, B = 74*(255-16) + 129*(255-128) = 34069 > max(int16) = 32767, which will cause overflow. Assume that the quantization coefficient is set to 5, that is, the parameter in Table 1 × (1<<5), thus, the following results are obtained:
[0231] 1.164*(1<<5)≈37;
[0232] 2.018*(1<<5)≈65;
[0233] Therefore, B = 37*(255-16)+65*(255-128)=17034 <max(int16)=32767,最大值17034远小于32767,因此,会导致很大一部分的运算无法满足最大运算要求的同时浪费了部分精度,当量化系数为6时,只有极少数的像素值会导致乘积大于32767,因此,最后将量化系数定为6。
[0234] It should be noted that the above examples are based on positive values for comparison. In practical applications, overflow issues also need to be considered for negative values. For example, for the quantization conversion relationship of the second channel data, when Y = 0, U = 0, and V = 0, the minimum negative value that produces a quantization coefficient of 6 is -11055, and -11055 > min(int16) = -32768. Therefore, the quantization coefficient of 6 meets the quantization requirements.
[0235] In summary, when the quantization coefficient is determined to be 6 (i.e., K=6), the magnification factor is determined according to the quantization coefficient, and the magnification factor is 2 to the power of 6 (equal to 64). Therefore, the magnification factor is used to amplify the quantization conversion relationship of the first channel data to obtain the first channel data conversion relationship, which is expressed as:
[0236] R = 74*(Y-16)+102*(V–128)>>6; (Formula 10)
[0237] The second channel data quantization conversion relationship is amplified by using the magnification factor to obtain the second channel data conversion relationship. The second channel data conversion relationship is expressed as:
[0238] G=74*(Y-16)–25*(V-128)–25*(U-128)>>6; (Formula 11)
[0239] The third channel data quantization conversion relationship is amplified by using the magnification factor to obtain the third channel data conversion relationship. The third channel data conversion relationship is expressed as:
[0240] B=74*(Y-16)+129*(U-128)>>6; (Formula 12)
[0241] Summarizing Formula 10 to Formula 12, we can obtain the data conversion relationship shown in Table 2.
[0242] Table 2
[0243] Y-16 U-128 V-128 Quantization Coefficients R 74 0 102 6 G 74 -25 -52 6 B 74 129 0 6
[0244] The parameters shown in Table 2 can be used to convert YUV format images into RGB format images.
[0245] Again, in an embodiment of the present application, a method for determining the data conversion relationship of the three RGB channels is provided. Through the above method, the specific content of the data conversion relationship of each channel is described, thereby providing a basis for the implementation of the solution, thereby improving the feasibility and operability of the solution.
[0246] Optionally, in the above Figure 3 On the basis of the corresponding embodiments, in another optional embodiment provided by the embodiment of the present application, before obtaining the first color coding data of the image to be converted, the following may be further included:
[0247] Obtaining a quantitative conversion relationship of the first channel data;
[0248] Obtaining a quantitative conversion relationship of the second channel data;
[0249] Obtaining the quantitative conversion relationship of the third channel data;
[0250] Determine the magnification factor and the tail constant according to the quantization coefficient, wherein the magnification factor is 2 to the power of K, the tail constant is 2 to the power of (K-1), and K is the quantization coefficient;
[0251] Obtaining a first channel data conversion relationship according to the first channel data quantization conversion relationship, the magnification factor, and the tail constant;
[0252] Obtaining a second channel data conversion relationship according to the second channel data quantization conversion relationship, the magnification factor, and the tail constant;
[0253] The third channel data conversion relationship is obtained according to the third channel data quantization conversion relationship, the magnification factor and the tail constant.
[0254] This embodiment introduces another method for constructing data conversion relationships for the three RGB channels. Before constructing the data conversion relationships for each channel, data quantization is required. Data quantization includes two parts: overall data quantization and computational data quantization. As will be appreciated, since the overall data quantization method has been described in the previous embodiment, it will not be repeated here.
[0255] Based on the ITU-R BT.601 standard, the quantized R channel data value range is set to [16, 235], the quantized G channel data value range is set to [16, 235], and the quantized B channel data value range is set to [16, 235]. The quantized Y component data value range is set to [16, 235], the quantized U component data value range is set to [16, 240], and the quantized V component data value range is set to [16, 240]. The quantization formulas are shown in Formulas 1 to 3, while the simplified formulas for the second color-coded data are shown in Formulas 4 to 6. Combining Formulas 1 to 6, we can obtain the quantization conversion relationships for the first channel data, the second channel data, and the third channel data.
[0256] It should be noted that, in addition, it is necessary to obtain the quantization coefficient and the tail constant, determine the magnification factor and the tail constant according to the quantization coefficient, amplify the data quantization conversion relationship of each channel in combination with the magnification factor, increase the number of bits in combination with the tail constant, and thus obtain the data conversion relationship of each channel. It can be understood that the tail constant can play a role in rounding to reduce the quantization error. This is because shift processing, that is, division, is required in the subsequent processing process. Therefore, by adding a value of half the size of the denominator in advance, the result can be rounded down after calculation to achieve the rounding effect.
[0257] Secondly, in the embodiment of the application, another way of constructing the conversion relationship of the RGB three-channel data is provided. Through the above way, a tail constant can be added, which plays a role of rounding off when truncating the last data, thereby reducing quantization error. In addition, based on the color conversion standard commonly used in computer vision, i.e., ITU-R BT.601, after quantizing the data, the chip architecture characteristics of different platforms can be combined to realize fast conversion of color, thereby improving the conversion efficiency while reducing the color loss caused by format conversion as much as possible.
[0258] Optionally, in the above Figure 3 Based on the respective embodiments, in another optional embodiment provided by the embodiment of the application, the first-channel data quantization conversion relationship satisfies the following relationship:
[0259] R=1.164*(Y-16)+1.596*(V–128);
[0260] Wherein, R represents red channel data, Y represents luminance data, and V represents concentration data.
[0261] The second-channel data quantization conversion relationship satisfies the following relationship:
[0262] G=1.164*(Y-16)-0.813*(V-128)-0.391(U-128);
[0263] Wherein, G represents green channel data, Y represents luminance data, V represents concentration data, and U represents chroma data.
[0264] The third-channel data quantization conversion relationship satisfies the following relationship:
[0265] B=1.164*(Y-16)+2.018*(U-128);
[0266] Wherein, B represents blue channel data, Y represents luminance data, and U represents chroma data.
[0267] According to the first-channel data quantization conversion relationship, the magnification, and the tail constant, the first-channel data conversion relationship is obtained, which can specifically include:
[0268] The magnification is used to amplify the first-channel data quantization conversion relationship;
[0269] The first-channel data quantization conversion relationship after the amplification processing is added to the tail constant to obtain the first-channel data conversion relationship, which satisfies the following relationship:
[0270] R=(74*(Y-16)+102*(V–128)+32)>>6;
[0271] Among them, R represents red channel data, Y represents brightness data, and V represents concentration data;
[0272] Obtaining the second channel data conversion relationship according to the second channel data quantization conversion relationship, the magnification factor, and the tail constant may specifically include:
[0273] Adopting the magnification factor, the quantitative conversion relationship of the second channel data is amplified;
[0274] The quantization conversion relationship of the amplified second channel data is added to the tail constant to obtain the second channel data conversion relationship. The second channel data conversion relationship satisfies the following relationship:
[0275] G=(74*(Y-16)–25*(V-128)–25*(U-128)+32)>>6;
[0276] Among them, G represents green channel data, Y represents brightness data, V represents concentration data, and U represents chromaticity data;
[0277] Obtaining the third channel data conversion relationship according to the third channel data quantization conversion relationship, the magnification factor, and the tail constant may specifically include:
[0278] Adopting the magnification factor, the third channel data quantitative conversion relationship is amplified;
[0279] The quantization conversion relationship of the amplified third channel data is added to the tail constant to obtain the third channel data conversion relationship. The third channel data conversion relationship satisfies the following relationship:
[0280] B=(74*(Y-16)+129*(U-128)+32)>>6;
[0281] Among them, B represents blue channel data, Y represents brightness data, and U represents chrominance data.
[0282] In this embodiment, another way of determining the conversion relationship of the RGB three channel data is introduced. As known from the foregoing embodiment, based on the ITU-R BT.601 standard, the unquantized conversion formula of the first color encoding data converted into the second color encoding data can be obtained, and in combination with the formula 1 to formula 6, the data quantization conversion relationship of each channel can be obtained respectively, wherein the first channel data quantization conversion relationship, the second channel data quantization conversion relationship and the third channel data quantization conversion relationship can be referred to the formula 7 to formula 9 respectively, and the data conversion relationship involved is shown in Table 1, which is not described herein. Based on the formula 7 to formula 9, further quantization can be carried out, that is, the quantization coefficient can be determined as 6 by using the way described in the foregoing embodiment, and the process of demonstrating that the quantization coefficient is 6 is not described herein.
[0283] In summary, in the case of determining that the quantization coefficient is 6 (i.e. K = 6), the amplification multiple is determined according to the quantization coefficient, and the amplification multiple is equal to 6 times of 2 (equal to 64). In addition, the tail constant is determined according to the quantization coefficient, and the tail constant is equal to (6-1) times of 2 (equal to 32). Then the first channel data quantization conversion relationship is amplified by using the amplification multiple, and then the first channel data quantization conversion relationship after the amplification processing is added with the tail constant to obtain the first channel data conversion relationship, which is expressed as:
[0284] R = (74 * (Y-16) + 102 * (V-128) + 32) >> 6; (formula 13)
[0285] The second channel data quantization conversion relationship is amplified by using the amplification multiple, and then the second channel data quantization conversion relationship after the amplification processing is added with the tail constant to obtain the second channel data conversion relationship, which is expressed as:
[0286] G = (74 * (Y-16) - 25 * (V-128) - 25 * (U-128) + 32) >> 6; (formula 14)
[0287] The third channel data quantization conversion relationship is amplified by using the amplification multiple, and then the third channel data quantization conversion relationship after the amplification processing is added with the tail constant to obtain the third channel data conversion relationship, which is expressed as:
[0288] B = (74 * (Y-16) + 129 * (U-128) + 32) >> 6; (formula 15)
[0289] The data conversion relationship shown in Table 3 can be obtained by summarizing the formula 13 to formula 15.
[0290] Table 3
[0291] Y-16 U-128 V-128 Quantization Coefficients Tail Constant R 74 0 102 6 32 G 74 -25 -52 6 32 B 74 129 0 6 32
[0292] This application can use the parameters shown in Table 3 to convert YUV format images into RGB format images.
[0293] Again, in the embodiment of the present application, another method for determining the data conversion relationship of the three RGB channels is provided. Through the above method, the specific content of the data conversion relationship of each channel is described, thereby providing an implementation basis for the implementation of the solution, thereby improving the feasibility and operability of the solution.
[0294] Optionally, in the above Figure 3 On the basis of the corresponding embodiments, in another optional embodiment provided by the embodiments of the present application, obtaining the first color coding data of the image to be converted may specifically include:
[0295] Acquire an image to be converted through an image acquisition device, wherein the image to be converted is an image in YUV format;
[0296] Acquire first color coding data according to the image to be converted;
[0297] After generating a converted target image according to the first target channel data, the second target channel data, and the third target channel data, the method further includes:
[0298] If an image processing instruction is received, the target image is beautified;
[0299] If an image storage instruction is received, the target image is stored;
[0300] If an image training instruction is received, the target image is used as a training sample to perform model training.
[0301] This embodiment introduces a method based on image format conversion combined with product implementation. After converting the YUV format image to the RGB format image (ie, the target image), the user can also choose to perform related operations on the target image.
[0302] Specifically, for example, a user can input a target image into image processing software and trigger the "one-click beautification" function, thereby triggering an image processing instruction, based on which the target image is beautified. Another example is that a user can store a target image in the local photo album of a terminal device and trigger the "save" function, thereby triggering an image storage instruction, based on which the target image is stored in the local photo album of the terminal device. Another example is that a user can input a target image as a training sample into a model to be trained, thereby triggering an image training instruction, and then executing the model training operation.
[0303] Furthermore, in an embodiment of the present application, a method based on image format conversion combined with product implementation is provided. Through the above method, subsequent image processing, image storage or model training operations can also be performed on the converted RGB format image, thereby increasing the flexibility of the solution.
[0304] In combination with the above introduction, the following will introduce the solution for converting RGB format images into YUV format images, and introduce the image processing method in this application. Figure 6 Another embodiment of the image processing method in the embodiment of the present application includes:
[0305] 201. Obtain second color-coded data of an image to be converted, wherein the second color-coded data includes first original channel data, second original channel data, and third original channel data;
[0306] In this embodiment, an image processing apparatus obtains an image to be converted, which is in RGB format. Therefore, based on the image to be converted, corresponding second color-coded data can be obtained. The second color-coded data includes first original channel data, second original channel data, and third original channel data. Because the image to be converted includes multiple pixels, each pixel having a set of second color-coded data, in this application, the second color-coded data may refer to the second color-coded data of a pixel in the image to be converted, or may include the second color-coded data of each pixel in the image to be converted.
[0307] It should be noted that this application is described using the example of the second color encoding being in RGB format and the first color encoding being in YUV format, but this should not be understood as limiting this application. Based on this, the first original channel data can be original R channel data, the second original channel data can be original G channel data, and the third original channel data can be original B channel data.
[0308] It should be noted that the image processing device can be deployed on a server, on a terminal device, or on an image processing system composed of a server and a terminal device, and this application does not limit this.
[0309] It should be noted that the images to be converted involved in this application include but are not limited to BMP images, GIF images, JPEG images, and PNG images, etc., and are not limited here.
[0310] 202、determining the first target component data by using the first component data conversion relationship for the first raw channel data, the second raw channel data and the third raw channel data included in the second color coded data, wherein the first component data conversion relationship is determined according to the first component data quantization conversion relationship and a quantization coefficient, and the quantization coefficient is 7;
[0311] In the embodiment, the image processing apparatus converts the second color coded data of each pixel point in the image to be converted by using the corresponding channel data conversion relationship. Since the image to be converted is in YUV format, the Y component data (i.e. the first target component data) after conversion can be calculated based on the second color coded data of each pixel point.
[0312] Specifically, taking any one pixel point as an example, the image processing apparatus substitutes the first raw channel data, the second raw channel data and the third raw channel data in the second color coded data corresponding to the pixel point into the first component data conversion relationship to obtain the Y component data after conversion (i.e. the first target component data). The first component data conversion relationship is determined according to the first component data quantization conversion relationship and a quantization coefficient. The first component data quantization conversion relationship is determined based on the ITU-R BT.601 standard, which will be described in detail in subsequent embodiments. The quantization coefficient can quantize the corresponding operation data. In the present application, the quantization coefficient used in the process of converting the image in RGB format to the image in YUV format is 7.
[0313] 203、determining the second target component data by using the second component data conversion relationship for the first raw channel data, the second raw channel data and the third raw channel data included in the second color coded data, wherein the second component data conversion relationship is determined according to the second component data quantization conversion relationship and a quantization coefficient;
[0314] In the embodiment, similar to step 202, the image processing apparatus converts the second color coded data of each pixel point in the image to be converted by using the corresponding channel data conversion relationship. Since the image to be converted is in YUV format, the U component data after conversion (i.e. the second target component data) can be calculated based on the second color coded data of each pixel point.
[0315] Specifically, taking any pixel point as an example, the image processing device substitutes the first original channel data, the second original channel data and the third original channel data in the second color coding data corresponding to the pixel point into the second component data conversion relationship based on the second component data conversion relationship, thereby obtaining the converted U component data (i.e., the second target component data). Among them, the second component data conversion relationship is determined according to the second component data quantization conversion relationship and the quantization coefficient. The second component data quantization conversion relationship is determined based on the ITU-R BT.601 standard and will be introduced in detail in subsequent embodiments. The quantization coefficient can realize the quantization of the corresponding operation data. In this application, in the process of converting the RGB format image to the YUV format image, the quantization coefficient used is 7.
[0316] 204. Determine third target component data by using a third component data conversion relationship of the first color coding for the first original channel data, the second original channel data, and the third original channel data included in the second color coding data, wherein the third component data conversion relationship is determined based on a third component data quantization conversion relationship and a quantization coefficient.
[0317] In this embodiment, similar to steps 202 and 203, the image processing device converts the second color-coded data for each pixel in the image to be converted using the corresponding channel data conversion relationship. Since the image needs to be converted into a YUV format, the converted V component data (i.e., the third target component data) can be calculated based on the second color-coded data for each pixel.
[0318] Specifically, taking any pixel point as an example, the image processing device substitutes the first original channel data, the second original channel data and the third original channel data in the second color-coded data corresponding to the pixel point into the third component data conversion relationship based on the third component data conversion relationship, thereby obtaining the converted V component data (i.e., the third target component data). Among them, the third component data conversion relationship is determined according to the third component data quantization conversion relationship and the quantization coefficient. The third component data quantization conversion relationship is determined based on the ITU-R BT.601 standard and will be introduced in detail in subsequent embodiments. The quantization coefficient can realize the quantization of the corresponding operation data. In this application, in the process of converting the RGB format image to the YUV format image, the quantization coefficient used is 7.
[0319] It should be noted that there is no limitation on the execution order of steps 102 to 104 .
[0320] 205. Generate a converted target image according to the first target component data, the second target component data, and the third target component data.
[0321] In the embodiment, the image processing apparatus can obtain the converted YUV image based on the first target component data, the second target component data and the third target component data corresponding to each pixel point, and the YUV image is the target image.
[0322] It should be noted that the second color coding is in RGB format and the first color coding is in YUV format in the application, the first target component data is target Y component data, the second target component data is target U component data, and the third target component data is target V component data.
[0323] In the embodiment of the application, a method for image processing is provided. In the above manner, when the RGB format image is converted based on the BT.601 standard, the quantization coefficient is set to 7, the target image in YUV format can be obtained, and each color channel in the target image uses 8-bit data operation. Compared with the existing 16-bit data or 32-bit data, the data operation amount is saved, thereby improving the image format conversion efficiency.
[0324] Optionally, in the above Figure 6 Based on the corresponding embodiments, in another optional embodiment of the application, before obtaining the second color coding data of the image to be converted, the method can further include:
[0325] Obtaining a first component data quantization conversion relationship;
[0326] Obtaining a second component data quantization conversion relationship;
[0327] Obtaining a third component data quantization conversion relationship;
[0328] Determining an amplification multiple according to the quantization coefficient, wherein the amplification multiple is 2 raised to the power of K, and K is the quantization coefficient;
[0329] Obtaining a first component data conversion relationship according to the first component data quantization conversion relationship and the amplification multiple;
[0330] Obtaining a second component data conversion relationship according to the second component data quantization conversion relationship and the amplification multiple;
[0331] Obtaining a third component data conversion relationship according to the third component data quantization conversion relationship and the amplification multiple.
[0332] In the embodiment, a method for constructing the first color coding data conversion relationship is introduced. Before constructing each data conversion relationship, data quantization processing is required, wherein the data quantization includes overall data quantization and operation data quantization. It can be understood that the overall data quantization method has been introduced in the foregoing embodiment, and thus will not be described here.
[0333] Based on the ITU-R BT.601 standard, the quantized R channel data value range is set to [16,235], the quantized G channel data value range is set to [16,235], and the quantized B channel data value range is set to [16,235]. The quantized Y component data value range is set to [16,235], the quantized U component data value range is set to [16,240], and the quantized V component data value range is set to [16,240]. The quantization formulas are as follows: Formula 1 to Formula 3,
[0334] Based on the ITU-R BT.601 standard, a simplified formula for converting the second color-coded data into the first color-coded data can be obtained, that is, the unquantized conversion formula is:
[0335] Y = 0.299*R' + 0.587*G' + 0.114*B' + 128; (Formula 16)
[0336] U = -0.169*R' - 0.331*G' + 0.5*B' + 128; (Formula 17)
[0337] V = 0.5*R'-0.419*G'-0.081*B'; (Formula 18)
[0338] Among them, R' represents the quantized R channel data, Y represents the unquantized Y component data, G' represents the quantized G channel data, U represents the unquantized U component data, B' represents the quantized B channel data, and V represents the unquantized V component data.
[0339] By combining Formula 1 to Formula 3 and Formulas 16 to 18, the first component data quantization conversion relationship, the second component data quantization conversion relationship, and the third component data quantization conversion relationship can be obtained.
[0340] It should be noted that, in addition, it is also necessary to obtain a quantization coefficient, determine the amplification factor based on the quantization coefficient, and combine the amplification factor and each data quantization conversion relationship to obtain the data conversion relationship of each channel.
[0341] Based on this, see Figure 7 , Figure 7 This is another flow chart of image processing based on data quantization in an embodiment of the present application. As shown in the figure, linear transformation can be used to make the Y component data, U component data and V component data within a certain range through quantization. Quantization usually needs to be performed before the data enters the conversion formula to play a role in preserving accuracy, that is, Figure 7 The process shown.
[0342] Secondly, in an embodiment of the present application, a method for constructing a first color coding data conversion relationship is provided. Through the above method, based on the color conversion standard commonly used in computer vision, namely ITU-R BT.601, after the data is quantized, it is possible to combine the chip architecture characteristics of different platforms to achieve rapid color conversion, thereby improving conversion efficiency while minimizing the color loss caused by format conversion.
[0343] Optionally, in the above Figure 6 On the basis of the corresponding embodiments, in another optional embodiment provided by the embodiment of the present application, the quantization conversion relationship of the first component data satisfies the following relationship:
[0344] Y=0.257*R+0.504*G+0.098*B+16;
[0345] Among them, Y represents brightness data, R represents red channel data, G represents green channel data, and B represents blue channel data;
[0346] The second component data quantization conversion relationship satisfies the following relationship:
[0347] U=-0.148*R-0.291*G+0.439*B+128;
[0348] Among them, U represents chromaticity data, R represents red channel data, G represents green channel data, and B represents blue channel data;
[0349] The third component data quantization conversion relationship satisfies the following relationship:
[0350] V=0.439*R-0.368*G-0.071*B+128;
[0351] Among them, V represents concentration data, R represents red channel data, G represents green channel data, and B represents blue channel data;
[0352] Acquiring the first component data conversion relationship according to the first component data quantification conversion relationship and the magnification factor may specifically include:
[0353] The first component data quantization conversion relationship is amplified by using an amplification factor to obtain a first component data conversion relationship. The first component data conversion relationship satisfies the following relationship:
[0354] Y=(32*R+65*G+13*B+2048)>>7;
[0355] Among them, Y represents brightness data, R represents red channel data, G represents green channel data, and B represents blue channel data;
[0356] Acquiring the second component data conversion relationship according to the second component data quantification conversion relationship and the magnification factor may specifically include:
[0357] The second component data quantization conversion relationship is amplified by using an amplification factor to obtain a second component data conversion relationship. The second component data conversion relationship satisfies the following relationship:
[0358] U=(-19*R-37*G+56*B+16384)>>7;
[0359] Among them, U represents chromaticity data, R represents red channel data, G represents green channel data, and B represents blue channel data;
[0360] Acquiring the third component data conversion relationship according to the third component data quantification conversion relationship and the magnification factor may specifically include:
[0361] The third component data quantization conversion relationship is amplified by using an amplification factor to obtain a third component data conversion relationship. The third component data conversion relationship satisfies the following relationship:
[0362] V=(56*R-47*G-9*B+16384)>>7;
[0363] Among them, V represents concentration data, R represents red channel data, G represents green channel data, and B represents blue channel data.
[0364] This embodiment introduces a method for determining the conversion relationship of the first color-coded data. As can be seen from the above embodiment, based on the ITU-R BT.601 standard, an unquantized conversion formula for converting the second color-coded data into the first color-coded data can be obtained. Combining Formulas 1 to 3 and Formulas 16 to 18, the quantization conversion relationship of each data component can be obtained respectively. The quantization conversion relationship of the first component data is expressed as:
[0365] Y = 0.257*R + 0.504*G + 0.098*B + 16; (Formula 19)
[0366] The second component data quantization conversion relationship is expressed as:
[0367] U = -0.148*R - 0.291*G + 0.439*B + 128; (Formula 20)
[0368] The third component data quantization conversion relationship is expressed as:
[0369] V = 0.439*R-0.368*G-0.071*B+128; (Formula 21)
[0370] Among them, R represents R channel data, G represents G channel data, B represents B channel data, Y represents Y component data, U represents U component data, and V represents V component data.
[0371] Summarizing Formula 19 to Formula 21, we can obtain the data conversion relationship shown in Table 4.
[0372] Table 4
[0373] R G B Y-16 0.257 0.504 0.098 U-128 -0.148 -0.291 0.439 V-128 0.439 -0.368 -0.071
[0374] It can be seen that the value subtracted from the Y component data is smaller, while the values subtracted from the U component data and the V component data are larger. This is because the first color-coded data itself needs to be converted from an analog signal to a digital signal, the voltage has positive and negative signs, and the value range of the U component data and the V component data also corresponds to [-128, 127].
[0375] Further quantization can be performed based on Formulas 19 to 21. Since the value range of the first color-coded data and the second color-coded data is [0, 255], unsigned 8-bit data can be used for storage in a computer. The product of two 8-bit values will be expanded to a 16-bit value. Therefore, the parameters in Table 4 can also be quantized to signed 16-bit values. It should be noted that their effective values are still 8 bits. To avoid overflow when using a signed 16-bit value after multiplying two 8-bit data, the maximum possible value of the product needs to be considered when quantizing the parameters shown in Table 4.
[0376] Specifically, for the first component data quantization conversion relationship, the maximum value is obtained when R = 255, G = 255, and B = 255. We then began to try different quantization coefficients. Assuming that the quantization coefficient is set to 8, that is, the parameter *(1<<8) in Table 4, where << represents a left shift operation. This yields the following results:
[0377] 0.257*(1<<8)≈66;
[0378] 0.504*(1<<8)≈130;
[0379] 0.098*(1<<8)≈26
[0380] Therefore, Y = 66*255 + 130*255 + 26*255 + 16 = 566626 > max(int16) = 32767, which will cause overflow and one place is too much. Therefore, it is not appropriate to choose 8 as the quantization coefficient. Based on this, assuming that the quantization coefficient is set to 7, that is, the parameter * (1<<7) in Table 4, the following results are obtained:
[0381] 0.257*(1<<7)≈33;
[0382] 0.504*(1<<7)≈65;
[0383] 0.098*(1<<7)≈13
[0384] Therefore, Y = 33*255 + 65*255 + 13*255 + 16 = 28321 <max(int16)=32767,不会溢出。基于此,最后将量化系数定为7。
[0385] It should be noted that the above examples are based on positive values for comparison. In practical applications, the overflow problem also needs to consider the case of negative values. In summary, when the quantization coefficient is determined to be 7 (i.e., K=7), the magnification factor is determined according to the quantization coefficient, and the magnification factor is 2 to the power of 7 (equal to 128). Therefore, the magnification factor is used to amplify the quantization conversion relationship of the first component data to obtain the first component data conversion relationship, and the first component data conversion relationship is expressed as:
[0386] Y=(32*R+65*G+13*B+2048)>>7;(Formula 22)
[0387] The second component data quantization conversion relationship is amplified by using the amplification factor to obtain the second component data conversion relationship. The obtained second component data conversion relationship is expressed as:
[0388] U = (-19*R-37*G+56*B+16384)>>7; (Formula 23)
[0389] The third component data quantization conversion relationship is amplified by using an amplification factor to obtain the third component data conversion relationship. The obtained third component data conversion relationship is expressed as:
[0390] V = (56*R-47*G-9*B+16384)>>7; (Formula 24)
[0391] Summarizing Formula 22 to Formula 24, we can obtain the data conversion relationship shown in Table 5.
[0392] Table 5
[0393] R G B Quantization Coefficients Y-16 32 65 13 7 U-128 -19 -37 56 7 V-128 56 -47 -9 7
[0394] This application can use the parameters shown in Table 5 to convert RGB format images into YUV format images.
[0395] Again, in an embodiment of the present application, a method for determining the first color-coded data conversion relationship is provided. Through the above method, the specific content of each data conversion relationship is described, thereby providing a basis for the implementation of the solution, thereby improving the feasibility and operability of the solution.
[0396] Optionally, in the above Figure 6 On the basis of the corresponding embodiments, in another optional embodiment provided by the embodiment of the present application, before obtaining the second color coding data of the image to be converted, the following may be further included:
[0397] Obtaining a first component data quantization conversion relationship;
[0398] Obtaining a quantization conversion relationship of the second component data;
[0399] Obtaining a quantization conversion relationship of the third component data;
[0400] Determine the magnification factor and the tail constant according to the quantization coefficient, wherein the magnification factor is 2 to the power of K, the tail constant is 2 to the power of (K-1), and K is the quantization coefficient;
[0401] Obtaining a first component data conversion relationship according to the first component data quantization conversion relationship, the magnification factor, and the tail constant;
[0402] Obtaining a second component data conversion relationship according to the second component data quantization conversion relationship, the magnification factor, and the tail constant;
[0403] The third component data conversion relationship is obtained according to the third component data quantization conversion relationship, the magnification factor and the tail constant.
[0404] This embodiment introduces another method for constructing the first color-coded data conversion relationship. Before constructing each data conversion relationship, data quantization is required. Data quantization includes two parts: overall data quantization and computational data quantization. As will be appreciated, the overall data quantization method has been described in the previous embodiment and will not be further described here.
[0405] Based on the ITU-R BT.601 standard, the quantized R channel data value range is set to [16, 235], the quantized G channel data value range is set to [16, 235], and the quantized B channel data value range is set to [16, 235]. The quantized Y component data value range is set to [16, 235], the quantized U component data value range is set to [16, 240], and the quantized V component data value range is set to [16, 240]. The quantization formulas are shown in Formulas 1 to 3, and the simplified formulas for the first color-coded data are shown in Formulas 16 to 18. Combining Formulas 1 to 3 and Formulas 16 to 18, the quantization conversion relationship of the first component data, the quantization conversion relationship of the second component data, and the quantization conversion relationship of the third component data can be obtained.
[0406] It should be noted that, in addition, it is necessary to obtain the quantization coefficient and the tail constant, determine the magnification factor and the tail constant according to the quantization coefficient, amplify each data quantization conversion relationship in combination with the magnification factor, increase the number of bits in combination with the tail constant, and thus obtain each data conversion relationship. It can be understood that the tail constant can play a role in rounding to reduce the quantization error. This is because shift processing, that is, division, is required in the subsequent processing process. Therefore, a value of half the size of the denominator can be added in advance, and the result can be rounded down after calculation to achieve the effect of rounding.
[0407] Secondly, in the embodiment of the present application, another method for constructing the first color-coded data conversion relationship is provided. Through the above method, a tail constant can also be added. The tail constant serves to round off the final data when truncating it, thereby reducing quantization error. In addition, based on the color conversion standard commonly used in computer vision, namely ITU-R BT.601, after quantizing the data, it is possible to combine the chip architecture characteristics of different platforms to achieve rapid color conversion, thereby improving conversion efficiency while minimizing color loss caused by format conversion.
[0408] Optionally, in the above Figure 6 On the basis of the corresponding embodiments, in another optional embodiment provided by the embodiment of the present application, the quantization conversion relationship of the first component data satisfies the following relationship:
[0409] Y=0.257*R+0.504*G+0.098*B+16;
[0410] Among them, Y represents brightness data, R represents red channel data, G represents green channel data, and B represents blue channel data;
[0411] The second component data quantization conversion relationship satisfies the following relationship:
[0412] U=-0.148*R-0.291*G+0.439*B+128;
[0413] Among them, U represents chromaticity data, R represents red channel data, G represents green channel data, and B represents blue channel data;
[0414] The third component data quantization conversion relationship satisfies the following relationship:
[0415] V=0.439*R-0.368*G-0.071*B+128;
[0416] Among them, V represents concentration data, R represents red channel data, G represents green channel data, and B represents blue channel data;
[0417] Obtaining the first component data conversion relationship according to the first component data quantization conversion relationship, the magnification factor, and the tail constant may specifically include:
[0418] Amplifying the first component data quantization conversion relationship by using an amplification factor;
[0419] The quantization conversion relationship of the amplified first component data is added to the tail constant to obtain the first component data conversion relationship. The first component data conversion relationship satisfies the following relationship:
[0420] Y=(32*R+65*G+13*B+2112)>>7;
[0421] Among them, Y represents brightness data, R represents red channel data, G represents green channel data, and B represents blue channel data;
[0422] Obtaining the second component data conversion relationship according to the second component data quantization conversion relationship, the magnification factor, and the tail constant may specifically include:
[0423] Amplifying the quantization conversion relationship of the second component data by using an amplification factor;
[0424] The quantization conversion relationship of the amplified second component data is added to the tail constant to obtain the second component data conversion relationship. The second component data conversion relationship satisfies the following relationship:
[0425] U=(-19*R-37*G+56*B+16448)>>7;
[0426] Among them, Y represents brightness data, R represents red channel data, G represents green channel data, and B represents blue channel data;
[0427] Obtaining the third component data conversion relationship according to the third component data quantization conversion relationship, the magnification factor, and the tail constant may specifically include:
[0428] Adopting the magnification factor to amplify the quantization conversion relationship of the third component data;
[0429] The quantization conversion relationship of the amplified third component data is added to the tail constant to obtain the third component data conversion relationship. The third component data conversion relationship satisfies the following relationship:
[0430] V=(56*R-47*G-9*B+16448)>>7;
[0431] Among them, Y represents brightness data, R represents red channel data, G represents green channel data, and B represents blue channel data.
[0432] In this embodiment, a method for determining the conversion relationship of the first color-coded data is introduced. It can be seen from the aforementioned embodiment that based on the ITU-R BT.601 standard, an unquantized conversion formula for converting the second color-coded data into the first color-coded data can be obtained. Combining Formulas 1 to 3 and Formulas 16 to 18, each data quantization conversion relationship can be obtained respectively, wherein the first component data quantization conversion relationship, the second component data quantization conversion relationship and the third component data quantization conversion relationship can be referred to Formulas 19 to 21 respectively, and the data conversion relationships involved are shown in Table 4, which are not described here. Further quantization can be performed based on Formulas 19 to 21, that is, the quantization coefficient can be determined to be 7 by the method described in the aforementioned embodiment, and the process of proving that the quantization coefficient is 7 will not be repeated.
[0433] In summary, when the quantization coefficient is determined to be 7 (i.e., K=7), the magnification factor is determined based on the quantization coefficient, and the magnification factor is 2 to the power of 7 (equal to 128). In addition, the tail constant is determined based on the quantization coefficient, and the tail constant is 2 to the power of (7-1) (equal to 64). Therefore, the magnification factor is used to amplify the quantization conversion relationship of the first component data, and then the amplified quantization conversion relationship of the first component data is added to the tail constant to obtain the first component data conversion relationship. The first component data conversion relationship is expressed as:
[0434] Y=(32*R+65*G+13*B+2112)>>7;(Formula 25)
[0435] The second component data quantization conversion relationship is amplified by the magnification factor, and then the amplified second component data quantization conversion relationship is added to the tail constant to obtain the second component data conversion relationship. The second component data conversion relationship is expressed as:
[0436] U = (-19*R-37*G+56*B+16448)>>7; (Formula 26)
[0437] The third component data quantization conversion relationship is amplified by the magnification factor, and then the amplified third component data quantization conversion relationship is added to the tail constant to obtain the third component data conversion relationship. The third component data conversion relationship is expressed as:
[0438] V = (56*R-47*G-9*B+16448)>>7; (Formula 27)
[0439] Summarizing Formula 13 to Formula 15, we can obtain the data conversion relationship shown in Table 6.
[0440] Table 6
[0441] R G B Quantization Coefficients Tail Constant Y-16 0.257 0.504 0.098 7 64 U-128 -0.148 -0.291 0.439 7 64 V-128 0.439 -0.368 -0.071 7 64
[0442] The present application can convert the RGB format image into the YUV format image by using the parameters shown in Table 9.
[0443] Again, in the embodiments of the present application, a manner for determining the first color coding data conversion relationship is provided, and the specific content of each data conversion relationship is described by the above manner, thereby providing an implementation basis for the implementation of the scheme, and thus improving the feasibility and operability of the scheme.
[0444] In order to verify that the method provided by the present application can achieve good effects in conversion efficiency and conversion quality, the test results will be described in detail below. When testing the conversion efficiency, a linux host with a processor of 3.5 GHz 12-core Intel Core i7-7800X is used, and a single thread is started. Several commonly used resolutions are tested, and the average is obtained by calling 1000 times in a loop. The efficiency of converting the YUV image into the RGB image is shown in Table 7, and the efficiency of converting the RGB image into the YUV image is shown in Table 8.
[0445] Table 7
[0446] Resolution YUV -> RGB (before quantization) YUV -> RGB (after quantization) Speedup 540×360×3 414 microseconds (us) 112 microseconds (us) 3.69 720×540×3 877 microseconds (us) 216 microseconds (us) 4.06 1080×960×3 2215 microseconds (us) 709 microseconds (us) 3.12 1280×1080×3 2964 microseconds (us) 753 microseconds (us) 3.93
[0447] Table 8
[0448] Resolution YUV -> RGB (before quantization) YUV -> RGB (after quantization) Speedup 540×360×3 329 microseconds (us) 142 microseconds (us) 2.32 720×540×3 717 microseconds (us) 245 microseconds (us) 2.93 1080×960×3 1828 microseconds (us) 571 microseconds (us) 3.20 1280×1080×3 2469 microseconds (us) 657 microseconds (us) 3.75
[0449] As can be seen from Tables 7 and 8, the efficiency is obviously improved after the data is quantized by the present application.
[0450] Further, please refer to Figure 8 , Figure 8 is an effect comparison diagram of the data before and after quantization in the embodiments of the present application. As shown in the figure, the left graph is the original image, and the right graph is the image after quantization conversion. The maximum difference of the pixels obtained from the commonly used test image data set is 5, the texture is clear, the converted image has little difference compared with the original image, and the influence on the subsequent computer vision processing is very small.
[0451] The image processing device in the present application will be described in detail below. Please refer to Figure 9 , Figure 9 is an embodiment diagram of the image processing device in the embodiments of the present application. The image processing device 30 comprises:
[0452] An acquisition module 301 is configured to acquire first color-coded data of an image to be converted, wherein the first color-coded data includes first original component data, second original component data, and third original component data;
[0453] A determination module 302 is configured to determine, for the first original component data and the third original component data included in the first color-coded data, first target channel data by adopting a first channel data conversion relationship of the second color code, wherein the first channel data conversion relationship is determined according to a first channel data quantization conversion relationship and a quantization coefficient, and the quantization coefficient is 6;
[0454] The determining module 302 is further configured to determine, for the first original component data, the second original component data, and the third original component data included in the first color-coded data, second target channel data by adopting a second channel data conversion relationship of the second color code, wherein the second channel data conversion relationship is determined according to a second channel data quantization conversion relationship and a quantization coefficient;
[0455] The determining module 302 is further configured to determine, for the first original component data and the second original component data included in the first color-coded data, third target channel data by adopting a third channel data conversion relationship of the second color code, wherein the third channel data conversion relationship is determined based on a third channel data quantization conversion relationship and a quantization coefficient;
[0456] The conversion module 303 is configured to generate a converted target image according to the first target channel data, the second target channel data, and the third target channel data.
[0457] In an embodiment of the present application, an image processing device is provided. When the above-mentioned device is used to convert an image in YUV format based on the BT.601 standard, the quantization coefficient is set to 6, and a target image in RGB format can be obtained. In addition, each color channel in the target image uses 8-bit data operation. Compared with the existing 16-bit data or 32-bit data, this saves the amount of data calculation, thereby improving the efficiency of image format conversion.
[0458] Optionally, in the above Figure 9 On the basis of the corresponding embodiment, in another embodiment of the image processing device 30 provided in the embodiment of the present application,
[0459] The acquisition module 301 is further configured to acquire a first channel data quantization conversion relationship before acquiring the first color coding data of the image to be converted;
[0460] The acquisition module 301 is further used to obtain the quantization conversion relationship of the second channel data;
[0461] The acquisition module 301 is further used to obtain the quantization conversion relationship of the third channel data;
[0462] The determination module 302 is further configured to determine a magnification factor according to the quantization coefficient, wherein the magnification factor is 2 raised to the power of K, where K is the quantization coefficient;
[0463] The acquisition module 301 is further configured to acquire the first channel data conversion relationship based on the first channel data quantification conversion relationship and the magnification factor;
[0464] The acquisition module 301 is further configured to acquire the second channel data conversion relationship according to the second channel data quantification conversion relationship and the magnification factor;
[0465] The acquisition module 301 is further configured to obtain the third channel data conversion relationship based on the quantified conversion relationship and the magnification factor of the third channel data.
[0466] In an embodiment of the present application, an image processing device is provided. By using the above-mentioned device, after quantizing the data based on the color conversion standard commonly used in computer vision, namely ITU-R BT.601, it is possible to combine the chip architecture characteristics of different platforms to achieve rapid color conversion, thereby improving conversion efficiency while minimizing color loss caused by format conversion.
[0467] Optionally, in the above Figure 9 On the basis of the corresponding embodiment, in another embodiment of the image processing device 30 provided in the embodiment of the present application,
[0468] The acquisition module 301 is specifically configured to amplify the first channel data quantization conversion relationship using a magnification factor to obtain a first channel data conversion relationship. The first channel data conversion relationship satisfies the following relationship:
[0469] R=74*(Y-16)+102*(V–128)>>6;
[0470] Among them, R represents red channel data, Y represents brightness data, and V represents concentration data;
[0471] The acquisition module 301 is specifically configured to amplify the second channel data quantization conversion relationship using a magnification factor to obtain a second channel data conversion relationship. The second channel data conversion relationship satisfies the following relationship:
[0472] G=74*(Y-16)–25*(V-128)–25*(U-128)>>6;
[0473] Among them, G represents green channel data, Y represents brightness data, V represents concentration data, and U represents chromaticity data;
[0474] The acquisition module 301 is specifically configured to amplify the third channel data quantization conversion relationship by using a magnification factor to obtain a third channel data conversion relationship. The third channel data conversion relationship satisfies the following relationship:
[0475] B=74*(Y-16)+129*(U-128)>>6;
[0476] Among them, B represents blue channel data, Y represents brightness data, and U represents chrominance data.
[0477] In an embodiment of the present application, an image processing device is provided. The above-mentioned device is used to describe the specific content of the data conversion relationship of each channel, thereby providing a basis for the implementation of the solution, thereby improving the feasibility and operability of the solution.
[0478] Optionally, in the above Figure 9 On the basis of the corresponding embodiment, in another embodiment of the image processing device 30 provided in the embodiment of the present application,
[0479] The acquisition module 301 is further configured to acquire a first channel data quantization conversion relationship before acquiring the first color coding data of the image to be converted;
[0480] The acquisition module 301 is further used to obtain the quantization conversion relationship of the second channel data;
[0481] The acquisition module 301 is further used to obtain the quantization conversion relationship of the third channel data;
[0482] The determination module 302 is further configured to determine a magnification factor and a tail constant according to the quantization coefficient, wherein the magnification factor is 2 to the power of K, the tail constant is 2 to the power of (K-1), and K is the quantization coefficient;
[0483] The acquisition module 301 is further configured to acquire the first channel data conversion relationship according to the first channel data quantization conversion relationship, the magnification factor, and the tail constant;
[0484] The acquisition module 301 is further configured to acquire the second channel data conversion relationship according to the second channel data quantization conversion relationship, the magnification factor, and the tail constant;
[0485] The acquisition module 301 is further configured to acquire the third channel data conversion relationship according to the third channel data quantization conversion relationship, the magnification factor, and the tail constant.
[0486] In an embodiment of the present application, an image processing device is provided. Using the aforementioned device, a tail constant can also be added. The tail constant serves to round off the final data when truncating it, thereby reducing quantization error. Furthermore, based on the ITU-R BT.601 color conversion standard commonly used in computer vision, after quantizing the data, it is possible to combine the chip architecture characteristics of different platforms to achieve rapid color conversion, thereby improving conversion efficiency while minimizing color loss caused by format conversion.
[0487] Optionally, in the above Figure 9 On the basis of the corresponding embodiment, in another embodiment of the image processing device 30 provided in the embodiment of the present application,
[0488] The acquisition module 301 is specifically configured to amplify the first channel data quantization conversion relationship by using a magnification factor;
[0489] The quantization conversion relationship of the amplified first channel data is added to the tail constant to obtain the first channel data conversion relationship. The first channel data conversion relationship satisfies the following relationship:
[0490] R=(74*(Y-16)+102*(V–128)+32)>>6;
[0491] Among them, R represents red channel data, Y represents brightness data, and V represents concentration data;
[0492] The acquisition module 301 is specifically configured to amplify the quantization conversion relationship of the second channel data using a magnification factor;
[0493] The quantization conversion relationship of the amplified second channel data is added to the tail constant to obtain the second channel data conversion relationship. The second channel data conversion relationship satisfies the following relationship:
[0494] G=(74*(Y-16)–25*(V-128)–25*(U-128)+32)>>6;
[0495] Among them, G represents green channel data, Y represents brightness data, V represents concentration data, and U represents chromaticity data;
[0496] The acquisition module 301 is specifically configured to amplify the quantization conversion relationship of the third channel data using a magnification factor;
[0497] The quantization conversion relationship of the amplified third channel data is added to the tail constant to obtain the third channel data conversion relationship. The third channel data conversion relationship satisfies the following relationship:
[0498] B=(74*(Y-16)+129*(U-128)+32)>>6;
[0499] Among them, B represents blue channel data, Y represents brightness data, and U represents chrominance data.
[0500] In an embodiment of the present application, an image processing device is provided. The above-mentioned device is used to describe the specific content of the data conversion relationship of each channel, thereby providing a basis for the implementation of the solution, thereby improving the feasibility and operability of the solution.
[0501] Optionally, in the above Figure 9 On the basis of the corresponding embodiment, in another embodiment of the image processing device 30 provided in the embodiment of the present application, the image processing device 30 further includes a processing module 304;
[0502] The acquisition module 301 is specifically configured to acquire an image to be converted through an image acquisition device, wherein the image to be converted is an image in a YUV format;
[0503] Acquire first color coding data according to the image to be converted;
[0504] The processing module 304 is configured to generate a converted target image based on the first target channel data, the second target channel data, and the third target channel data, and then perform beautification processing on the target image if an image processing instruction is received;
[0505] If an image storage instruction is received, the target image is stored;
[0506] If an image training instruction is received, the target image is used as a training sample to perform model training.
[0507] In an embodiment of the present application, an image processing device is provided. By using the above device, subsequent image processing, image storage, model training and other operations can be performed on the converted RGB format image, thereby increasing the flexibility of the solution.
[0508] The image processing device in this application is described in detail below. Figure 10 , Figure 10 This is a schematic diagram of an embodiment of an image processing device in an embodiment of the present application. The image processing device 40 includes:
[0509] An acquisition module 401 is configured to acquire second color-coded data of an image to be converted, wherein the second color-coded data includes first original channel data, second original channel data, and third original channel data;
[0510] a determination module 402 for determining, for the first original channel data, the second original channel data, and the third original channel data included in the second color-coded data, first target component data by using a first component data conversion relationship of the first color code, wherein the first component data conversion relationship is determined based on a first component data quantization conversion relationship and a quantization coefficient, and the quantization coefficient is 7;
[0511] The determining module 402 is further configured to determine, for the first original channel data, the second original channel data, and the third original channel data included in the second color-coded data, second target component data by using a second component data conversion relationship of the first color code, wherein the second component data conversion relationship is determined based on a second component data quantization conversion relationship and a quantization coefficient;
[0512] The determining module 402 is further configured to determine, for the first original channel data, the second original channel data, and the third original channel data included in the second color-coded data, third target component data by adopting a third component data conversion relationship of the first color code, wherein the third component data conversion relationship is determined based on a third component data quantization conversion relationship and a quantization coefficient;
[0513] The conversion module 403 is configured to generate a converted target image according to the first target component data, the second target component data, and the third target component data.
[0514] In an embodiment of the present application, an image processing device is provided. When the above-mentioned device is used to convert an image in RGB format based on the BT.601 standard, the quantization coefficient is set to 7, and a target image in YUV format can be obtained. In addition, each color channel in the target image uses 8-bit data operation. Compared with the existing 16-bit data or 32-bit data, this saves the amount of data calculation, thereby improving the efficiency of image format conversion.
[0515] Optionally, in the above Figure 10 On the basis of the corresponding embodiment, in another embodiment of the image processing device 40 provided in the embodiment of the present application,
[0516] The acquisition module 401 is further configured to acquire a quantization conversion relationship of the first component data before acquiring the second color coding data of the image to be converted;
[0517] The acquisition module 401 is further used to obtain the quantization conversion relationship of the second component data;
[0518] The acquisition module 401 is further used to obtain the quantization conversion relationship of the third component data;
[0519] The determination module 402 is further configured to determine a magnification factor according to the quantization coefficient, wherein the magnification factor is 2 raised to the power of K, where K is the quantization coefficient;
[0520] The acquisition module 401 is further configured to acquire the first component data conversion relationship according to the first component data quantification conversion relationship and the magnification factor;
[0521] The acquisition module 401 is further configured to acquire the second component data conversion relationship according to the second component data quantification conversion relationship and the magnification factor;
[0522] The acquisition module 401 is further configured to acquire the third component data conversion relationship according to the third component data quantification conversion relationship and the magnification factor.
[0523] In an embodiment of the present application, an image processing device is provided. By using the above-mentioned device, after quantizing the data based on the color conversion standard commonly used in computer vision, namely ITU-R BT.601, it is possible to combine the chip architecture characteristics of different platforms to achieve rapid color conversion, thereby improving conversion efficiency while minimizing color loss caused by format conversion.
[0524] Optionally, in the above Figure 10 On the basis of the corresponding embodiment, in another embodiment of the image processing device 40 provided in the embodiment of the present application,
[0525] The acquisition module 401 is specifically configured to amplify the first component data quantization conversion relationship by using a magnification factor to obtain a first component data conversion relationship. The first component data conversion relationship satisfies the following relationship:
[0526] Y=(32*R+65*G+13*B+2048)>>7;
[0527] Among them, Y represents brightness data, R represents red channel data, G represents green channel data, and B represents blue channel data;
[0528] The acquisition module 401 is specifically configured to amplify the second component data quantization conversion relationship by using a magnification factor to obtain a second component data conversion relationship. The second component data conversion relationship satisfies the following relationship:
[0529] U=(-19*R-37*G+56*B+16384)>>7;
[0530] Among them, U represents chromaticity data, R represents red channel data, G represents green channel data, and B represents blue channel data;
[0531] The acquisition module 401 is specifically configured to amplify the third component data quantization conversion relationship by using a magnification factor to obtain a third component data conversion relationship. The third component data conversion relationship satisfies the following relationship:
[0532] V=(56*R-47*G-9*B+16384)>>7;
[0533] Among them, V represents concentration data, R represents red channel data, G represents green channel data, and B represents blue channel data.
[0534] In an embodiment of the present application, an image processing device is provided. The above-mentioned device is used to describe the specific content of each data conversion relationship, thereby providing an implementation basis for the implementation of the solution, thereby improving the feasibility and operability of the solution.
[0535] Optionally, in the above Figure 10 On the basis of the corresponding embodiment, in another embodiment of the image processing device 40 provided in the embodiment of the present application,
[0536] The acquisition module 401 is further configured to acquire a quantization conversion relationship of the first component data before acquiring the second color coding data of the image to be converted;
[0537] The acquisition module 401 is further used to obtain the quantization conversion relationship of the second component data;
[0538] The acquisition module 401 is further used to obtain the quantization conversion relationship of the third component data;
[0539] The determination module 402 is further configured to determine a magnification factor and a tail constant according to the quantization coefficient, wherein the magnification factor is 2 to the power of K, the tail constant is 2 to the power of (K-1), and K is the quantization coefficient;
[0540] The acquisition module 401 is further configured to acquire the first component data conversion relationship according to the first component data quantization conversion relationship, the magnification factor, and the tail constant;
[0541] The acquisition module 401 is further configured to acquire the second component data conversion relationship according to the second component data quantization conversion relationship, the magnification factor, and the tail constant;
[0542] The acquisition module 401 is further configured to acquire the third component data conversion relationship according to the third component data quantization conversion relationship, the magnification factor, and the tail constant.
[0543] In the embodiments of the present application, the image processing device is provided, and the tail constant is further added, which plays a role of rounding off when truncating the last data, thereby reducing quantization error. In addition, based on the color conversion standard commonly used in computer vision, that is, ITU-R BT.601, after quantizing the data, the chip architecture characteristics of different platforms can be combined to realize fast conversion of color, thereby improving conversion efficiency while reducing color loss caused by format conversion as much as possible.
[0544] Optionally, in the above Figure 10 Based on the corresponding embodiments, in another embodiment of the image processing device 40 provided by the present application,
[0545] The acquisition module 401 is specifically configured to magnify the first component data quantization conversion relationship by using a magnification factor.
[0546] The first component data quantization conversion relationship after magnification processing is added to the tail constant to obtain a first component data conversion relationship, and the first component data conversion relationship satisfies the following relationship:
[0547] Y=(32*R+65*G+13*B+2112)>>7;
[0548] Wherein, Y represents luminance data, R represents red channel data, G represents green channel data, and B represents blue channel data.
[0549] The acquisition module 401 is specifically configured to magnify the second component data quantization conversion relationship by using a magnification factor.
[0550] The second component data quantization conversion relationship after magnification processing is added to the tail constant to obtain a second component data conversion relationship, and the second component data conversion relationship satisfies the following relationship:
[0551] U=(-19*R-37*G+56*B+16448)>>7;
[0552] Wherein, Y represents luminance data, R represents red channel data, G represents green channel data, and B represents blue channel data.
[0553] The acquisition module 401 is specifically configured to magnify the third component data quantization conversion relationship by using a magnification factor.
[0554] The third component data quantization conversion relationship after magnification processing is added to the tail constant to obtain a third component data conversion relationship, and the third component data conversion relationship satisfies the following relationship:
[0555] V=(56*R-47*G-9*B+16448)>>7;
[0556] Among them, Y represents brightness data, R represents red channel data, G represents green channel data, and B represents blue channel data.
[0557] In an embodiment of the present application, an image processing device is provided. The above-mentioned device is used to describe the specific content of each data conversion relationship, thereby providing an implementation basis for the implementation of the solution, thereby improving the feasibility and operability of the solution.
[0558] The embodiment of the present application also provides an image processing device, which can be deployed on a server. Figure 11 , Figure 11 This is a schematic diagram of a server structure provided by an embodiment of the present application. The server 500 may have relatively large differences due to different configurations or performances, and may include one or more CPUs 522 (for example, one or more processors) and memories 532, and one or more storage media 530 (for example, one or more massive storage devices) for storing application programs 542 or data 544. Among them, the memories 532 and the storage media 530 may be temporary storage or permanent storage. The program stored in the storage medium 530 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 522 may be configured to communicate with the storage medium 530 to execute a series of instruction operations in the storage medium 530 on the server 500.
[0559] The server 500 may also include one or more power supplies 526, one or more wired or wireless network interfaces 550, one or more input and output interfaces 558, and / or one or more operating systems 541, such as Windows Server 2003 or Windows Server 2003R. TM , Mac OS X TM , Unix TM ,Linux TM , FreeBSD TM etc.
[0560] The steps performed by the server in the above embodiment can be based on the Figure 11 The server structure shown.
[0561] The present application also provides an image processing device, which can be deployed in a terminal device. Figure 12For the sake of convenience, only the parts related to the embodiment of this application are shown. For specific technical details not disclosed, please refer to the method part of the embodiment of this application. In the embodiment of this application, the terminal device is a smartphone as an example for explanation:
[0562] Figure 12 The block diagram shows a partial structure of a smart phone related to the terminal device provided in the embodiment of the present application. Figure 12 The smartphone includes components such as a radio frequency (RF) circuit 610, a memory 620, an input unit 630, a display unit 640, a sensor 650, an audio circuit 660, a wireless fidelity (WiFi) module 670, a processor 680, and a power supply 690. It will be understood by those skilled in the art that Figure 12 The structure of the smartphone shown in the figure does not constitute a limitation on the smartphone, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0563] The following combination Figure 12 A detailed introduction to the various components of a smartphone:
[0564] The RF circuit 610 can be used to receive and send signals during information transmission or calls. In particular, after receiving downlink information from the base station, it is sent to the processor 680 for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit 610 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF circuit 610 can also communicate with the network and other devices through wireless communication. The above-mentioned wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.
[0565] The memory 620 can be used to store software programs and modules. The processor 680 executes the various functional applications and data processing of the smartphone by running the software programs and modules stored in the memory 620. The memory 620 may mainly include a program storage area and a data storage area. The program storage area may store an operating system, at least one application required for a function (such as a sound playback function, an image playback function, etc.); the data storage area may store data created based on the use of the smartphone (such as audio data, a phone book, etc.). In addition, the memory 620 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device.
[0566] The input unit 630 can be used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the smartphone. Specifically, the input unit 630 may include a touch panel 631 and other input devices 632. The touch panel 631, also known as a touch screen, can collect user touch operations on or near it (such as operations performed by the user using any suitable object or accessory such as a finger, stylus, etc. on or near the touch panel 631) and drive the corresponding connection device according to a pre-set program. Optionally, the touch panel 631 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch direction, detects the signal caused by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device and converts it into touch point coordinates, which are then sent to the processor 680, and can receive commands sent by the processor 680 and execute them. In addition, the touch panel 631 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 631, the input unit 630 may further include other input devices 632. Specifically, the other input devices 632 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick.
[0567] The display unit 640 can be used to display information input by the user or information provided to the user and various menus of the smartphone. The display unit 640 may include a display panel 641. Optionally, the display panel 641 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. Further, the touch panel 631 may cover the display panel 641. When the touch panel 631 detects a touch operation on or near it, it is transmitted to the processor 680 to determine the type of touch event. Subsequently, the processor 680 provides a corresponding visual output on the display panel 641 according to the type of touch event. Although in Figure 12 In the embodiment, the touch panel 631 and the display panel 641 are used as two independent components to realize the input and output functions of the smartphone, but in some embodiments, the touch panel 631 and the display panel 641 can be integrated to realize the input and output functions of the smartphone.
[0568] The smartphone may also include at least one sensor 650, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 641 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 641 and / or the backlight when the smartphone is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the smartphone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that can be configured in the smartphone, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be described in detail here.
[0569] Audio circuit 660, speaker 661, and microphone 662 provide an audio interface between the user and the smartphone. Audio circuit 660 converts received audio data into electrical signals and transmits them to speaker 661, which then converts them into sound signals for output. Microphone 662, on the other hand, converts collected sound signals into electrical signals, which are then received by audio circuit 660 and converted into audio data. The audio data is then processed by processor 680 and transmitted to, for example, another smartphone via RF circuit 610, or stored in memory 620 for further processing.
[0570] WiFi belongs to short distance wireless transmission technology, and the smart phone can help users send and receive emails, browse web pages and access streaming media through the WiFi module 670, which provides wireless broadband Internet access for users. Although Figure 12 The WiFi module 670 is shown, but it can be understood that it does not belong to the necessary structure of the smart phone, and can be omitted as needed without changing the essence of the application.
[0571] The processor 680 is the control center of the smart phone, which connects all parts of the smart phone through various interfaces and lines, and performs various functions of the smart phone and processes data by running or executing software programs and / or modules stored in the memory 620 and calling data stored in the memory 620. Optionally, the processor 680 can include one or more processing units; optionally, the processor 680 can integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface and application program, and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 680.
[0572] The smart phone also includes a power supply 690 (such as a battery) for supplying power to various components, and the power supply can be logically connected to the processor 680 through a power management system, so as to realize the functions of power management, discharge management and power consumption management through the power management system.
[0573] Although not shown, the smart phone can also include a camera, a Bluetooth module, etc., which will not be described here.
[0574] The steps performed by the terminal device in the above embodiments can be based on the terminal device structure shown in the Figure 12 terminal device structure.
[0575] The computer readable storage medium in the embodiments of the present application stores a computer program, which makes the computer execute the method described in the above embodiments when running on the computer.
[0576] The computer program product provided in the embodiments of the present application includes a program, which makes the computer execute the method described in the above embodiments when running on the computer.
[0577] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the foregoing method embodiments, which will not be described here.
[0578] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0579] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0580] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0581] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling 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 method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0582] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for image processing, characterized in that: include: Acquire first color-coded data of the image to be converted, wherein the first color-coded data includes first original component data, second original component data, and third original component data; For the first original component data and the third original component data included in the first color-coded data, determining first target channel data by adopting a first channel data conversion relationship of a second color code, wherein the first channel data conversion relationship is determined according to a first channel data quantization conversion relationship and a quantization coefficient, and the quantization coefficient is 6; For the first original component data, the second original component data, and the third original component data included in the first color-coded data, determining second target channel data by adopting a second channel data conversion relationship of the second color code, wherein the second channel data conversion relationship is determined according to a second channel data quantization conversion relationship and the quantization coefficient; For the first original component data and the second original component data included in the first color-coded data, determining third target channel data by adopting a third channel data conversion relationship of the second color code, wherein the third channel data conversion relationship is determined according to a third channel data quantization conversion relationship and the quantization coefficient; A converted target image is generated according to the first target channel data, the second target channel data, and the third target channel data.
2. The method according to claim 1, characterized in that Before obtaining the first color coding data of the image to be converted, the method further includes: Obtaining a quantitative conversion relationship of the first channel data; Obtaining a quantitative conversion relationship of the second channel data; Obtaining a quantitative conversion relationship of the third channel data; Determining a magnification factor according to the quantization coefficient, wherein the magnification factor is 2 to the Kth power, and K is the quantization coefficient; Acquire the first channel data conversion relationship according to the first channel data quantization conversion relationship and the magnification; Acquire the second channel data conversion relationship according to the second channel data quantization conversion relationship and the magnification; The third channel data conversion relationship is acquired according to the third channel data quantization conversion relationship and the magnification factor.
3. The method according to claim 2, characterized in that The acquiring the first channel data conversion relationship according to the first channel data quantization conversion relationship and the magnification factor includes: The first channel data quantization conversion relationship is amplified by the amplification factor to obtain the first channel data conversion relationship, which satisfies the following relationship: R=74*(Y-16)+102*(V–128)>>6; Wherein, R represents red channel data, Y represents brightness data, and V represents concentration data; The acquiring the second channel data conversion relationship according to the second channel data quantization conversion relationship and the magnification factor includes: The second channel data quantization conversion relationship is amplified by the amplification factor to obtain the second channel data conversion relationship, which satisfies the following relationship: G=74*(Y-16)–25*(V-128)–25*(U-128)>>6; Wherein, G represents green channel data, Y represents brightness data, V represents concentration data, and U represents chromaticity data; The acquiring the third channel data conversion relationship according to the third channel data quantization conversion relationship and the magnification factor includes: The third channel data quantization conversion relationship is amplified by using the amplification factor to obtain the third channel data conversion relationship, which satisfies the following relationship: B=74*(Y-16)+129*(U-128)>>6; Wherein, B represents blue channel data, Y represents brightness data, and U represents chrominance data.
4. The method according to claim 1, wherein Before obtaining the first color coding data of the image to be converted, the method further includes: Obtaining a quantitative conversion relationship of the first channel data; Obtaining a quantitative conversion relationship of the second channel data; Obtaining a quantitative conversion relationship of the third channel data; Determining a magnification factor and a tail constant according to the quantization coefficient, wherein the magnification factor is 2 to the Kth power, the tail constant is 2 to the (K-1)th power, and K is the quantization coefficient; Acquire the first channel data conversion relationship according to the first channel data quantization conversion relationship, the magnification factor, and the tail constant; Acquire the second channel data conversion relationship according to the second channel data quantization conversion relationship, the magnification factor, and the tail constant; The third channel data conversion relationship is acquired according to the third channel data quantization conversion relationship, the magnification factor, and the tail constant.
5. The method according to claim 4, characterized in that The acquiring the first channel data conversion relationship according to the first channel data quantization conversion relationship, the magnification factor, and the tail constant includes: Using the amplification factor, amplifying the first channel data quantization conversion relationship; The amplified first channel data quantization conversion relationship is added to the tail constant to obtain the first channel data conversion relationship, which satisfies the following relationship: R=(74*(Y-16)+102*(V–128)+32)>>6; Wherein, R represents red channel data, Y represents brightness data, and V represents concentration data; The acquiring the second channel data conversion relationship according to the second channel data quantization conversion relationship, the magnification factor, and the tail constant includes: Using the amplification factor, amplifying the second channel data quantization conversion relationship; The amplified second channel data quantization conversion relationship is added to the tail constant to obtain the second channel data conversion relationship, which satisfies the following relationship: G=(74*(Y-16)–25*(V-128)–25*(U-128)+32)>>6; Wherein, G represents green channel data, Y represents brightness data, V represents concentration data, and U represents chromaticity data; The acquiring the third channel data conversion relationship according to the third channel data quantization conversion relationship, the magnification factor, and the tail constant includes: Using the magnification factor, amplifying the third channel data quantization conversion relationship; The amplified third channel data quantization conversion relationship is added to the tail constant to obtain the third channel data conversion relationship, which satisfies the following relationship: B=(74*(Y-16)+129*(U-128)+32)>>6; Wherein, B represents blue channel data, Y represents brightness data, and U represents chrominance data.
6. The method according to any one of claims 1 to 5, characterized in that The step of obtaining first color coding data of the image to be converted comprises: Acquire the image to be converted by an image acquisition device, wherein the image to be converted is an image in YUV format; Acquire the first color coding data according to the image to be converted; After generating the converted target image according to the first target channel data, the second target channel data, and the third target channel data, the method further includes: If an image processing instruction is received, beautify the target image; If an image storage instruction is received, the target image is stored; If an image training instruction is received, the target image is used as a training sample to perform model training.
7. A method for image processing, characterized in that: include: Acquire second color-coded data of the image to be converted, wherein the second color-coded data includes first original channel data, second original channel data, and third original channel data; For the first original channel data, the second original channel data, and the third original channel data included in the second color-coded data, determining first target component data by adopting a first component data conversion relationship of the first color code, wherein the first component data conversion relationship is determined according to a first component data quantization conversion relationship and a quantization coefficient, and the quantization coefficient is 7; For the first original channel data, the second original channel data, and the third original channel data included in the second color-coded data, determining second target component data by adopting a second component data conversion relationship of the first color code, wherein the second component data conversion relationship is determined according to a second component data quantization conversion relationship and the quantization coefficient; For the first original channel data, the second original channel data, and the third original channel data included in the second color-coded data, determining third target component data by adopting a third component data conversion relationship of the first color coding, wherein the third component data conversion relationship is determined according to a third component data quantization conversion relationship and the quantization coefficient; A converted target image is generated according to the first target component data, the second target component data, and the third target component data.
8. The method according to claim 7, characterized in that Before obtaining the second color coding data of the image to be converted, the method further includes: Obtaining a quantization conversion relationship of the first component data; Obtaining a quantization conversion relationship of the second component data; Obtaining a quantization conversion relationship of the third component data; Determining a magnification factor according to the quantization coefficient, wherein the magnification factor is 2 raised to the Kth power, and K is the quantization coefficient; Acquire the first component data conversion relationship according to the first component data quantization conversion relationship and the magnification; Acquire the second component data conversion relationship according to the second component data quantization conversion relationship and the magnification; The third component data conversion relationship is acquired according to the third component data quantization conversion relationship and the magnification factor.
9. The method according to claim 8, characterized in that The acquiring the first component data conversion relationship according to the first component data quantization conversion relationship and the magnification factor includes: The first component data quantization conversion relationship is amplified by the amplification factor to obtain the first component data conversion relationship, which satisfies the following relationship: Y=(32*R+65*G+13*B+2048)>>7; Wherein, the Y represents brightness data, the R represents red channel data, the G represents green channel data, and the B represents blue channel data; The acquiring the second component data conversion relationship according to the second component data quantization conversion relationship and the magnification factor includes: The second component data quantization conversion relationship is amplified by the amplification factor to obtain the second component data conversion relationship, which satisfies the following relationship: U=(-19*R-37*G+56*B+16384)>>7; Wherein, the U represents chromaticity data, the R represents red channel data, the G represents green channel data, and the B represents blue channel data; The step of obtaining the third component data conversion relationship according to the third component data quantization conversion relationship and the magnification factor includes: The third component data quantization conversion relationship is amplified by the amplification factor to obtain the third component data conversion relationship, which satisfies the following relationship: V=(56*R-47*G-9*B+16384)>>7; Wherein, the V represents concentration data, the R represents red channel data, the G represents green channel data, and the B represents blue channel data.
10. The method according to claim 7, characterized in that Before obtaining the second color coding data of the image to be converted, the method further includes: Obtaining a quantization conversion relationship of the first component data; Obtaining a quantization conversion relationship of the second component data; Obtaining a quantization conversion relationship of the third component data; Determining a magnification factor and a tail constant according to the quantization coefficient, wherein the magnification factor is 2 to the Kth power, the tail constant is 2 to the (K-1)th power, and K is the quantization coefficient; Acquire the first component data conversion relationship according to the first component data quantization conversion relationship, the magnification factor, and the tail constant; Acquire the second component data conversion relationship according to the second component data quantization conversion relationship, the magnification factor, and the tail constant; The third component data conversion relationship is acquired according to the third component data quantization conversion relationship, the magnification factor, and the tail constant.
11. The method according to claim 10, characterized in that The acquiring the first component data conversion relationship according to the first component data quantization conversion relationship, the magnification factor, and the tail constant includes: Using the magnification factor, amplifying the first component data quantization conversion relationship; The amplified first component data quantization conversion relationship is added to the tail constant to obtain the first component data conversion relationship, which satisfies the following relationship: Y=(32*R+65*G+13*B+2112)>>7; Wherein, the Y represents brightness data, the R represents red channel data, the G represents green channel data, and the B represents blue channel data; The acquiring the second component data conversion relationship according to the second component data quantization conversion relationship, the magnification factor, and the tail constant includes: Using the magnification factor, amplifying the second component data quantization conversion relationship; The amplified second component data quantization conversion relationship is added to the tail constant to obtain the second component data conversion relationship, which satisfies the following relationship: U=(-19*R-37*G+56*B+16448)>>7; Wherein, the Y represents brightness data, the R represents red channel data, the G represents green channel data, and the B represents blue channel data; The step of obtaining the third component data conversion relationship according to the third component data quantization conversion relationship, the magnification factor, and the tail constant includes: Using the magnification factor, amplifying the third component data quantization conversion relationship; The amplified third component data quantization conversion relationship is added to the tail constant to obtain the third component data conversion relationship, which satisfies the following relationship: V=(56*R-47*G-9*B+16448)>>7; Wherein, the Y represents brightness data, the R represents red channel data, the G represents green channel data, and the B represents blue channel data.
12. An image processing device, characterized in that: include: an acquisition module, configured to acquire first color-coded data of the image to be converted, wherein the first color-coded data includes first original component data, second original component data, and third original component data; a determining module configured to determine, for the first original component data and the third original component data included in the first color-coded data, first target channel data by adopting a first channel data conversion relationship of a second color code, wherein the first channel data conversion relationship is determined according to a first channel data quantization conversion relationship and a quantization coefficient, and the quantization coefficient is 6; The determining module is further configured to determine, for the first original component data, the second original component data, and the third original component data included in the first color-coded data, second target channel data by adopting a second channel data conversion relationship of the second color code, wherein the second channel data conversion relationship is determined according to a second channel data quantization conversion relationship and the quantization coefficient; The determining module is further configured to determine, for the first original component data and the second original component data included in the first color-coded data, third target channel data by adopting a third channel data conversion relationship of the second color code, wherein the third channel data conversion relationship is determined according to a third channel data quantization conversion relationship and the quantization coefficient; A conversion module is configured to generate a converted target image according to the first target channel data, the second target channel data, and the third target channel data.
13. The device according to claim 12, characterized in that The acquisition module is further configured to acquire the first channel data quantization conversion relationship before acquiring the first color coding data of the image to be converted; The acquisition module is further used to obtain the quantization conversion relationship of the second channel data; The acquisition module is further used to obtain the quantization conversion relationship of the third channel data; The determining module is further configured to determine a magnification factor according to the quantization coefficient, wherein the magnification factor is 2 raised to the Kth power, and K is the quantization coefficient; The acquisition module is further configured to acquire the first channel data conversion relationship according to the first channel data quantization conversion relationship and the magnification factor; The acquisition module is further configured to acquire the second channel data conversion relationship according to the second channel data quantization conversion relationship and the magnification factor; The acquisition module is further configured to acquire the third channel data conversion relationship according to the third channel data quantization conversion relationship and the magnification factor.
14. The device according to claim 13, characterized in that The acquisition module is specifically used to: The first channel data quantization conversion relationship is amplified by the amplification factor to obtain the first channel data conversion relationship, which satisfies the following relationship: R=74*(Y-16)+102*(V–128)>>6; Wherein, R represents red channel data, Y represents brightness data, and V represents concentration data; The acquisition module is specifically configured to amplify the second channel data quantization conversion relationship using the amplification factor to obtain the second channel data conversion relationship, where the second channel data conversion relationship satisfies the following relationship: G=74*(Y-16)–25*(V-128)–25*(U-128)>>6; Wherein, G represents green channel data, Y represents brightness data, V represents concentration data, and U represents chromaticity data; The acquisition module is specifically configured to amplify the third channel data quantization conversion relationship using the amplification factor to obtain the third channel data conversion relationship, where the third channel data conversion relationship satisfies the following relationship: B=74*(Y-16)+129*(U-128)>>6; Wherein, B represents blue channel data, Y represents brightness data, and U represents chrominance data.
15. The device according to claim 12, characterized in that The acquisition module is further configured to acquire the first channel data quantization conversion relationship before acquiring the first color coding data of the image to be converted; The acquisition module is further used to obtain the quantization conversion relationship of the second channel data; The acquisition module is further used to obtain the quantization conversion relationship of the third channel data; The determining module is further configured to determine a magnification factor and a tail constant according to the quantization coefficient, wherein the magnification factor is 2 to the Kth power, the tail constant is 2 to the (K-1)th power, and K is the quantization coefficient; The acquisition module is further configured to acquire the first channel data conversion relationship according to the first channel data quantization conversion relationship, the magnification factor, and the tail constant; The acquisition module is further configured to acquire the second channel data conversion relationship according to the second channel data quantization conversion relationship, the magnification factor, and the tail constant; The acquisition module is further configured to acquire the third channel data conversion relationship according to the third channel data quantization conversion relationship, the magnification factor, and the tail constant.
16. The device according to claim 15, characterized in that The acquisition module is specifically configured to amplify the first channel data quantization conversion relationship using the amplification factor; The amplified first channel data quantization conversion relationship is added to the tail constant to obtain the first channel data conversion relationship, which satisfies the following relationship: R=(74*(Y-16)+102*(V–128)+32)>>6; Wherein, R represents red channel data, Y represents brightness data, and V represents concentration data; The acquisition module is specifically configured to amplify the second channel data quantization conversion relationship using the amplification factor; The amplified second channel data quantization conversion relationship is added to the tail constant to obtain the second channel data conversion relationship, which satisfies the following relationship: G=(74*(Y-16)–25*(V-128)–25*(U-128)+32)>>6; Wherein, G represents green channel data, Y represents brightness data, V represents concentration data, and U represents chromaticity data; The acquisition module is specifically configured to amplify the third channel data quantization conversion relationship using the amplification factor; The amplified third channel data quantization conversion relationship is added to the tail constant to obtain the third channel data conversion relationship, which satisfies the following relationship: B=(74*(Y-16)+129*(U-128)+32)>>6; Wherein, B represents blue channel data, Y represents brightness data, and U represents chrominance data.
17. The device according to any one of claims 12 to 16, characterized in that Also included is a processing module; The acquisition module is specifically configured to acquire the image to be converted through an image acquisition device, wherein the image to be converted is an image in YUV format; and acquire the first color coding data according to the image to be converted; The processing module is used to, after generating the converted target image based on the first target channel data, the second target channel data and the third target channel data, beautify the target image if an image processing instruction is received; store the target image if an image storage instruction is received; and use the target image as a training sample for model training if an image training instruction is received.
18. An image processing device, characterized in that: include: an acquisition module, configured to acquire second color-coded data of the image to be converted, wherein the second color-coded data includes first original channel data, second original channel data, and third original channel data; a determining module, configured to determine, for the first original channel data, the second original channel data, and the third original channel data included in the second color-coded data, first target component data by adopting a first component data conversion relationship of the first color code, wherein the first component data conversion relationship is determined according to a first component data quantization conversion relationship and a quantization coefficient, and the quantization coefficient is 7; The determining module is further configured to determine, for the first original channel data, the second original channel data, and the third original channel data included in the second color-coded data, second target component data by adopting a second component data conversion relationship of the first color code, wherein the second component data conversion relationship is determined according to a second component data quantization conversion relationship and the quantization coefficient; The determining module is further configured to determine, for the first original channel data, the second original channel data, and the third original channel data included in the second color-coded data, third target component data by adopting a third component data conversion relationship of the first color code, wherein the third component data conversion relationship is determined according to a third component data quantization conversion relationship and the quantization coefficient; The conversion module is configured to generate a converted target image according to the first target component data, the second target component data, and the third target component data.
19. The device according to claim 18, characterized in that The acquisition module is further configured to acquire the quantitative conversion relationship of the first component data before acquiring the second color coding data of the image to be converted; The acquisition module is further configured to acquire the quantization conversion relationship of the second component data; The acquisition module is further configured to acquire the quantization conversion relationship of the third component data; The determining module is further configured to determine a magnification factor according to the quantization coefficient, wherein the magnification factor is 2 raised to the Kth power, and K is the quantization coefficient; The acquisition module is further configured to acquire the first component data conversion relationship according to the first component data quantization conversion relationship and the magnification factor; The acquisition module is further configured to acquire the second component data conversion relationship according to the second component data quantization conversion relationship and the magnification factor; The acquisition module is further configured to acquire the third component data conversion relationship according to the third component data quantization conversion relationship and the magnification factor.
20. The device according to claim 19, characterized in that The acquisition module is specifically configured to amplify the first component data quantization conversion relationship using the amplification factor to obtain the first component data conversion relationship, where the first component data conversion relationship satisfies the following relationship: Y=(32*R+65*G+13*B+2048)>>7; Wherein, the Y represents brightness data, the R represents red channel data, the G represents green channel data, and the B represents blue channel data; The acquisition module is specifically configured to amplify the second component data quantization conversion relationship using the amplification factor to obtain the second component data conversion relationship, where the second component data conversion relationship satisfies the following relationship: U=(-19*R-37*G+56*B+16384)>>7; Wherein, the U represents chromaticity data, the R represents red channel data, the G represents green channel data, and the B represents blue channel data; The acquisition module is specifically configured to amplify the third component data quantization conversion relationship using the amplification factor to obtain the third component data conversion relationship, where the third component data conversion relationship satisfies the following relationship: V=(56*R-47*G-9*B+16384)>>7; Wherein, the V represents concentration data, the R represents red channel data, the G represents green channel data, and the B represents blue channel data.
21. The device according to claim 18, characterized in that The acquisition module is further configured to acquire the quantitative conversion relationship of the first component data before acquiring the second color coding data of the image to be converted; The acquisition module is further configured to acquire the quantization conversion relationship of the second component data; The acquisition module is further configured to acquire the quantization conversion relationship of the third component data; The determining module is further configured to determine a magnification factor and a tail constant according to the quantization coefficient, wherein the magnification factor is 2 to the Kth power, the tail constant is 2 to the (K-1)th power, and K is the quantization coefficient; The acquisition module is further configured to acquire the first component data conversion relationship according to the first component data quantization conversion relationship, the magnification factor, and the tail constant; The acquisition module is further configured to acquire the second component data conversion relationship according to the second component data quantization conversion relationship, the magnification factor, and the tail constant; The acquisition module is further configured to acquire the third component data conversion relationship according to the third component data quantization conversion relationship, the magnification factor, and the tail constant.
22. The device according to claim 21, characterized in that The acquisition module is specifically configured to use the magnification factor to amplify the first component data quantization conversion relationship; The amplified first component data quantization conversion relationship is added to the tail constant to obtain the first component data conversion relationship, which satisfies the following relationship: Y=(32*R+65*G+13*B+2112)>>7; Wherein, the Y represents brightness data, the R represents red channel data, the G represents green channel data, and the B represents blue channel data; The acquisition module is specifically configured to amplify the second component data quantization conversion relationship using the amplification factor; The amplified second component data quantization conversion relationship is added to the tail constant to obtain the second component data conversion relationship, which satisfies the following relationship: U=(-19*R-37*G+56*B+16448)>>7; Wherein, the Y represents brightness data, the R represents red channel data, the G represents green channel data, and the B represents blue channel data; The acquisition module is specifically configured to use the magnification factor to amplify the quantization conversion relationship of the third component data; The amplified third component data quantization conversion relationship is added to the tail constant to obtain the third component data conversion relationship, which satisfies the following relationship: V=(56*R-47*G-9*B+16448)>>7; Wherein, the Y represents brightness data, the R represents red channel data, the G represents green channel data, and the B represents blue channel data.
23. A computer device, characterized in that: include: Memory, processor, and bus system; Wherein, the memory is used to store programs; The processor is configured to execute the program in the memory, and the processor is configured to execute the method according to any one of claims 1 to 6 according to instructions in the program code, or execute the method according to any one of claims 7 to 11; The bus system is used to connect the memory and the processor so that the memory and the processor can communicate with each other.
24. A computer-readable storage medium comprising instructions, which, when executed on a computer, causes the computer to execute the method according to any one of claims 1 to 6, or the method according to any one of claims 7 to 11.
25. A computer program product, characterized in that The method comprises computer instructions, which are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method of any one of claims 1 to 6, or executes the method of any one of claims 7 to 11.
Citation Information
Patent Citations
Image saturation adjusting method and device, storage medium and terminal
CN109741279A
Methods and systems for improved image encoding
CN112385225A