CN116957933A - Image processing method, apparatus and computer readable storage medium - Google Patents

Image processing method, apparatus and computer readable storage medium Download PDF

Info

Publication number
CN116957933A
CN116957933A CN202310896611.8A CN202310896611A CN116957933A CN 116957933 A CN116957933 A CN 116957933A CN 202310896611 A CN202310896611 A CN 202310896611A CN 116957933 A CN116957933 A CN 116957933A
Authority
CN
China
Prior art keywords
picture
region
transparency
color
pixel
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310896611.8A
Other languages
Chinese (zh)
Inventor
王剑
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202310896611.8A priority Critical patent/CN116957933A/en
Publication of CN116957933A publication Critical patent/CN116957933A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformation in the plane of the image
    • G06T3/40Scaling the whole image or part thereof
    • G06T3/4038Scaling the whole image or part thereof for image mosaicing, i.e. plane images composed of plane sub-images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2200/00Indexing scheme for image data processing or generation, in general
    • G06T2200/32Indexing scheme for image data processing or generation, in general involving image mosaicing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10016Video; Image sequence

Abstract

The present disclosure provides an image processing method, apparatus, and storage medium. The method comprises the following steps: acquiring a picture to be processed; generating a color picture and a transparency picture corresponding to a picture to be processed, wherein the picture to be processed, the color picture and the transparency picture; uniformly dividing the transparency picture into three region pictures; respectively distributing the transparency channel values of the pixels of each region picture of the transparency pictures to three color channels of the corresponding pixels of the specific region picture in the three region pictures; and splicing the color picture and the specific area picture, and generating a video without a transparency channel based on the spliced picture. By the scheme, the compression efficiency of the picture can be improved.

Description

Image processing method, apparatus and computer readable storage medium
Technical Field
The present disclosure relates to the field of image processing technology, and in particular, to a method, an apparatus, and a computer readable storage medium for image processing.
Background
Special effects technology is widely used in the current internet and other software scenarios. In order to save the pressure of real-time calculation of the special effects, a mainstream processing scheme is to pre-render the special effects into a picture format, and when the special effects need to be rendered, the picture is directly displayed. For dynamic special effects, the pictures used are typically a set of picture sequence frame resources, namely: a special effect description depends on a plurality of pictures, and is played frame by frame according to time sequence. Because of the independent storage between each frame of pictures, a large occupation exists on the storage volume. In view of the above-mentioned drawbacks of picture sequence frames, it is common in the industry to compress picture sequence frames into a video format. Typically, the picture sequence frames are in PNG format, while the video is typically in MP4 format.
The PNG format picture storage technology can store four channels of data information, namely RGBA, where RGB (Red, green, blue) is color information and a (Alpha) is transparency information. And the data stored in the MP4 video format adopts YUV coding, and after being converted by a color algorithm, the data information of three channels can only be obtained, namely, only RGB colors and no Alpha transparency information are available. In the conversion method of the related art, it is necessary to generate a new picture by stitching and discard a part of transparency to generate a video, and in the above scheme, all channels of the picture for storing transparency information store the same information, there is a case that an image area is wasted. Whether the converted video is finally displayed as texture or stored as video file, there is a problem that the parsed texture is wasted in memory occupation and the space occupied by the video file disk may have an optimized space.
Disclosure of Invention
The present disclosure provides an image processing method, apparatus, and computer-readable storage medium to solve at least the problems in the related art.
According to a first aspect of the present disclosure, there is provided an image processing method including: acquiring a picture to be processed; generating a color picture and a transparency picture corresponding to the picture to be processed, wherein the picture to be processed, the color picture and the transparency picture comprise three color channels and one transparency channel, the color picture and the picture to be processed are the same in size, each pixel of the color picture and each pixel of the transparency picture are respectively in one-to-one correspondence with each pixel of the picture to be processed, each pixel of the color picture has the same color channel value and a preset transparency channel value as the corresponding pixel of the picture to be processed, and the values of all channels of each pixel of the transparency picture are the same as the transparency channel value of the corresponding pixel of the picture to be processed; uniformly dividing the transparency picture into three region pictures; respectively allocating the values of the transparency channels of the pixels of each region picture of the transparency pictures to three color channels of the corresponding pixels of the specific region pictures in the three region pictures, wherein the positions of the corresponding pixels of the specific region pictures in the specific region pictures and the positions of the pixels of each region picture in the specific region pictures meet a one-to-one correspondence, and the specific region picture is any one region picture in the three region pictures; and splicing the color picture and the specific area picture, and generating a video without a transparency channel based on the spliced picture.
Optionally, uniformly dividing the transparency picture into three region pictures includes: and uniformly dividing the transparency picture into three region pictures according to the horizontal direction or the vertical direction.
Optionally, uniformly dividing the transparency picture into three region pictures includes: and uniformly dividing the transparency picture into a left region picture, a middle region picture and a right region picture according to the direction of the transparency picture from left to right or from right to left, wherein the specific region picture is any one region picture among the left region picture, the middle region picture and the right region picture.
Optionally, uniformly dividing the transparency picture into three region pictures includes: and uniformly dividing the transparency picture into an upper region picture, a middle region picture and a lower region picture according to the direction from the upper part to the lower part or from the lower part to the upper part of the transparency picture, wherein the specific region picture is any one region picture among the upper region picture, the middle region picture and the lower region picture.
Optionally, the position of the corresponding pixel of the specific region picture in the specific region picture is the same as the position of the pixel of each region picture in each region picture.
Optionally, the picture to be processed is a picture adopting RGBA color space, and the video is a video adopting YUV color space.
Optionally, assigning the transparency channel value of the pixel of each region picture of the transparency pictures to three color channels of the pixel of the corresponding position of the specific region picture in the three region pictures respectively includes: assigning a value of any color channel or transparency channel of a pixel of a first region among three regions divided by the transparency picture to the first color channel of the pixel of the corresponding position of the specific region picture; assigning a value of any color channel or transparency channel of a pixel of a second region of the three regions divided by the transparency picture to the second color channel of the pixel of the corresponding position of the specific region picture; and assigning any color channel of pixels of a third region of the three regions divided by the transparency picture or a value of the transparency channel to the third color channel of the pixels of the corresponding position of the specific region picture.
According to a second aspect of the present disclosure, there is provided a picture processing apparatus including: a picture acquisition unit configured to acquire a picture to be processed; a first picture generation unit configured to generate a color picture and a transparency picture corresponding to the to-be-processed picture from the to-be-processed picture, wherein the to-be-processed picture, the color picture and the transparency picture each include three color channels and one transparency channel, the color picture is the same as the to-be-processed picture in size, each pixel in the color picture and each pixel in the transparency picture are respectively in one-to-one correspondence with each pixel of the to-be-processed picture, and have the same color channel value and preset transparency channel value as the corresponding pixel of the to-be-processed picture, and the values of all channels of each pixel are the same as the transparency channel value of the corresponding pixel of the to-be-processed picture; a picture dividing unit configured to uniformly divide the transparency picture into three region pictures; a second picture generation unit configured to allocate values of transparency channels of pixels of each region picture of the transparency pictures to three color channels of corresponding pixels of a specific region picture among the three region pictures, respectively, a position of the corresponding pixels of the specific region picture in the specific region picture and a position of the pixels of each region picture in each region picture satisfying a one-to-one correspondence relationship, the specific region picture being any one of the three region pictures; and a video generation unit configured to splice the color picture and the specific region picture, and generate a video without a transparency channel based on the spliced picture.
Optionally, the picture dividing unit is configured to: and uniformly dividing the transparency picture into three region pictures according to the horizontal direction or the vertical direction.
Optionally, the picture dividing unit is configured to: and uniformly dividing the transparency picture into a left region picture, a middle region picture and a right region picture according to the direction of the transparency picture from left to right or from right to left, wherein the specific region picture is any one region picture among the left region picture, the middle region picture and the right region picture.
Optionally, the picture dividing unit is configured to divide the transparency picture into an upper region picture, a middle region picture and a lower region picture uniformly according to a direction from the upper portion to the lower portion or from the lower portion to the upper portion of the transparency picture, and the specific region picture is any one of the upper region picture, the middle region picture and the lower region picture.
Optionally, the second picture generation unit is configured to: assigning a value of any color channel or transparency channel of a pixel of a first region among three regions divided by the transparency picture to the first color channel of the pixel of the corresponding position of the specific region picture; assigning a value of any color channel or transparency channel of a pixel of a second region of the three regions divided by the transparency picture to the second color channel of the pixel of the corresponding position of the specific region picture; and assigning any color channel of pixels of a third region of the three regions divided by the transparency picture or a value of the transparency channel to the third color channel of the pixels of the corresponding position of the specific region picture.
Optionally, the position of the corresponding pixel of the specific region picture in the specific region picture is the same as the position of the pixel of each region picture in each region picture.
Optionally, the picture to be processed is a picture adopting RGBA color space, and the video is a video adopting YUV color space.
According to a third aspect of the present disclosure, there is provided an electronic device comprising: at least one processor; at least one memory storing computer-executable instructions, wherein the computer-executable instructions, when executed by the at least one processor, cause the at least one processor to perform a method of processing a picture as described above.
According to a fourth aspect of the present disclosure, there is provided a computer readable storage medium, which when executed by a processor of an electronic device, causes the electronic device to perform the method of processing a picture as described above.
According to a fifth aspect of the present disclosure, there is provided a computer program product, instructions in which are executed by at least one processor in an electronic device to perform a method of processing a picture as described above.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects: the pixel area used when the picture sequence is converted into video is optimized, so that the memory used when the video is generated by conversion is reduced, and the disk space and decoding speed of the converted video file can be optimized.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure and do not constitute an undue limitation on the disclosure.
Fig. 1 is a device environment illustrating an application of a method of processing a picture according to an exemplary embodiment of the present disclosure.
Fig. 2 is a flowchart illustrating a method of processing a picture according to an exemplary embodiment of the present disclosure.
Fig. 3A is a schematic diagram showing a related art process of generating video from RGBA pictures.
Fig. 3B is a schematic diagram illustrating a process of generating video from RGBA pictures according to an exemplary embodiment of the present disclosure.
Fig. 4 is a block diagram illustrating an apparatus for processing a picture according to an exemplary embodiment of the present disclosure.
Fig. 5 is a block diagram illustrating an electronic device according to an exemplary embodiment of the present disclosure.
Detailed Description
In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the foregoing figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the disclosure described herein may be capable of operation in sequences other than those illustrated or described herein. The embodiments described in the examples below are not representative of all embodiments consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as detailed in the accompanying claims.
It should be noted that, in this disclosure, "at least one of the items" refers to a case where three types of juxtaposition including "any one of the items", "a combination of any of the items", "an entirety of the items" are included. For example, "including at least one of a and B" includes three cases side by side as follows: (1) comprises A; (2) comprising B; (3) includes A and B. For example, "at least one of the first and second steps is executed", that is, three cases are juxtaposed as follows: (1) performing step one; (2) executing the second step; (3) executing the first step and the second step.
Fig. 1 illustrates a system environment to which a method of processing a picture according to an exemplary embodiment of the present disclosure is applied. As shown in fig. 1, the system environment may include a plurality of terminal apparatuses 100-1, 100-2, … 100-n, a server 200. Here, the terminal device 100 may be a terminal device having a communication function and an image processing function, and for example, the terminal device 100 in the embodiment of the present disclosure may be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, a netbook, a personal digital assistant (personal digital assistant, PDA), an augmented reality (augmented reality, AR)/Virtual Reality (VR) device. Various applications using the image processing function, such as an internet browsing application, a short video application, a live application, a social application, etc., may be run on the terminal device 100. The terminal device 100 connects and communicates with the server 200 through a network when running these applications and using the camera function, thereby using the corresponding services provided by the server 200. In running the application, the terminal device 100 may perform a method of processing a picture according to an exemplary embodiment of the present disclosure when rendering a special effect, for example. A method of processing a picture according to an exemplary embodiment of the present disclosure will be described in detail below with reference to fig. 2 and fig. 3A and 3B.
Fig. 2 is a flowchart illustrating a method of processing a picture according to an exemplary embodiment of the present disclosure.
First, in step S201, a picture to be processed is acquired. The picture to be processed here is a picture that needs to be processed. According to an exemplary embodiment of the present disclosure, the picture to be processed here may be a picture employing an RGBA color space. For example, the pictures to be processed may be a series of PNG formatted pictures for special effect rendering, while the final objective is to compress the series of PNG formatted pictures to generate video. Here, the video may be video employing YUV color space (e.g., video in MP4 format). The picture to be processed may be acquired from a locally stored picture resource library (e.g., a picture stored in the terminal device 100), or may be acquired through a remote device connected to the terminal device 100 via a network, without limitation.
Next, in step S203, a color picture and a transparency picture corresponding to the picture to be processed are generated. Here, the to-be-processed picture, the color picture and the transparency picture each include three color channels and one transparency channel, the color picture is the same as the to-be-processed picture in size, each pixel of the color picture and each pixel of the transparency picture are in one-to-one correspondence with each pixel of the to-be-processed picture, each pixel of the color picture has the same color channel value and a specific transparency channel value as the corresponding pixel of the to-be-processed picture, and the values of all channels of each pixel of the transparency picture are the same as the transparency channel value of the corresponding pixel of the to-be-processed picture.
Specifically, RGBA format representation colors used for pictures to be processed according to exemplary embodiments of the present disclosure generally have three numerical morphologies: 1. in hexadecimal form, eight-bit hexadecimal values are used, and each two bits respectively represent the values of RGBA, for example, the value 32 corresponding to the R channel, the value 96 corresponding to the G channel and the value DC corresponding to the B channel in #3296DCA 1. The color channel value 00 tends to be the weakest color, while FF tends to be the strongest color. # FFFFFF is the strongest of all colors, i.e. white (transparency is not considered here), and# 000000 is the weakest of all colors, i.e. black; 2. the principle of the decimal morphology is the same as that of the hexadecimal morphology method, but the hexadecimal is converted into decimal, namely the value range of each color is 0-255; 3. floating point number color, the principle is the same as the above method, normalize the color range to 0-1,0 is the lightest color, and 1 is the darkest color. Unless otherwise indicated, the colors mentioned below are all expressed in decimal form, but those skilled in the art will recognize that whatever binary expression is used does not affect the contents of the solution.
In the related art scheme, the PNG format picture storage technology may store four channels of data information, namely RGBA, where RGB (Red, green, blue) is color information and a (Alpha) is transparency information. And the data stored in the MP4 video format adopts YUV coding, and only three channels of data information can be obtained after the data is converted by a color algorithm, namely, the data only has RGB colors and no Alpha transparency information.
In order to solve the problem that MP4 format video has no transparency information, four-channel content of a picture needs to be converted into two pictures in PNG format, which are called RGB part picture and Alpha part picture respectively. The RGB part picture carries information of an RGB part of the original picture, that is, a value of an RGB channel of the RGB part picture is identical to a value of an RGB channel of the original picture, but the Alpha channel has a preset transparency channel value, which is, for example, constant to 255, that is, completely opaque. The Alpha part picture carries Alpha information of the original picture, and the specific method is that the values of four channels of the Alpha part picture are all set as the values of the Alpha channels of the original picture. As shown in fig. 3A, an original picture, a picture from which RGB parts are peeled off, and an image of Alpha part are respectively shown.
Taking the numerical form of a single pixel point as an example, assume that four channels of RGB of the color value of one pixel in the original picture are (R: 50, G:150, B:220, A: 230), respectively. The color is a slightly transparent sky blue. The four-channel color values of the pixel points of the RGB partial picture corresponding to the pixel points are (R: 50, G:150, B:220, A: 255), and the values of the RGB channels of the pixel points of the original image are the same except that the A channel becomes the full value 255; the four-channel color values of the pixel points of the Alpha partial picture corresponding to the pixel points are (R: 230, G:230, B:230, A: 230), that is, the color values of all channels are Alpha values of the pixel points of the original picture.
After the two graphs are obtained through the method, the two graphs are spliced into one graph (which can be left and right or up and down or in a more complex format). All PNG picture frame sequences for special effects are converted into the spliced picture form. Finally, such doubled-sized sequence frames are compressed into video according to a predetermined video coding method (e.g., MPEG4 coding, HEVC coding, etc.) to facilitate subsequent special effect rendering, i.e., to play a role in compressing pictures for special effects.
However, in the above scheme, there is a case where the picture area is wasted. In the Alpha part picture, the R, G, B, A four channels all store the same value, namely, the value of the original Alpha channel. The structure wastes storage space no matter the storage file is finally displayed as texture or MP4 format, the space occupied by the texture memory after analysis is wasted, and the space occupied by the file disk may be optimized.
For this reason, the method according to the exemplary embodiment of the present disclosure uniformly divides the transparency picture (i.e., the Alpha portion picture) into three region pictures in step S205 on the basis of the Alpha portion picture employed as described above. Here, the position of the corresponding pixel of the specific region picture in the specific region picture and the position of the pixel of each region picture in each region picture satisfy a one-to-one correspondence relationship. According to an exemplary embodiment of the present disclosure, the specific region picture may be any one of three region pictures. Specifically, since the transparency picture is uniformly divided into three region pictures, each region picture includes the same number of pixels, and thus a one-to-one correspondence between pixels in the three region pictures can be established. According to an exemplary embodiment of the present disclosure, correspondence between pixels may be established according to positions of pixel points. For example, three pixels in the three pictures that are in the same position (e.g., the first row and first column in the pictures) may become corresponding position pixels. It should be understood that the pixels at the corresponding positions are not limited to the pixels at the same position, but may be pixels at different positions, which is not limited herein.
According to an exemplary embodiment of the present disclosure, in step S205, the transparency picture may be uniformly divided into three region pictures in a horizontal direction or a vertical direction.
According to an exemplary embodiment of the present disclosure, the transparency picture may be uniformly divided into a left region picture, a middle region picture, and a right region picture according to a direction of the transparency picture from left to right or from right to left, wherein the specific region picture is any one of the left region picture, the middle region picture, and the right region picture. According to an exemplary embodiment of the present disclosure, the transparency picture may be uniformly divided into an upper region picture, a middle region picture, and a lower region picture according to a direction of the transparency picture from the upper portion to the lower portion or from the lower portion to the upper portion, wherein the specific region picture is any one of the upper region picture, the middle region picture, and the lower region picture. It should be understood that the division manner of the pictures is not limited thereto, and transparency pictures may be uniformly divided in other manners.
Then, in step S207, the values of the transparency channels of the pixels of the transparency picture are respectively assigned to the three color channels of the corresponding pixels of the specific region picture among the three region pictures.
For example, as shown in fig. 3B, the original Alpha partial picture is equally divided into three region pictures from left to right, each of which has an equal area and number of pixels, respectively referred to as left, middle and right partial region pictures. It should be understood that the division is not limited to the manner shown in fig. 3B, as long as the three regions are guaranteed to be equal in size and shape and/or have a one-to-one correspondence with pixels. For example, three region pictures can be obtained by dividing the region pictures into three equal parts. Since one pixel contains three channels of RGB (to be finally converted into video format, alpha channel will be discarded), we split the information contained in the transparency picture into three halves, then either one color channel of the pixel of the first region of the three regions divided by the transparency picture or the value of the transparency channel can be assigned to the first color channel of the corresponding pixel of the specific region picture (hereinafter also referred to as new transparent region), either one color channel of the pixel of the second region of the three regions divided by the transparency picture or the value of the transparency channel is assigned to the second color channel of the corresponding pixel of the specific region picture, and either one color channel of the pixel of the third region of the three regions divided by the transparency picture or the value of the transparency channel is assigned to the third color channel of the corresponding pixel of the specific region picture.
For example, the R channel value of the first row and first column pixels of the left partial region may be assigned to the R channel of the corresponding pixels of the new transparent region, the G channel value of the pixels of the middle partial region may be assigned to the G channel of the corresponding pixels of the new transparent region, and the B channel value of the pixels of the right partial region may be assigned to the B channel of the corresponding pixels of the new transparent region. Note that the values of the R channel of the left partial region, the G channel of the middle region, and the B channel of the right partial region are not necessarily used here as above to be respectively allocated to the RGB channels of the corresponding pixels of the new transparent region, but the values of any one of the three regions may be used. This is because the values of the R, G, B channels of the original transparent picture are identical (all are the Alpha channels of the original picture), and the values of any one of the channels can be used. By the method, a transparent picture with the same information quantity as the original information quantity but only one third of the original size of the pixel quantity can be obtained. As shown by the new transparency picture indicated by 345 in fig. 3B, the area of the picture is one third of the original transparency portion picture 340 in fig. 3A of the related art, and also contains information of the transparency of the other two areas.
Next, in step S209, the color picture and the specific region picture are spliced, and a video having no transparency channel is generated based on the spliced picture. In converting a picture to video, the values of Alpha channels of the color picture and transparency picture will be discarded. Compared with the scheme of the related art, the scheme of the invention uses two pictures with the same size as the original pictures to be spliced and converted, and the scheme of the exemplary embodiment of the invention can use smaller spliced pictures to be converted, so that the memory used in conversion can be saved, and the scheme has obvious help to improve the efficiency of compressing the pictures. Specifically, assuming that the pixel area of the original PNG picture is a, the scheme according to the exemplary embodiment of the present disclosure may use only 4/3A of the video pixel area with respect to the related art scheme using 2A of the video pixel area, and thus has a size optimization of 33%.
It should be appreciated that the size of the original transparency picture is not limited to the same size as the original picture, but the scheme of compressing the picture according to the exemplary embodiment of the present disclosure can achieve the effect of reducing the video pixel area, regardless of the size of the transparency picture used, so that the memory used for compression conversion can be saved. In addition, there is also some optimization of disk space occupied by the generated video and decoding speed.
Fig. 4 is a block diagram illustrating an apparatus for processing a picture according to an exemplary embodiment of the present disclosure.
As shown in fig. 4, an apparatus 400 for compressing a picture according to an exemplary embodiment of the present disclosure includes a picture acquisition unit 410, a first picture generation unit 420, a picture division unit 430, a second picture generation unit 440, and a video generation unit 450. It should be understood that the individual units of the device may be combined into fewer units or further divided into more units.
The picture acquisition unit 410 is configured to acquire a picture to be processed. According to an exemplary embodiment of the present disclosure, the picture to be processed here may be a picture employing an RGBA color space. For example, the pictures to be processed may be a series of PNG formatted pictures for special effect rendering, while the final objective is to compress the series of PNG formatted pictures to generate video. Here, the video may be video employing YUV color space (e.g., video in MP4 format).
The first picture generation unit 420 is configured to generate a color picture and a transparency picture corresponding to a picture to be processed. Here, the to-be-processed picture, the color picture and the transparency picture each include three color channels and one transparency channel, the color picture is the same as the to-be-processed picture in size, each pixel of the color picture and each pixel of the transparency picture are in one-to-one correspondence with each pixel of the to-be-processed picture, each pixel of the color picture has the same color channel value and preset transparency channel value as the corresponding pixel of the to-be-processed picture, and the values of all channels of each pixel of the transparency picture are the same as the transparency channel value of the corresponding pixel of the to-be-processed picture.
The picture dividing unit 430 is configured to uniformly divide the transparency picture into three region pictures. According to an exemplary embodiment of the present disclosure, the picture dividing unit 430 may be configured to uniformly divide the transparency picture into three region pictures in a horizontal direction or a vertical direction.
The picture dividing unit 430 may be configured to uniformly divide the transparency picture into a left region picture, a middle region picture, and a right region picture according to a direction of the transparency picture from left to right or from right to left, wherein the specific region picture is any one of the left region picture, the middle region picture, and the right region picture.
According to an exemplary embodiment of the present disclosure, the picture dividing unit 430 may be configured to uniformly divide the transparency picture into an upper region picture, a middle region picture, and a lower region picture according to a direction of the transparency picture from the upper portion to the lower portion or from the lower portion to the upper portion, wherein the specific region picture is any one of the upper region picture, the middle region picture, and the lower region picture. It should be understood that the division manner of the pictures is not limited thereto, and transparency pictures may be uniformly divided in other manners.
The second picture generation unit 440 is configured to allocate values of transparency channels of pixels of the transparency pictures to three color channels of corresponding pixels of a specific region picture among the three region pictures, respectively, wherein a one-to-one correspondence relationship is satisfied between a position of the corresponding pixel of the specific region picture in the specific region picture and a position of the pixel of each region picture in each region picture, wherein the specific region picture may be any one of the three region pictures. According to an exemplary embodiment of the present disclosure, optionally, a position of a corresponding pixel of the specific region picture in the specific region picture may be the same as a position of a pixel of each region picture in each region picture.
The video generation unit 450 is configured to splice together color pictures and specific region pictures, and generate a video without a transparency channel based on the spliced pictures.
According to an exemplary embodiment of the present disclosure, the picture to be processed is a picture employing RGBA color space, and the video is a video employing YUV color space.
According to an exemplary embodiment of the present disclosure, the second picture generation unit 440 may be configured to:
Assigning any color channel of pixels of a first region of the three regions divided by the transparency picture or a value of the transparency channel to the first color channel of the pixels of the corresponding position of the specific region picture; assigning a value of any color channel or transparency channel of a pixel of a second region of the three regions divided by the transparency picture to the second color channel of the corresponding pixel of the specific region picture; and assigning any color channel of pixels of a third region of the three regions divided by the transparency picture or a value of the transparency channel to the third color channel of the corresponding pixels of the specific region picture.
Operations performed by the respective units of the apparatus have been described above with reference to fig. 2 to 3, and will not be repeated here.
Fig. 5 is a block diagram illustrating a structure of an electronic device 500 for processing pictures according to an exemplary embodiment of the present disclosure. The electronic device 500 may be, for example: a smart phone, a tablet computer, an MP3 player (Moving PictureExperts Group Audio Layer III, motion picture expert compression standard audio plane 3), an MP4 (MovingPicture Experts Group Audio Layer IV, motion picture expert compression standard audio plane 4) player, a notebook computer, or a desktop computer. Electronic device 500 may also be referred to by other names of user devices, portable terminals, laptop terminals, desktop terminals, and the like.
Generally, the electronic device 500 includes: a processor 501 and a memory 502.
Processor 501 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The processor 501 may be implemented in at least one hardware form of DSP (Digital Signal Processing ), FPGA (FieldProgrammable Gate Array, field programmable gate array), PLA (Programmable Logic Array ). The processor 501 may also include a main processor and a coprocessor, the main processor being a processor for processing data in an awake state, also referred to as a CPU (Central ProcessingUnit ); a coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 501 may integrate a GPU (Graphics Processing Unit, image processor) for rendering and drawing of content required to be displayed by the display screen. In some embodiments, the processor 501 may also include an AI (Artificial Intelligence ) processor for processing computing operations related to machine learning.
Memory 502 may include one or more computer-readable storage media, which may be non-transitory. Memory 502 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in memory 502 is used to store at least one instruction for execution by processor 501 to implement the image processing method of the present disclosure as shown in fig. 2.
In some embodiments, the electronic device 500 may further optionally include: a peripheral interface 503 and at least one peripheral. The processor 501, memory 502, and peripheral interface 503 may be connected by buses or signal lines. The individual peripheral devices may be connected to the peripheral device interface 503 by buses, signal lines or circuit boards. Specifically, the peripheral device includes: at least one of radio frequency circuitry 504, touch display 505, camera 506, audio circuitry 507, positioning component 508, and power supply 509.
Peripheral interface 503 may be used to connect at least one Input/Output (I/O) related peripheral to processor 501 and memory 502. In some embodiments, processor 501, memory 502, and peripheral interface 503 are integrated on the same chip or circuit board; in some other embodiments, either or both of the processor 501, memory 502, and peripheral interface 503 may be implemented on separate chips or circuit boards, which is not limited in this embodiment.
The Radio Frequency circuit 504 is configured to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuitry 504 communicates with a communication network and other communication devices via electromagnetic signals. The radio frequency circuit 504 converts an electrical signal into an electromagnetic signal for transmission, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 504 includes: antenna systems, RF transceivers, one or more amplifiers, tuners, oscillators, digital signal processors, codec chipsets, subscriber identity module cards, and so forth. The radio frequency circuitry 504 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: metropolitan area networks, various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and/or WiFi (Wireless Fidelity ) networks. In some embodiments, the radio frequency circuitry 504 may also include NFC (Near Field Communication, short range wireless communication) related circuitry, which is not limited by the present disclosure.
The display 505 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display 505 is a touch display, the display 505 also has the ability to collect touch signals at or above the surface of the display 505. The touch signal may be input as a control signal to the processor 501 for processing. At this time, the display 505 may also be used to provide virtual buttons and/or virtual keyboards, also referred to as soft buttons and/or soft keyboards. In some embodiments, the display 505 may be one, disposed on the front panel of the electronic device 500; in other embodiments, the display 505 may be at least two, respectively disposed on different surfaces of the terminal 500 or in a folded design; in still other embodiments, the display 505 may be a flexible display disposed on a curved surface or a folded surface of the terminal 500. Even more, the display 505 may be arranged in a non-rectangular irregular pattern, i.e., a shaped screen. The display 505 may be made of LCD (LiquidCrystal Display ), OLED (Organic Light-Emitting Diode) or other materials.
The camera assembly 506 is used to capture images or video. Optionally, the camera assembly 506 includes a front camera and a rear camera. Typically, the front camera is disposed on the front panel of the terminal and the rear camera is disposed on the rear surface of the terminal. In some embodiments, the at least two rear cameras are any one of a main camera, a depth camera, a wide-angle camera and a tele camera, so as to realize that the main camera and the depth camera are fused to realize a background blurring function, and the main camera and the wide-angle camera are fused to realize a panoramic shooting and Virtual Reality (VR) shooting function or other fusion shooting functions. In some embodiments, camera assembly 506 may also include a flash. The flash lamp can be a single-color temperature flash lamp or a double-color temperature flash lamp. The dual-color temperature flash lamp refers to a combination of a warm light flash lamp and a cold light flash lamp, and can be used for light compensation under different color temperatures.
The audio circuitry 507 may include a microphone and a speaker. The microphone is used for collecting sound waves of users and environments, converting the sound waves into electric signals, and inputting the electric signals to the processor 501 for processing, or inputting the electric signals to the radio frequency circuit 504 for voice communication. For the purpose of stereo acquisition or noise reduction, a plurality of microphones may be respectively disposed at different portions of the terminal 500. The microphone may also be an array microphone or an omni-directional pickup microphone. The speaker is used to convert electrical signals from the processor 501 or the radio frequency circuit 504 into sound waves. The speaker may be a conventional thin film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, not only the electric signal can be converted into a sound wave audible to humans, but also the electric signal can be converted into a sound wave inaudible to humans for ranging and other purposes. In some embodiments, audio circuitry 507 may also include a headphone jack.
The location component 508 is used to locate the current geographic location of the electronic device 500 to enable navigation or LBS (LocationBased Service, location-based services). The positioning component 508 may be a positioning component based on the United states GPS (GlobalPositioning System ), the Beidou system of China, the Granati system of Russia, or the Galileo system of the European Union.
The power supply 509 is used to power the various components in the electronic device 500. The power supply 509 may be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 509 comprises a rechargeable battery, the rechargeable battery may support wired or wireless charging. The rechargeable battery may also be used to support fast charge technology.
In some embodiments, the electronic device 500 further includes one or more sensors 510. The one or more sensors 510 include, but are not limited to: an acceleration sensor 511, a gyro sensor 512, a pressure sensor 513, a fingerprint sensor 514, an optical sensor 515, and a proximity sensor 516.
The acceleration sensor 511 can detect the magnitudes of accelerations on three coordinate axes of the coordinate system established with the terminal 500. For example, the acceleration sensor 511 may be used to detect components of gravitational acceleration on three coordinate axes. The processor 501 may control the touch display 505 to display a user interface in a landscape view or a portrait view according to a gravitational acceleration signal acquired by the acceleration sensor 511. The acceleration sensor 511 may also be used for acquisition of motion data of a game or a user.
The gyro sensor 512 may detect a body direction and a rotation angle of the terminal 500, and the gyro sensor 512 may collect a 3D motion of the user to the terminal 500 in cooperation with the acceleration sensor 511. The processor 501 may implement the following functions based on the data collected by the gyro sensor 512: motion sensing (e.g., changing UI according to a tilting operation by a user), image stabilization at shooting, game control, and inertial navigation.
The pressure sensor 513 may be disposed at a side frame of the terminal 500 and/or at a lower layer of the touch display 505. When the pressure sensor 513 is disposed at a side frame of the terminal 500, a grip signal of the user to the terminal 500 may be detected, and the processor 501 performs left-right hand recognition or quick operation according to the grip signal collected by the pressure sensor 513. When the pressure sensor 513 is disposed at the lower layer of the touch display screen 505, the processor 501 controls the operability control on the UI according to the pressure operation of the user on the touch display screen 505. The operability controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.
The fingerprint sensor 514 is used for collecting the fingerprint of the user, and the processor 501 identifies the identity of the user according to the fingerprint collected by the fingerprint sensor 514, or the fingerprint sensor 514 identifies the identity of the user according to the collected fingerprint. Upon recognizing that the user's identity is a trusted identity, the user is authorized by the processor 501 to perform relevant sensitive operations including unlocking the screen, viewing encrypted information, downloading software, paying for and changing settings, etc. The fingerprint sensor 514 may be provided on the front, back or side of the electronic device 500. When a physical key or vendor Logo is provided on the electronic device 500, the fingerprint sensor 514 may be integrated with the physical key or vendor Logo.
The optical sensor 515 is used to collect the ambient light intensity. In one embodiment, the processor 501 may control the display brightness of the touch screen 505 based on the ambient light intensity collected by the optical sensor 515. Specifically, when the intensity of the ambient light is high, the display brightness of the touch display screen 505 is turned up; when the ambient light intensity is low, the display brightness of the touch display screen 505 is turned down. In another embodiment, the processor 501 may also dynamically adjust the shooting parameters of the camera assembly 506 based on the ambient light intensity collected by the optical sensor 515.
A proximity sensor 516, also referred to as a distance sensor, is typically provided on the front panel of the electronic device 500. The proximity sensor 516 is used to collect the distance between the user and the front of the electronic device 500. In one embodiment, when the proximity sensor 516 detects that the distance between the user and the front of the terminal 500 gradually decreases, the processor 501 controls the touch display 505 to switch from the bright screen state to the off screen state; when the proximity sensor 516 detects that the distance between the user and the front surface of the electronic device 500 gradually increases, the processor 501 controls the touch display screen 505 to switch from the off-screen state to the on-screen state.
Those skilled in the art will appreciate that the structure shown in fig. 5 is not limiting of the electronic device 500 and may include more or fewer components than shown, or may combine certain components, or may employ a different arrangement of components.
According to an embodiment of the present disclosure, there may also be provided a computer-readable storage medium storing instructions, wherein the instructions, when executed by at least one processor, cause the at least one processor to perform an image processing method according to the present disclosure. Examples of the computer readable storage medium herein include: read-only memory (ROM), random-access programmable read-only memory (PROM), electrically erasable programmable read-only memory (EEPROM), random-access memory (RAM), dynamic random-access memory (DRAM), static random-access memory (SRAM), flash memory, nonvolatile memory, CD-ROM, CD-R, CD + R, CD-RW, CD+RW, DVD-ROM, DVD-R, DVD + R, DVD-RW, DVD+RW, DVD-RAM, BD-ROM, BD-R, BD-R LTH, BD-RE, blu-ray or optical disk storage, hard Disk Drives (HDD), solid State Disks (SSD), card memory (such as multimedia cards, secure Digital (SD) cards or ultra-fast digital (XD) cards), magnetic tape, floppy disks, magneto-optical data storage, hard disks, solid state disks, and any other means configured to store computer programs and any associated data, data files and data structures in a non-transitory manner and to provide the computer programs and any associated data, data files and data structures to a processor or computer to enable the processor or computer to execute the programs. The computer programs in the computer readable storage media described above can be run in an environment deployed in a computer device, such as a client, host, proxy device, server, etc., and further, in one example, the computer programs and any associated data, data files, and data structures are distributed across networked computer systems such that the computer programs and any associated data, data files, and data structures are stored, accessed, and executed in a distributed fashion by one or more processors or computers.
In accordance with embodiments of the present disclosure, there may also be provided a computer program product in which instructions are executable by a processor of a computer device to perform the above-described image processing method.
The image processing method, the image processing device, the electronic equipment and the computer readable storage medium according to the embodiment of the disclosure can optimize the pixel area used when the picture sequence is converted into the video, thereby reducing the memory when the video is generated by conversion and optimizing the disk space and the decoding speed of the converted video file.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any adaptations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. An image processing method, comprising:
acquiring a picture to be processed;
generating a color picture and a transparency picture corresponding to the picture to be processed, wherein the picture to be processed, the color picture and the transparency picture comprise three color channels and one transparency channel, the color picture and the picture to be processed are the same in size, each pixel of the color picture and each pixel of the transparency picture are respectively in one-to-one correspondence with each pixel of the picture to be processed, each pixel of the color picture has the same color channel value and a preset transparency channel value as the corresponding pixel of the picture to be processed, and the values of all channels of each pixel of the transparency picture are the same as the transparency channel value of the corresponding pixel of the picture to be processed;
uniformly dividing the transparency picture into three region pictures;
respectively allocating the values of the transparency channels of the pixels of each region picture of the transparency pictures to three color channels of the corresponding pixels of the specific region pictures in the three region pictures, wherein the positions of the corresponding pixels of the specific region pictures in the specific region pictures and the positions of the pixels of each region picture in the specific region pictures meet a one-to-one correspondence, and the specific region picture is any one region picture in the three region pictures;
And splicing the color picture and the specific area picture, and generating a video without a transparency channel based on the spliced picture.
2. The method of claim 1, wherein uniformly dividing the transparency picture into three region pictures comprises:
and uniformly dividing the transparency picture into three region pictures according to the horizontal direction or the vertical direction.
3. The method of claim 2, wherein uniformly dividing the transparency picture into three region pictures comprises:
and uniformly dividing the transparency picture into a left region picture, a middle region picture and a right region picture according to the direction from the left side to the right side or from the right side to the left side of the transparency picture, wherein the specific region picture is any one region picture among the left region picture, the middle region picture and the right region picture.
4. The method of claim 2, wherein uniformly dividing the transparency picture into three region pictures comprises:
and uniformly dividing the transparency picture into an upper region picture, a middle region picture and a lower region picture according to the direction from the upper part to the lower part or from the lower part to the upper part of the transparency picture, wherein the specific region picture is any one region picture of the upper region picture, the middle region picture and the lower region picture.
5. The method according to any one of claims 2 to 4, wherein assigning the value of the transparency channel of the pixel of each of the region pictures to the three color channels of the corresponding pixel of the specific region picture of the three region pictures, respectively, comprises:
assigning a value of any color channel or transparency channel of a pixel of a first region among three regions divided by the transparency picture to the first color channel of the corresponding pixel of the specific region picture;
assigning a value of any color channel or transparency channel of a pixel of a second region of the three regions divided by the transparency picture to the second color channel of the corresponding pixel of the specific region picture;
and assigning any color channel of pixels of a third region of the three regions divided by the transparency picture or a value of a transparency channel to the third color channel of the corresponding pixels of the specific region picture.
6. The method of claim 1, wherein a location of a corresponding pixel of the particular region picture in the particular region picture is the same as a location of a pixel of each region picture in each region picture.
7. The method of claim 1, wherein the picture to be processed is a picture employing RGBA color space and the video is a video employing YUV color space.
8. An apparatus for processing a picture, comprising:
a picture acquisition unit configured to acquire a picture to be processed;
a first picture generation unit configured to generate a color picture and a transparency picture corresponding to a to-be-processed picture from the to-be-processed picture, wherein the to-be-processed picture, the color picture and the transparency picture each include three color channels and one transparency channel, the color picture is the same as the to-be-processed picture in size, each pixel in the color picture and each pixel in the transparency picture are respectively in one-to-one correspondence with each pixel of the to-be-processed picture, and have the same color channel value and a specific transparency channel value as the corresponding pixel of the to-be-processed picture, and the values of all channels of each pixel are the same as the transparency channel value of the corresponding pixel of the to-be-processed picture;
a picture dividing unit configured to uniformly divide the transparency picture into three region pictures;
A second picture generation unit configured to allocate values of transparency channels of pixels of each region picture of the transparency pictures to three color channels of corresponding pixels of a specific region picture among the three region pictures, respectively, a position of the corresponding pixels of the specific region picture in the specific region picture and a position of the pixels of each region picture in each region picture satisfying a one-to-one correspondence relationship, the specific region picture being any one of the three region pictures;
and a video generation unit configured to splice the color picture and the specific region picture, and generate a video without a transparency channel based on the spliced picture.
9. An electronic device, comprising:
at least one processor;
at least one memory storing computer-executable instructions,
wherein the computer executable instructions, when executed by the at least one processor, cause the at least one processor to perform the method of any of claims 1 to 7.
10. A computer readable storage medium, which when executed by a processor of an electronic device, causes the electronic device to perform the method of any of claims 1 to 7.
CN202310896611.8A 2023-07-20 2023-07-20 Image processing method, apparatus and computer readable storage medium Pending CN116957933A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310896611.8A CN116957933A (en) 2023-07-20 2023-07-20 Image processing method, apparatus and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310896611.8A CN116957933A (en) 2023-07-20 2023-07-20 Image processing method, apparatus and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN116957933A true CN116957933A (en) 2023-10-27

Family

ID=88457792

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310896611.8A Pending CN116957933A (en) 2023-07-20 2023-07-20 Image processing method, apparatus and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN116957933A (en)

Similar Documents

Publication Publication Date Title
US11567623B2 (en) Displaying interfaces in different display areas based on activities
CN115473957B (en) Image processing method and electronic equipment
CN109559270B (en) Image processing method and electronic equipment
CN109191549B (en) Method and device for displaying animation
US10181203B2 (en) Method for processing image data and apparatus for the same
CN108762881B (en) Interface drawing method and device, terminal and storage medium
CN110633043A (en) Split screen processing method and terminal equipment
CN110933334B (en) Video noise reduction method, device, terminal and storage medium
CN109616058B (en) Data transmission method and device and liquid crystal display device
CN108132790B (en) Method, apparatus and computer storage medium for detecting a garbage code
CN110290426B (en) Method, device and equipment for displaying resources and storage medium
CN111586444B (en) Video processing method and device, electronic equipment and storage medium
CN111901679A (en) Method and device for determining cover image, computer equipment and readable storage medium
CN113192519B (en) Audio encoding method and apparatus, and audio decoding method and apparatus
CN112911337B (en) Method and device for configuring video cover pictures of terminal equipment
CN114332709A (en) Video processing method, video processing device, storage medium and electronic equipment
CN116957933A (en) Image processing method, apparatus and computer readable storage medium
CN115730091A (en) Comment display method and device, terminal device and readable storage medium
CN114527903A (en) Key mapping method, electronic equipment and system
CN112383719A (en) Image brightness adjusting method, device and equipment and readable storage medium
CN114708289A (en) Image frame prediction method and electronic equipment
CN112231619A (en) Conversion method, conversion device, electronic equipment and storage medium
CN111464829A (en) Method, device and equipment for switching media data and storage medium
CN114268797B (en) Method, device, storage medium and electronic equipment for time domain filtering of video
CN113658283B (en) Image processing method, device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination