Image processing method, apparatus, device, readable storage medium and program product
By detecting differences in color distribution between video stream image frames, the color enhancement data is adaptively adjusted, solving the problem that fixed adjustment data cannot adapt to scene changes, and achieving better color enhancement effects and visual experience.
Patent Information
- Application Number
- CN202311024587.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-14
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2043-08-14
AI Technical Summary
Existing technologies using fixed color enhancement adjustment data within the same video stream cannot adapt to changes in scene style and color characteristics, resulting in poor color enhancement effects for image frames.
By detecting differences in color distribution among image frames in a video stream, color enhancement adjustment data is adaptively adjusted to perform personalized processing for different image frames.
It improves the color enhancement processing of image frames in the video stream, enhancing the image's expressiveness and the user's visual experience.
Smart Images

Figure CN117058030B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to an image processing method, an image processing device, a computer device, a computer readable storage medium and a computer program product. BACKGROUND
[0002] By performing color enhancement processing on a video stream, the picture expressiveness of the video stream can be enhanced, and the picture tone can be balanced, thereby improving the visual experience of a user. Currently, for video streams of different scene types (such as natural scenes, movie scenes, cartoon scenes, game scenes, etc.), fixed color enhancement adjustment data is respectively set to perform corresponding color enhancement processing. However, in the same video stream, the scene style and color features can change constantly, and the use of fixed color enhancement adjustment data can cause some image frames to have unobvious changes due to too low color enhancement intensity, or color oversaturation due to too high color enhancement intensity, thereby affecting the effect of color enhancement processing. SUMMARY
[0003] The present application provides an image processing method, device, equipment, readable storage medium and program product, which can realize adaptive adjustment of color enhancement adjustment data, thereby improving the color enhancement processing effect of video image frames.
[0004] In a first aspect, the present application provides an image processing method, comprising:
[0005] When a color difference detection condition is met, a first image frame is determined from a video stream, and first color distribution data of the first image frame is obtained;
[0006] Second color distribution data of a reference image frame is obtained, and color distribution difference data between the first color distribution data and the second color distribution data is determined; wherein the reference image frame is an image frame in the video stream, and the playback time corresponding to the reference image frame is earlier than the playback time corresponding to the first image frame;
[0007] When it is determined according to the color distribution difference data that a color enhancement adjustment condition is met, target color enhancement adjustment data is determined according to the first color distribution data;
[0008] The first image frame and each second image frame are subjected to color enhancement processing according to the target color enhancement adjustment data; wherein the second image frame is an image frame in the video stream, the playback time corresponding to the second image frame is later than the playback time corresponding to the first image frame, and the time interval between the playback time corresponding to the second image frame and the playback time corresponding to the first image frame is less than or equal to a time interval threshold.
[0009] In a second aspect, the present application provides an image processing apparatus, comprising:
[0010] an acquisition module configured to determine a first image frame from a video stream when a color difference detection condition is met, and acquire first color distribution data of the first image frame;
[0011] a processing module configured to acquire second color distribution data of a reference image frame, and determine color distribution difference data between the first color distribution data and the second color distribution data, wherein the reference image frame is an image frame in the video stream, and a play time corresponding to the reference image frame is earlier than a play time corresponding to the first image frame;
[0012] the processing module is further configured to determine target color enhancement adjustment data according to the first color distribution data when it is determined that a color enhancement adjustment condition is met according to the color distribution difference data;
[0013] a color enhancement module configured to perform color enhancement processing on the first image frame and each second image frame according to the target color enhancement adjustment data, wherein the second image frame is an image frame in the video stream, a play time corresponding to the second image frame is later than the play time corresponding to the first image frame, and a time interval between the play time corresponding to the second image frame and the play time corresponding to the first image frame is less than or equal to a time interval threshold.
[0014] In a third aspect, the present application provides a computer device, comprising a processor, a storage device and a communication interface, wherein the processor, the communication interface and the storage device are connected to each other, the storage device stores executable program codes, and the processor is configured to invoke the executable program codes to implement the image processing method.
[0015] In a fourth aspect, the present application provides a computer readable storage medium, which stores a computer program, the computer program comprises program instructions, and the program instructions are executed by a processor to implement the image processing method.
[0016] In a fifth aspect, the present application provides a computer program product, which comprises a computer program or computer instructions, and the computer program or computer instructions are executed by a processor to implement the image processing method.
[0017] The embodiment of the present application determines a first image frame from the video stream when the color difference detection condition is met, and obtains first color distribution data of the first image frame. Then, second color distribution data of a reference image frame before the first image frame is obtained, and color distribution difference data between the first color distribution data and the second color distribution data is determined. When it is determined that the color enhancement adjustment condition is met according to the color distribution difference data, it is considered that a scene switching occurs between the reference image frame and the first image frame. The scene switching detection is performed based on the first color distribution data and the second color distribution data with small amount of data, which can avoid the scene recognition on the content of the image frame, thereby improving the efficiency of the scene switching detection and reducing the cost. Finally, target color enhancement adjustment data is determined according to the first color distribution data, and the color enhancement processing is performed on the first image frame and each second image frame after the first image frame according to the target color enhancement adjustment data. Compared with the color enhancement processing using the fixed color enhancement adjustment data, the above method realizes the continuous color difference detection for the video stream, thereby realizing the adaptive adjustment of the color enhancement adjustment data. The color enhancement processing is performed on the video stream based on the color enhancement adjustment data adjusted adaptively, which can improve the effect of the color enhancement processing of the video image frame. BRIEF DESCRIPTION OF DRAWINGS
[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, for those skilled in the art, other drawings can also be obtained without creative labor based on these drawings.
[0019] Figure 1 is a schematic architecture diagram of an image processing system provided by an example embodiment of the present application;
[0020] Figure 2 is a flowchart of an image processing method provided by an example embodiment of the present application;
[0021] Figure 3 is a flowchart of another image processing method provided by an example embodiment of the present application;
[0022] Figure 4 is a processing flowchart of color enhancement processing provided by an example embodiment of the present application;
[0023] Figure 5 is a schematic block diagram of an image processing device provided by an example embodiment of the present application;
[0024] Figure 6 is a schematic block diagram of a computer device provided by an example embodiment of the present application. DETAILED DESCRIPTION
[0025] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0026] It should be noted that the terms "first," "second," etc., used in the embodiments of this application are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a technical feature specified with "first" or "second" may explicitly or implicitly include at least one of those features.
[0027] To better understand the solutions of the embodiments of this application, the relevant terms and concepts that may be involved in the embodiments of this application will be introduced below:
[0028] Color enhancement processing: This is part of image enhancement technology. It refers to adjusting the saturation, contrast, brightness, and other characteristics of images and videos to make the colors richer and more realistic, thereby enhancing the subjective visual experience.
[0029] A color model refers to a subset of visible light in a three-dimensional color space, encompassing all colors within a specific color gamut. Generally, any color gamut is only a subset of visible light, and no single color model can encompass all visible light. Common color models include RGB, CIECMY, CMYK, YcbCr, HSV, and HSL.
[0030] HSV color space (Hue, Saturation, Value): Similar to how the human eye perceives color. Conceptually, HSV is often considered an inverted cone of color, representing the number of distinguishable saturation and hue levels that decreases as lightness approaches black. In practical applications, an HSV color wheel is often chosen, with hue represented by a circle and saturation and lightness by triangles. The HSV color space may refer to the second color space in the embodiments of this application.
[0031] The embodiments of this application can be applied to various fields or scenarios such as cloud computing, cloud IoT, cloud gaming, artificial intelligence, vehicle scenarios, smart transportation, assisted driving, and image color enhancement. Several typical fields or scenarios will be introduced below.
[0032] Cloud computing refers to a delivery and use mode of IT infrastructure, and refers to obtaining required resources in a scalable manner on demand through a network; broad-sense cloud computing refers to a delivery and use mode of services, and refers to obtaining required services in a scalable manner on demand through a network. The services can be IT and software, Internet related, or other services. Cloud computing is a product of the development of grid computing, distributed computing, parallel computing, utility computing, network storage technologies, virtualization, load balancing and other traditional computer and network technologies. With the development of the Internet, real-time data flow and diversified connected devices, and the promotion of requirements such as search services, social networks, mobile commerce and open collaboration, cloud computing has rapidly developed. Unlike previous parallel distributed computing, cloud computing will revolutionize the entire Internet model and enterprise management model from the concept. The present application can store video stream, color distribution data, color distribution difference data, color enhancement adjustment data and the like on a cloud server, and when the above different data is required, the data can be directly obtained from the cloud server, greatly improving the data acquisition speed.
[0033] Cloud IOT aims to connect the information sensed by the sensing devices in the traditional IOT and the accepted instructions into the Internet, truly realize networking, and realize massive data storage and operation through cloud computing technology. Due to the characteristics of IOT, the "objects" are connected, and the current running state of each "object" is sensed in real time. In this process, a large amount of data information will be generated. How to summarize these information and how to screen useful information from the massive information to support decision-making for subsequent development have become key problems affecting the development of IOT. Therefore, IOT cloud based on cloud computing and cloud storage technology has become a powerful support for IOT technology and application.
[0034] Cloud gaming, also known as gaming on demand, is an online gaming technology based on cloud computing technology. Cloud gaming technology enables thin clients with relatively limited graphics processing and data processing capabilities to run high-quality games. In the cloud gaming scenario, the game is not run on the player's game terminal, but in the cloud server, and the cloud server renders the game scene into a video and audio stream and transmits it to the player's game terminal. The player's game terminal does not need to have powerful graphics processing and data processing capabilities, but only needs to have basic streaming media playback capabilities and the ability to obtain player input instructions and send them to the cloud server. The present application is applied to cloud gaming. When there is a corresponding business demand, the method proposed in the present application is used to determine a first image frame and a reference image frame from the cloud gaming video stream, then analyze the color distribution data corresponding to the first image frame and the reference image frame respectively to obtain color distribution difference data, and when the color distribution difference data meets the color enhancement adjustment condition, generate target color enhancement adjustment data adaptively combined with the color distribution data of the current image frame (such as the first image frame), and perform color enhancement processing on the cloud gaming video stream based on the target color enhancement adjustment data, thereby enhancing the expressiveness of the game picture and improving the visual experience and game experience of the player.
[0035] Intelligent Traffic System (ITS), also known as Intelligent Transportation System, is a comprehensive transportation system that uses advanced science and technology (information technology, computer technology, data communication technology, sensor technology, electronic control technology, automatic control theory, operations research, artificial intelligence, etc.) to effectively integrate transportation, service control and vehicle manufacturing, and strengthen the connection between vehicles, roads and users, thereby forming a comprehensive transportation system that ensures safety, improves efficiency, improves the environment and saves energy.
[0036] Intelligent Vehicle Infrastructure Cooperative Systems (IVICS), referred to as vehicle infrastructure cooperative systems, is a development direction of intelligent transportation systems (ITS). The vehicle infrastructure cooperative system is to use advanced wireless communication and new generation Internet technologies to implement dynamic real-time information interaction between vehicles and roads in all directions, and to carry out vehicle active safety control and road cooperative management on the basis of full-time and space dynamic traffic information collection and fusion, fully realize the effective cooperation of man, vehicle and road, ensure traffic safety, improve traffic efficiency, and thus form a safe, efficient and environmentally friendly road traffic system. The present application can be applied to the above-mentioned field, realizing adaptive color enhancement of traffic violation videos under various weather conditions (such as rainy days, sunny days, snowy days, etc.), improving the picture detail performance and picture clarity of the traffic violation videos, and thus improving the efficiency of the law enforcement personnel in checking the violation behavior based on the color-enhanced traffic violation videos.
[0037] The embodiment of the present application can enhance the picture performance of the video stream by color enhancement processing, balance the picture tone, and thus improve the user's visual experience. In the cloud game scene, by performing color enhancement processing on the cloud game video stream, the brightness, contrast, saturation, etc. of the game picture can be improved, and the color balance of the game picture can be adjusted, thereby enhancing the performance of the game picture, making the tone of the game picture more realistic, and thus improving the player's game experience.
[0038] When color enhancement processing is performed on video streams of different picture types (such as natural scenes, movie scenes, cartoon scenes, game scenes, etc.), a method of respectively setting fixed color enhancement adjustment data for processing is adopted. However, the above method cannot realize the intensity subdivision setting of the image frames in the same video stream, and for different game types (such as open games similar to the real world, retro pixel games, cartoon style, etc.), the scene style and color richness difference is huge. Moreover, in the same video stream, the scene style and color features may change constantly, and using fixed color enhancement adjustment data may cause some image frames to change unobviously due to too low color enhancement intensity, or cause color oversaturation due to too high color enhancement intensity. The above method cannot realize adaptive adjustment of the color enhancement adjustment data, thereby affecting the effect of color enhancement processing.
[0039] Based on this, the embodiment of the present application proposes that when the color difference detection condition is met, a first image frame is determined from the video stream, and first color distribution data of the first image frame is obtained; second color distribution data of a reference image frame before the first image frame is obtained, and color distribution difference data between the first color distribution data and the second color distribution data is determined; when it is determined according to the color distribution difference data that the color enhancement adjustment condition is met, target color enhancement adjustment data is determined according to the first color distribution data; and the first image frame and each second image frame after the first image frame are subjected to color enhancement processing according to the target color enhancement adjustment data, which realizes adaptive adjustment of the color enhancement adjustment data, thereby improving the effect of color enhancement processing.
[0040] It can be understood that in the specific embodiments of the present application, data related to video streams and the like are involved, and when the above embodiments of the present application are applied to specific products or technologies, the collection, use and processing of related data need to comply with relevant laws, regulations and standards in relevant regions.
[0041] The present application will be specifically explained through the following embodiments:
[0042] Please refer to Figure 1 , which is an architecture schematic diagram of an image processing system provided by an exemplary embodiment of the present application. The image processing system can specifically include a terminal device 101 and a server 102. The terminal device 101 and the server 102 are connected through a network, such as a local area network, a wide area network, a mobile Internet, etc. An operation object operates on a browser or a client application of the terminal device 101 to access a video stream. The server 102 can respond to the operation to provide various services related to video stream access for the operation object.
[0043] In an embodiment, the server 102 can transmit a video stream to the terminal device 101, and the terminal device 101 can perform color enhancement processing on the video stream. Specifically, the terminal device 101 performs color difference detection on the acquired video stream (e.g., the video stream includes image frame 1, image frame 2, image frame 3, etc.), determines a first image frame (e.g., image frame 6) from the video stream when the color difference detection condition is met, and acquires first color distribution data of the first image frame. Then, the terminal device 101 acquires second color distribution data of a reference image frame (e.g., image frame 1) before the first image frame, and determines color distribution difference data between the first color distribution data and the second color distribution data. When it is determined that the color distribution difference data meets a color enhancement adjustment condition (e.g., the color distribution difference data is greater than a threshold), the terminal device 101 determines target color enhancement adjustment data according to the first color distribution data. Finally, the terminal device 101 performs color enhancement processing on the first image frame (e.g., image frame 6) and each second image frame (e.g., image frame 7, image frame 8, image frame 9, etc.) after the first image frame according to the target color enhancement adjustment data. The time interval between the playback time corresponding to the reference image frame and the playback time corresponding to the first image frame can be a time interval threshold (e.g., the time interval threshold can be 5 ms, and each ms corresponds to one image frame, so the reference image frame and the first image frame are separated by five image frames). The time interval between the playback time corresponding to the second image frame and the playback time corresponding to the first image frame can be less than or equal to a time interval threshold (e.g., the time interval threshold can be 5 ms, and image frame 7 is separated from the first image frame by 1 ms, and image frame 8 is separated from the first image frame by 2 ms).
[0044] The terminal device 101 can also be referred to as a terminal, a user equipment (UE), an access terminal, a subscriber unit, a mobile device, a user terminal, a wireless communication device, a user agent, or a user device. The terminal device can be a smart home appliance, a handheld device (e.g., a smartphone, a tablet PC) having a wireless communication function, a computing device (e.g., a personal computer (PC)) having a wireless communication function, a vehicle-mounted terminal, a smart speaker, a wearable device, or other smart devices, but is not limited thereto.
[0045] The server 102 can be a standalone physical server, a server cluster or a distributed system composed of multiple physical servers, a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms, etc.
[0046] In an embodiment, in a cloud game scenario, the video stream is a cloud game video stream, the terminal device 101 can be a terminal decoding end where a player is located, and the server 102 can be a cloud encoding end corresponding to a cloud game server. In the first case, the server 102 can encode and compress a raw video sequence of the cloud game to obtain an encoded video, and then send the encoded video to the terminal device 101. After receiving the encoded video, the terminal device 101 decodes the encoded video to obtain a decoded video (i.e., a video stream), and then performs adaptive generation of color enhancement adjustment data and color enhancement processing on the video stream (specifically including: performing color difference detection on the video stream, adaptively adjusting the color enhancement adjustment data when the color difference detection condition is met, and performing subsequent color enhancement processing on the video stream based on the color enhancement adjustment data). Then, the terminal device 101 renders and displays the video stream after the color enhancement processing on the device.
[0047] In an embodiment, in a cloud game scenario, in the second case, the server 102 can also perform adaptive generation of color enhancement adjustment data and color enhancement processing on a raw video sequence of the cloud game to obtain a video stream after the color enhancement processing. Then, the server 102 encodes and compresses the video stream after the color enhancement processing to obtain an encoded video, and then sends the encoded video to the terminal device 101. After receiving the encoded video, the terminal device 101 decodes the encoded video to obtain the video stream after the color enhancement processing, and finally renders and displays the video stream on the device.
[0048] In an embodiment, in a cloud game scenario, in the third case, the server 102 can also encode and compress a raw video sequence of the cloud game to obtain an encoded video, and simultaneously perform adaptive generation of color enhancement adjustment data on the raw video sequence, and then send the encoded video and the color enhancement adjustment data to the terminal device 101. After receiving the encoded video and the color enhancement adjustment data, the terminal device 101 first decodes the received encoded video to obtain a decoded video (i.e., a video stream), and then performs color enhancement processing on the video stream by using the received color enhancement adjustment data. Finally, the terminal device 101 renders and displays the video stream after the color enhancement processing on the device.
[0049] In the above various implementable manners, the terminal device can be flexibly selected according to actual business conditions, which improves the flexibility of color enhancement processing on the video stream, and the embodiments of the present application are not limited thereto. In subsequent embodiments, the terminal device 101 will be taken as an example to perform adaptive generation of color enhancement adjustment data and color enhancement processing on the video stream (i.e., the first case), and the subsequent embodiments will not be repeated.
[0050] In one embodiment, the architecture of the image processing system proposed in this application may further include a database, which can be used to store data such as video streams. This data can be recorded in the database through different database tables. For example, the database can be a database located in a server, that is, a database built into or included with the server; the database can also be an external database connected to the server, such as a cloud database (i.e., a database deployed in the cloud). Specifically, it can be deployed based on any of the following: private cloud, public cloud, hybrid cloud, edge cloud, etc., so that the cloud database focuses on different functions.
[0051] It is understood that the system architecture diagrams described in the embodiments of this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided in the embodiments of this application. For example, the image processing method provided in the embodiments of this application can be executed not only by the terminal device 101, but also by other servers or server clusters that are different from the terminal device 101 and can communicate with the terminal device 101 and / or the server 102. Those skilled in the art will understand that... Figure 1 The number of terminal devices and servers shown is merely illustrative. Any number of terminal devices and servers can be configured according to business needs. Furthermore, as system architecture evolves and new business scenarios emerge, the technical solutions provided in this application are also applicable to similar technical problems. In subsequent embodiments, "terminal device" will refer to the aforementioned terminal device 101, and "server" will refer to the aforementioned server 102; further details will not be repeated in subsequent embodiments.
[0052] Please see Figure 2 This figure is a schematic flowchart of an image processing method provided in an exemplary embodiment of this application. Taking the application of this method to a terminal device as an example, the method may include the following steps:
[0053] S201. When the color difference detection condition is met, determine the first image frame from the video stream and obtain the first color distribution data of the first image frame.
[0054] In this context, a video stream refers to an image sequence composed of a series of consecutive image frames, played at a certain frame rate along a timeline to form a continuous dynamic image. The color difference detection condition refers to the triggering condition for color difference detection in the video stream. For example, the color difference detection condition could be performing a color difference detection every preset time interval (e.g., 5 milliseconds), or it could be performing a color difference detection every preset image frame interval (e.g., 5 image frames). In subsequent embodiments, an example will be used where each millisecond corresponds to one image frame in the video stream. The first color distribution data is used to describe the color distribution of the first image frame, for example, the proportion of red, green, and blue pixels in each pixel of the first image frame relative to the total number of pixels in the first image frame.
[0055] In this embodiment, the terminal device determines a first image frame from the video stream and acquires the first color distribution data of the first image frame when it detects that the color difference detection condition is met. This enables continuous color difference detection of the video stream. Furthermore, acquiring the first color distribution data of the first image frame provides a data foundation for subsequent steps.
[0056] In one embodiment, such as Figure 1 As shown, the video stream to be processed includes multiple image frames, such as image frame 1, image frame 2, image frame 3, etc. When the terminal device detects that the color difference detection condition is met (e.g., starting from image frame 1, detection is performed every 5 frames), image frame 6 in the video stream is determined as the first image frame, and then the first color distribution data of the first image frame is obtained.
[0057] S202. Obtain the second color distribution data of the reference image frame, and determine the color distribution difference data between the first color distribution data and the second color distribution data.
[0058] The reference image frame is an image frame in the video stream, and the playback time of the reference image frame is earlier than the playback time of the first image frame. For example, the first image frame could be... Figure 1 Image frame 6 in the image, the reference image frame can be Figure 1 Image frame 1, preceding image frame 6. The second color distribution data describes the color distribution information of the reference image frame, such as the proportion of red, green, and blue pixels in each pixel of the reference image frame relative to the total number of pixels in the reference image frame. Color distribution difference data represents the difference in color distribution between the first image frame and the reference image frame, such as the rate of change between the first color distribution data and the second color distribution data.
[0059] In the embodiments of the present application, there can be a scene switching between each image frame in the video stream, for example, from an indoor scene to an outdoor scene. In order to improve the effect of color enhancement processing for the video stream, it is necessary to adaptively generate corresponding color enhancement adjustment data for different scenes of the image frame to perform color enhancement processing. The embodiments of the present application first determine the color distribution difference data between the first color distribution data and the second color distribution data, and then determine whether the scene switching occurs between the reference image frame and the first image frame according to the color distribution difference data.
[0060] In an embodiment, if the first color distribution data and the second color distribution data are quite different (i.e., the color richness of the picture changes greatly, and the corresponding color distribution difference data is large), it can be considered that the scene switching occurs between the reference image frame and the first image frame. If the first color distribution data and the second color distribution data are quite small (i.e., the color richness of the picture changes slightly, and the corresponding color distribution difference data is small), it can be considered that the scene switching does not occur between the reference image frame and the first image frame.
[0061] Taking the cloud game scene as an example, the picture content of the image frame in the cloud game video stream usually changes frequently. The scene switching recognition detection based on the content of the image frame will cause excessive consumption of computing resources and low detection efficiency. The embodiments of the present application only perform scene switching detection through the first color distribution data and the second color distribution data with small amount of data, and flexibly set the time interval threshold, which can avoid the scene switching recognition detection on the content of the image frame, thereby improving the detection efficiency of the scene switching detection and reducing the detection cost.
[0062] S203, when it is determined that the color enhancement adjustment condition is met according to the color distribution difference data, determining target color enhancement adjustment data according to the first color distribution data.
[0063] In the embodiments of the present application, when the terminal device determines that the color enhancement adjustment condition is met according to the color distribution difference data, the target color enhancement adjustment data can be determined according to the first color distribution data, which makes the target color enhancement adjustment data closely combined with the color distribution information of the first image frame, and ensures the accuracy of the target color enhancement adjustment data.
[0064] The color enhancement adjustment condition can be a threshold value. When the color distribution difference data is greater than the threshold value, it is determined that the color distribution difference data meets the color enhancement adjustment condition. The target color enhancement adjustment data is used to guide the color enhancement processing of the image frame, for example, the contrast, brightness, saturation, etc. of the image frame are color enhanced and adjusted through the target color enhancement adjustment data to obtain the color enhanced and adjusted image frame.
[0065] S204. Perform color enhancement processing on the first image frame and each of the second image frames according to the target color enhancement adjustment data.
[0066] In this context, the second image frame is an image frame in the video stream. The playback time of the second image frame is later than the playback time of the first image frame, and the time interval between the playback times of the second and first image frames is less than or equal to a time interval threshold. The time interval threshold can refer to the detection interval corresponding to the color difference detection condition. For example, if the color difference detection condition indicates that detection is performed every 5ms, then the time interval threshold is 5ms.
[0067] In this embodiment, the terminal device performs color enhancement processing on the first image frame and each of the second image frames using target color enhancement adjustment data. This can adjust the brightness, contrast, saturation, etc. of the image, thereby enhancing the image's expressiveness and improving the user's visual experience.
[0068] For example, such as Figure 1 As shown, when the time interval threshold is 5ms (each 1ms corresponds to one image frame), the first image frame is image frame 6, the reference image frame is image frame 1, and the time interval between the playback time corresponding to the second image frame and the playback time corresponding to the first image frame is less than or equal to 5ms. For example, the second image frame may include image frames 7, 8, 9, 10, and 11. It should be noted that the specific range of the second image frame is related to the image frames in the video stream. For example, if the video stream only contains image frames 1-9, then the second image frame only includes image frames 7, 8, and 9.
[0069] In one embodiment, the terminal device can continue to follow the method shown in steps S201-204, and when the color difference detection condition is met, determine the third image frame (the time interval between the reference image frame, the first image frame, and the third image frame is the same) from the video stream, and obtain the third color distribution data of the third image frame; then, determine the color distribution difference data between the first color distribution data of the first image frame and the third color distribution data of the third image frame; when it is determined that the color enhancement adjustment condition is met based on the color distribution difference data, determine the subsequent color enhancement adjustment data based on the third color distribution data; finally, perform color enhancement processing on the third image frame and each fourth image frame based on the subsequent color enhancement adjustment data; wherein, the fourth image frame is an image frame in the video stream, the playback time corresponding to the fourth image frame is later than the playback time corresponding to the third image frame, and the time interval between the playback time corresponding to the fourth image frame and the playback time corresponding to the third image frame is less than or equal to the time interval threshold.
[0070] According to the above method, the terminal device can realize continuous color difference detection for the video stream. For example, the terminal device can perform color enhancement processing on the first image frame and each second image frame by using the target color enhancement adjustment data determined according to the first image frame. Then, a third image frame is determined from the video stream, and it is determined whether a scene switch occurs between the third image frame and the first image frame (i.e., whether the color distribution difference data corresponding to the third image frame and the first image frame satisfies the color enhancement adjustment condition). If a scene switch occurs, subsequent color enhancement adjustment data is determined according to the third image frame, and then the third image frame and each fourth image frame are processed by using the subsequent color enhancement adjustment data. If no scene switch occurs, the third image frame and each fourth image frame are processed by using the target color enhancement adjustment data. Through the above method, adaptive adjustment of the color enhancement adjustment data is realized, and the image frames in the video stream are processed by using the color enhancement adjustment data, thereby improving the effect of color enhancement processing.
[0071] In an embodiment, when the reference image frame is the initial image frame in the video stream, the terminal device needs to first calculate the second color distribution data of the reference image frame, and then perform step S202 and subsequent steps. When the reference image frame is not the initial image frame in the video stream (for example, the reference image frame is image frame 6 in FIG. 6), the second color distribution data of the reference image frame has been calculated in the previous color difference detection process of the video stream, so the terminal device can directly obtain the second color distribution data of the reference image frame, and then perform step S202 and subsequent steps. Through the above method, repeated calculation can be avoided, the efficiency of color difference detection is improved, and the overall efficiency of color enhancement processing for the video stream is improved. Figure 1
[0072] Based on the above embodiments, the application has the following beneficial effects: in the embodiments of the application, when the color difference detection condition is met, a first image frame is determined from the video stream, and first color distribution data of the first image frame is obtained; then, second color distribution data of a reference image frame before the first image frame is obtained, and color distribution difference data between the first color distribution data and the second color distribution data is determined; when it is determined according to the color distribution difference data that the color enhancement adjustment condition is met, it is considered that a scene switch occurs between the reference image frame and the first image frame. Based on the first color distribution data and the second color distribution data with small data volume, the scene switch detection is performed, which can avoid scene recognition on the content of the image frame, thereby improving the efficiency of scene switch detection and reducing the cost. Finally, target color enhancement adjustment data is determined according to the first color distribution data, and the first image frame and each second image frame after the first image frame are subjected to color enhancement processing according to the target color enhancement adjustment data. Compared with the color enhancement processing using fixed color enhancement adjustment data, the above method realizes continuous color difference detection for the video stream, thereby realizing adaptive adjustment of the color enhancement adjustment data. The color enhancement processing of the video stream based on the color enhancement adjustment data obtained through adaptive adjustment can improve the effect of color enhancement processing of the video image frame.
[0073] Referring to Figure 3 The figure is a flowchart of another image processing method provided by an example embodiment of the application. The method is described by taking the application of a terminal device as an example. The method can include the following steps:
[0074] S301, when the color difference detection condition is met, a first image frame is determined from the video stream.
[0075] In an embodiment, the video stream can be a cloud game video stream. Through the method provided by the embodiments of the application, the first image frame and the reference image frame are determined in the cloud game video stream, and the color distribution data corresponding to the first image frame and the reference image frame is analyzed to obtain the color distribution difference data. When the color distribution difference data meets the color enhancement adjustment condition, the target color enhancement adjustment data is adaptively generated based on the color distribution data of the current image frame (such as the first image frame), and the cloud game video stream is subjected to color enhancement processing based on the target color enhancement adjustment data, thereby enhancing the expressiveness of the game picture and improving the visual experience and game experience of the player.
[0076] The specific implementation of step S301 can refer to the related description of step S201 in the foregoing embodiments, which will not be described here. The method for obtaining the first color distribution data of the first image frame will be introduced through steps S302-S304:
[0077] S302, convert the first image frame from the first color space to a second color space to obtain a first image frame after color space conversion.
[0078] In the embodiments of the present application, whether the scene switching detection occurs between the first image frame and the reference image frame is determined by judging whether the color distribution difference data meets the color enhancement adjustment condition. If the color distribution difference data meets the color enhancement adjustment condition (i.e., there is a significant difference in the richness of the picture color compared with before), it is considered that the scene switching occurs, and the color enhancement adjustment data needs to be readapted. If the color distribution difference data does not meet the color enhancement adjustment condition (i.e., the difference in the richness of the picture color compared with before is small), it is considered that the scene switching does not occur, and the previous color enhancement adjustment data can be continued to be used. The time interval of the scene switching detection can be t1, for example, t1 is 30s. By reasonably setting the time interval, the frequency of the scene switching detection can be controlled, thereby saving the computing resources.
[0079] In an embodiment, the scene switching detection needs to convert (map) the image frame in the video stream from the first color space to the second color space. The first color space can be the RGB color space or the YUV color space (usually the video input format before encoding is the RGB format or the YUV format, and the video format after decoding is completed and before rendering is usually the RGB format). The second color space includes a hue channel. The second color space can be the HSV color space or the HSL color space. The HSV color space includes a hue channel (Hue), a saturation channel (Saturation), and a value channel (Value); the HSL color space includes a hue channel (Hue), a saturation channel (Saturation), and a lightness channel (Lightness). In subsequent embodiments, the second color space will be described as the HSV color space, which will not be described in detail in subsequent embodiments.
[0080] By converting the first image frame from the first color space to the second color space, and then performing color distribution analysis on the first image frame after color space conversion, more color properties can be considered to obtain more comprehensive and accurate color distribution data. Moreover, different color spaces provide different ways to describe color properties. By converting the first image frame to the second color space, specific analysis requirements can be better adapted, for example, the hue value, saturation value, and lightness value related to the first image frame in the second color space are used to calculate the target color enhancement adjustment data.
[0081] S303, determine a first proportion of target class pixel points in the first image frame after color space conversion.
[0082] The hue of the target class pixel point is one or more of red, green, and blue. The first proportion can refer to the proportion corresponding to one hue in the first image frame, such as the proportion corresponding to the pixel point with a red hue in the first image frame. The first proportion can also refer to the proportion corresponding to each of a plurality of hues in the first image frame, such as the proportion corresponding to the pixel point with a red hue (first red proportion), the proportion corresponding to the pixel point with a green hue (first green proportion), and the proportion corresponding to the pixel point with a blue hue (first blue proportion). The first proportion can also refer to the total proportion of the proportion corresponding to each of a plurality of hues in the first image frame, such as the total proportion corresponding to the proportion corresponding to the pixel point with a red hue, the proportion corresponding to the pixel point with a green hue, and the proportion corresponding to the pixel point with a blue hue (i.e., the sum of the first red proportion, the first green proportion, and the first blue proportion).
[0083] In an embodiment, the hue of the target class pixel point is red, green, and blue. Based on this, the above step S303 can be implemented according to the following steps:
[0084] (a1) determining the first red proportion of the pixel point with a red hue, the first green proportion of the pixel point with a green hue, and the first blue proportion of the pixel point with a blue hue in the first image frame after color space conversion.
[0085] In an embodiment, the first red proportion of the pixel point with a red hue in the first image frame after color space conversion can be determined by the following steps:
[0086] 1. Obtain the color determination interval of the pixel point with a red hue and the hue value of each pixel point in the first image frame after color space conversion.
[0087] In the HSV color space, the hue component is distributed on a hue ring in a plane, and the value range is 0° to 360°, and each angle can represent a color. The reference hue values corresponding to red, green, and blue are 0° (360°), 180°, and 240°, respectively. Therefore, the color determination interval of the pixel point with a red hue can be an interval floating up and down from 0°, such as floating up and down by 15°, so that the corresponding color determination interval is [345°-15°]. Similarly, the color determination intervals of the pixel points with green and blue hues are [105°-135°] and [225°-255°], respectively.
[0088] 2. Determine the number of red pixel points in which the hue value of each pixel point belongs to the color determination interval of the pixel point with a red hue, and determine the first red proportion according to the number of red pixel points and the total number of pixel points in the first image frame.
[0089] The terminal device determines whether the hue value of each pixel point in the first image frame belongs to the color determination interval [345°-15°], and counts the number of pixel points belonging to the color determination interval as the number of red pixel points, and then divides the number of red pixel points by the total number of pixel points in the first image frame to obtain the first red proportion.
[0090] It should be noted that the terminal device determines the first green proportion of the pixel points with green hue in the first image frame after color space conversion (or the reference image frame), and determines the first blue proportion of the pixel points with blue hue, which can refer to the method of determining the first red proportion of the pixel points with red hue in the first image frame after color space conversion by the terminal device, and the embodiments of the present application will not be repeated.
[0091] (a2) determining the first red proportion, the first green proportion and the first blue proportion as the first proportions of the target class pixel points in the first image frame after color space conversion.
[0092] It should be noted that the hue of the target class pixel points in the embodiments of the present application can be one or more of red, green and blue, and can also be other hues, for example, the hue of the target class pixel points can include one or more of red, yellow, green, cyan, blue and magenta, and the corresponding reference hue values in the HSV color space are 0° (360°), 60°, 120°, 180°, 240° and 300° respectively, and the embodiments of the present application are not limited in this regard.
[0093] S304, determining first color distribution data of the first image frame according to the first proportions.
[0094] In the embodiments of the present application, the terminal device can determine the first proportions of the target class pixel points in the first image frame as the first color distribution data.
[0095] In an embodiment, when the hue of the target class pixel points includes one color, such as red, the first color distribution data is the first red proportion; when the hue of the target class pixel points includes multiple colors, such as red, green and blue, the first color distribution data is the first red proportion, the first green proportion and the first blue proportion, or the first color distribution data is the total proportion corresponding to the first red proportion, the first green proportion and the first blue proportion.
[0096] S305, obtaining second color distribution data of a reference image frame.
[0097] The reference image frame is an image frame in the video stream, and the playback time corresponding to the reference image frame is earlier than the playback time corresponding to the first image frame.
[0098] In an embodiment, the terminal device can convert the reference image frame from the first color space to the second color space to obtain a color space converted reference image frame, then determine a second proportion of target class pixel points in the color space converted reference image frame, and further determine the second color distribution data of the reference image frame according to the second proportion. For specific implementation manners, please refer to the method for obtaining the first color distribution data of the first image frame in the foregoing embodiments, and details are not described herein again.
[0099] S306, determine color distribution difference data between the first color distribution data and the second color distribution data.
[0100] In an embodiment, the first color distribution data includes the first proportion, and the second color distribution data includes the second proportion. The second proportion is a proportion of target class pixel points in the reference image frame converted to the second color space. The second proportion includes a second red proportion, a second green proportion, and a second blue proportion. The second red proportion, the second green proportion, and the second blue proportion are proportions of pixel points with a hue of red, a hue of green, and a hue of blue in the reference image frame converted to the second color space, respectively.
[0101] Based on this, the above step S306 can be implemented according to the following steps:
[0102] (b1), determine a change rate between the first proportion and the second proportion.
[0103] (b2), determine the color distribution difference data between the first color distribution data and the second color distribution data according to the change rate between the first proportion and the second proportion.
[0104] In the above steps (b1)-(b2), the terminal device determines the color distribution difference data between the first image frame and the reference image frame by determining the change rate between the first proportion and the second proportion, so as to determine whether the color enhancement adjustment condition is met through the color distribution difference data. If the color distribution difference data meets the color enhancement adjustment condition (i.e., there is a significant difference in the richness of picture color compared with before), it is considered that a scene switching occurs. If the color distribution difference data does not meet the color enhancement adjustment condition (i.e., the difference in the richness of picture color compared with before is small), it is considered that no scene switching occurs.
[0105] In an embodiment, the above step (b1) can be implemented according to the following steps:
[0106] (b1-1), determine a first total proportion according to the first red proportion, the first green proportion, and the first blue proportion, and determine a second total proportion according to the second red proportion, the second green proportion, and the second blue proportion.
[0107] (b1-2), determining the change rate between the first total proportion and the second total proportion as the change rate between the first proportion and the second proportion.
[0108] For example, the first red proportion, the first green proportion and the first blue proportion are respectively 20%, 20% and 10%, and the second red proportion, the second green proportion and the second blue proportion are respectively 25%, 15% and 20%. Then, the first total proportion is 50%, the second total proportion is 60%, and the change rate between the first total proportion and the second total proportion is (60%-50%) / 50%=20%. The change rate between the first proportion and the second proportion can be the absolute value of the change rate between the first total proportion and the second total proportion.
[0109] Then, determining that the color enhancement adjustment condition is met according to the color distribution difference data can mean that the change rate between the first proportion and the second proportion is greater than a color enhancement adjustment threshold (such as 30%). In the above example, the change rate between the first total proportion and the second total proportion is 20%<30%, so it is considered that the color enhancement adjustment condition is not met.
[0110] In an embodiment, the step (b1) can also be implemented according to the following steps:
[0111] (b1-3), determining a first change rate between the first red proportion and the second red proportion, a second change rate between the first green proportion and the second green proportion, and a third change rate between the first blue proportion and the second blue proportion.
[0112] (b1-4), determining the first change rate, the first change rate and the third change rate as the change rate between the first proportion and the second proportion.
[0113] Then, determining that the color enhancement adjustment condition is met according to the color distribution difference data can mean that the first change rate, the second change rate and the third change rate are respectively greater than the corresponding color enhancement adjustment threshold. The corresponding color enhancement adjustment threshold can be the color enhancement adjustment threshold corresponding to the first change rate, the second change rate and the third change rate respectively (such as 10%, 15% and 20% respectively), or can be the same color enhancement adjustment threshold corresponding to the first change rate, the second change rate and the third change rate (such as 18%).
[0114] Through the above method, the flexibility of setting the color enhancement adjustment condition is improved, and the application range of the color enhancement adjustment determination method is ensured.
[0115] S307, when it is determined that the color enhancement adjustment condition is met according to the color distribution difference data, determining target color enhancement adjustment data according to the first color distribution data.
[0116] In an embodiment, the second color space further comprises a saturation channel and a brightness channel, and the terminal device further can perform the following steps: determining a saturation average value of the target-class pixel points in the first image frame after color space conversion, and determining a brightness average value of the target-class pixel points in the first image frame after color space conversion.
[0117] For example, taking the hue of the target-class pixel points as red, green and blue, for the saturation average value, the terminal device can add and average the saturation values of all the pixel points corresponding to the hues of red, green and blue in the first image frame after color space conversion to obtain the saturation average value. For the brightness average value, the terminal device can add and average the brightness values of all the pixel points corresponding to the hues of red, green and blue in the first image frame after color space conversion to obtain the brightness average value. The hue of the target-class pixel points can also be one or two of red, green and blue, and the calculation method is similar, which will not be described herein.
[0118] Based on this, the above determination of the target color enhancement adjustment data according to the first color distribution data can be implemented according to the following steps: determining the target color enhancement adjustment data according to the first proportion, the saturation average value and the brightness average value included in the first color distribution data.
[0119] The determination of the target color enhancement adjustment data mainly needs to consider the first proportion (i.e., the proportion of red, green and blue), the saturation condition and the brightness condition corresponding to the first image frame, because the first proportion, the saturation condition and the brightness condition greatly affect the sensitivity of the picture to color enhancement, for example, the higher the saturation of the picture, the more sensitive to the change of color enhancement; the lower the saturation, the higher the color enhancement intensity is needed to make the user subjectively perceive the color enhancement. The terminal device obtains the target color enhancement adjustment data by performing relevant calculations on the first proportion, the saturation average value and the brightness average value.
[0120] In an embodiment, the above determination of the target color enhancement adjustment data according to the first proportion, the saturation average value and the brightness average value included in the first color distribution data can be implemented according to the following steps:
[0121] (c1), obtaining a video type corresponding to the video stream.
[0122] In an embodiment, the video type corresponding to the video stream can be: game video, movie video, animation video, documentary video, sports video, advertisement video, sports event video, etc.
[0123] (c2), determining a hue weight, a saturation weight and a brightness weight according to the video type corresponding to the video stream.
[0124] In the embodiments of the present application, because each video stream of each video type has unique picture characteristics, the terminal device needs to determine the hue weight, saturation weight and brightness weight corresponding to each video stream according to the video type corresponding to each video stream, so as to ensure the effect of color enhancement processing.
[0125] In an embodiment, for game video, the game video needs to render the game scene more vividly, thereby increasing visual appeal. Therefore, when performing color enhancement, the saturation weight can be appropriately increased.
[0126] For movie video, good color tone can better create a visual atmosphere and emotional atmosphere more in line with the story narration. Therefore, when performing color enhancement, the hue weight can be appropriately increased.
[0127] For animation video, animation video usually has the characteristics of bright, vivid colors and high saturation, which makes the animation video more vivid and colorful. Therefore, when performing color enhancement, the saturation weight can be appropriately increased.
[0128] For documentary video, documentary video is usually based on real scenes and visual narration, and pursues authenticity and realism. Therefore, when performing color enhancement, the hue weight can be appropriately increased.
[0129] For sports video, sports video needs to emphasize the vivid and bright features of the sports scene, and highlight the details of the athletes and the sports field. Therefore, when performing color enhancement, the saturation weight and the brightness weight can be appropriately increased.
[0130] (c3) determining target color enhancement adjustment data according to the first proportion, the hue weight, the saturation average value and the saturation weight, and the brightness average value and the brightness weight.
[0131] In the embodiments of the present application, because the video streams of different video types have unique picture characteristics and also match personalized user needs, when performing color enhancement processing, the hue weight, the saturation weight and the brightness weight are determined according to the video type corresponding to the video stream, and then the target color enhancement adjustment data is calculated, which makes the color enhancement effect of different color enhancement dimensions affected by differentiated weights, so as to achieve the best color enhancement effect.
[0132] For ease of description, the first proportion is denoted as D1, the hue weight is denoted as k1, the saturation average value is denoted as S1, the saturation weight is denoted as k2, the brightness average value is denoted as L1, and the brightness weight is denoted as k3.
[0133] In an embodiment, the step (c3) can be implemented in a first way: the first proportion, the average hue, the average saturation and the average brightness are weighted and summed according to the hue weight, the saturation weight and the brightness weight to determine the target color enhancement adjustment data.
[0134] For example, the weighted sum value obtained by the weighted sum processing is denoted as w, and the calculation formula of w can be as follows:
[0135] w=D1*k1+S1*k2+L1*k3 Formula 1
[0136] The target color enhancement adjustment data corresponding to the first way is denoted as W1, and the calculation formula of W1 can be as follows:
[0137] W1=num1-w=num1-(D1*k1+S1*k2+L1*k3) Formula 2
[0138] num1 is a first adjustment constant, and num1 can be self-defined, such as num1 being 100. k1, k2 and k3 are all greater than 0. When the values of D1, S1 and L1 are larger, it indicates that the current picture is more sensitive to color enhancement changes, and through the first adjustment constant, a lower degree of color enhancement processing can be performed on the image frame in this case (i.e., the target color enhancement adjustment data value is smaller), thereby ensuring the effect of color enhancement processing.
[0139] In an embodiment, the step (c3) can be implemented in a second way:
[0140] (c31), determining the contrast enhancement adjustment data according to the first proportion and the hue weight, determining the saturation enhancement adjustment data according to the average saturation and the saturation weight, and determining the brightness enhancement adjustment data according to the average brightness and the brightness weight.
[0141] For example, the contrast enhancement adjustment data, the saturation enhancement adjustment data and the brightness enhancement adjustment data corresponding to the second way are respectively denoted as W2, W3 and W4, and the calculation formula of W2 can be as follows:
[0142] W2=num2-D1*k1 Formula 3
[0143] The calculation formula of W3 can be as follows:
[0144] W3=num3-S1*k2 Formula 4
[0145] The calculation formula of W4 can be as follows:
[0146] W4=num4-L1*k3 Formula 5
[0147] Wherein, num2, num3, num4 are respectively the second adjustment constant, the third adjustment constant and the fourth adjustment constant, num2, num3, num4 can be self-defined, num1, num2, num3, num4 can be the same or different, such as num1, num2, num3, num4 are all 100. When the value of D1, S1 or L1 is larger, it indicates that the current picture is more sensitive to color enhancement changes, and through the second adjustment constant, the third adjustment constant and the fourth adjustment constant, the image frame can be processed with lower degree of color enhancement (i.e. the target color enhancement adjustment data value is smaller) in this case, so as to ensure the effect of color enhancement processing.
[0148] (c32), determining the contrast enhancement adjustment data, the saturation enhancement adjustment data and the brightness enhancement adjustment data as the target color enhancement adjustment data.
[0149] In the embodiment of the application, the terminal device can determine the contrast enhancement adjustment data W2, the saturation enhancement adjustment data W3 and the brightness enhancement adjustment data W4 as the target color enhancement adjustment data. The target color enhancement adjustment data at this time includes three adjustment data corresponding to contrast, saturation and brightness.
[0150] In an embodiment, the step (c31) of determining the contrast enhancement adjustment data according to the first proportion and the hue weight can be implemented by the following steps: determining the contrast enhancement adjustment data according to the first proportion and the hue weight, and referring to the analysis data. The reference analysis data can be the saturation average value and the saturation weight, the reference data can also be the brightness average value and the brightness weight, and the reference data can also be the saturation average value and the saturation weight, and the brightness average value and the brightness weight. Through the above method, the accuracy and reliability of the contrast enhancement adjustment data are improved.
[0151] S308, performing color enhancement processing on the first image frame and each second image frame according to the target color enhancement adjustment data.
[0152] Wherein, the second image frame is an image frame in the video stream, the playing time corresponding to the second image frame is later than the playing time corresponding to the first image frame, and the time interval between the playing time corresponding to the second image frame and the playing time corresponding to the first image frame is less than or equal to the time interval threshold.
[0153] In an embodiment, based on the first mode of step (c3), the above step S308 can be implemented according to the following steps:
[0154] (d1), determining a first contrast enhancement value, a first saturation enhancement value and a first brightness enhancement value according to the target color enhancement adjustment data.
[0155] Exemplarily, the first contrast enhancement value is denoted as a1, the first saturation enhancement value is denoted as b1, and the first brightness enhancement value is denoted as c1. Then, the calculation formula of a1 can be as follows:
[0156] a1 = W1 * A, Equation 6
[0157] wherein A is a mapping coefficient of contrast, and is a constant.
[0158] The calculation formula of b1 can be as follows:
[0159] b1 = W1 * B, Equation 7
[0160] wherein B is a mapping coefficient of saturation, and is a constant.
[0161] The calculation formula of c1 can be as follows:
[0162] c1 = W1 * C, Equation 8
[0163] wherein C is a mapping coefficient of brightness, and is a constant. A, B, and C can be respectively understood as a contrast weight, a saturation weight, and a brightness weight, which can be determined by the terminal device according to the video type of the video stream. The determination method of the contrast weight, the saturation weight, and the brightness weight can refer to the method of determining the hue weight, the saturation weight, and the brightness weight in the foregoing embodiments, and details are not described herein again.
[0164] (d2), according to the first contrast enhancement value, the first saturation enhancement value, and the first brightness enhancement value, respectively enhancing the contrast, the saturation, and the brightness of the first image frame and each second image frame to obtain the first image frame and each second image frame after color enhancement processing.
[0165] In an embodiment, under the implementation of this mode, the terminal device can adjust the contrast of the first image frame and each second image frame to the first contrast enhancement value a1, adjust the saturation of the first image frame and each second image frame to the first saturation enhancement value b1, and adjust the brightness of the first image frame and each second image frame to the first brightness enhancement value c1.
[0166] Based on the first mode of step (c3), step S308 (color enhancement processing of the first image frame and each second image frame according to the target color enhancement adjustment data) can implement the adjustment of multiple color enhancement modules through a common color enhancement adjustment interface (such as a color enhancement adjustment interface 1 corresponding to W1), and the color enhancement modules are, for example, a contrast enhancement module, a saturation enhancement module, a brightness enhancement module, and the like.
[0167] Meanwhile, each color enhancement module includes multiple adjustment parameters, such as parameters p1, p2, p3 in the contrast enhancement module. The p1, p2, p3 can be respectively adjusted through a common color enhancement adjustment interface (such as color enhancement adjustment interface 1), and the calculation formulas of the color enhancement adjusted p1, p2, p3 can be as follows:
[0168] p1 = a1*P1 = W1*A*P1 Equation 9
[0169] p2 = b1*P2 = W1*B*P2 Equation 10
[0170] p3 = c1*P3 = W1*C*P3 Equation 11
[0171] Wherein, a1 is a first contrast enhancement value, b1 is a first saturation enhancement value, c1 is a first brightness enhancement value, P1, P2, P3 are respectively mapping coefficients of parameters p1, p2, p3, and W1 is a constant.
[0172] Through the common color enhancement adjustment interface, the adjustment of the multiple adjustment parameters in each color enhancement module is realized.
[0173] In an embodiment, the above step S308 can be realized according to the following steps based on the second mode of step (c3):
[0174] (e1) determining a second contrast enhancement value according to the contrast enhancement adjustment data, determining a second saturation enhancement value according to the saturation enhancement adjustment data, and determining a second brightness enhancement value according to the brightness enhancement adjustment data.
[0175] For example, the second contrast enhancement value is denoted as a2, the second saturation enhancement value is denoted as b2, and the second brightness enhancement value is denoted as c2. Then, the calculation formula of a2 can be as follows:
[0176] a2 = W2*A Equation 12
[0177] Wherein, A is a mapping coefficient of contrast, and W2 is a constant.
[0178] The calculation formula of b2 can be as follows:
[0179] b2 = W3*B Equation 13
[0180] Wherein, B is a mapping coefficient of saturation, and W3 is a constant.
[0181] The calculation formula of c2 can be as follows:
[0182] c2 = W4*C Equation 14
[0183] Wherein, C is a mapping coefficient of brightness, and W4 is a constant.
[0184] (e2) Based on the second contrast enhancement value, the second saturation enhancement value, and the second brightness enhancement value, the contrast, saturation, and brightness of the first image frame and each of the second image frames are enhanced respectively to obtain the first image frame and each of the second image frames after color enhancement.
[0185] In one embodiment, under this implementation, the terminal device can adjust the contrast of the first image frame and each of the second image frames to a second contrast enhancement value a2, adjust the saturation of the first image frame and each of the second image frames to a second saturation enhancement value b2, and adjust the brightness of the first image frame and each of the second image frames to a second brightness enhancement value c2.
[0186] Based on the second method of step (c3), step S308 (performing color enhancement processing on the first image frame and each of the second image frames according to the target color enhancement adjustment data) can be implemented through multiple color enhancement adjustment interfaces (such as color enhancement adjustment interface 2 corresponding to W2, color enhancement adjustment interface 3 corresponding to W3, and color enhancement adjustment interface 4 corresponding to W4) to adjust multiple color enhancement modules, such as contrast enhancement modules, saturation enhancement modules, and brightness enhancement modules. It should be noted that the terminal device can also encapsulate multiple color enhancement adjustment interfaces into a single color enhancement adjustment interface, which will not be elaborated further in this embodiment.
[0187] Meanwhile, each color enhancement module includes multiple adjustment parameters, such as parameters p1, p2, and p3 in the contrast enhancement module. Through multiple color enhancement adjustment interfaces (such as color enhancement adjustment interface 2, color enhancement adjustment interface 3, and color enhancement adjustment interface 4), p1, p2, and p3 can be adjusted separately. The calculation formulas for p1, p2, and p3 after color enhancement adjustment are as follows:
[0188] p1=a2*P1=W2*A*P1 Equation 15
[0189] p2=b2*P2=W3*B*P2 Equation 16
[0190] p3 = c2 * P3 = W4 * C * P3 Equation 17
[0191] Where a2 is the second contrast enhancement value, b2 is the second saturation enhancement value, c2 is the second brightness enhancement value, and P1, P2, and P3 are the mapping coefficients of parameters p1, p2, and p3, respectively, which are constants.
[0192] Multiple color enhancement adjustment interfaces enable adjustments to various parameters within each color enhancement module.
[0193] In an embodiment, the terminal device can also only interface package one of the color enhancement modules, and perform color enhancement adjustment based on the interface, such as the saturation enhancement module. The terminal device can also only package one of the adjustment parameters in one or more color enhancement modules, and perform color enhancement adjustment based on the packaged adjustment parameter, such as p1 in the saturation enhancement module (p1 is the parameter in the saturation enhancement module that most affects the degree of change in subjective perception of the picture), which is not limited in the embodiment of the present application.
[0194] S309, when it is determined according to the color distribution difference data that the color enhancement adjustment condition is not met, obtaining reference color enhancement adjustment data corresponding to the reference image frame.
[0195] S310, performing color enhancement processing on the first image frame and each second image frame according to the reference color enhancement adjustment data.
[0196] In the steps S309-S310 described above, when it is detected that the scene switching does not occur between the first image frame and the reference image frame (i.e., it is determined according to the color distribution difference data that the color enhancement adjustment condition is not met), the terminal device can directly use the reference color enhancement adjustment data corresponding to the reference image frame to perform color enhancement processing on the first image frame and each second image frame.
[0197] In an embodiment, the process of determining the reference color enhancement adjustment data by the terminal device can be: determining the reference color enhancement adjustment data according to the second proportion, the average saturation value and the average brightness value included in the second color distribution data. For specific implementation manners, please refer to the related description of determining the target color enhancement adjustment data according to the first color distribution data in the foregoing embodiment, which will not be described herein again.
[0198] In an embodiment, when the reference image frame is the initial image frame in the video stream, the terminal device first needs to calculate the reference color enhancement adjustment data according to the second color distribution data of the reference image frame, and then perform the step S310. When the reference image frame is not the initial image frame in the video stream (for example, the reference image frame is the image frame 6 in FIG. 6), the reference color enhancement adjustment data has been calculated in the color difference detection process of the previous video stream, so the terminal device can directly obtain the reference color enhancement adjustment data and perform the step S310. Through the above method, repeated calculation can be avoided, the efficiency of color difference detection is improved, and the overall efficiency of color enhancement processing on the video stream is improved. Figure 1
[0199] Please refer to Figure 4 , Figure 4 is a processing flow chart of a color enhancement processing provided by an example embodiment of the present application. The terminal device first needs to encapsulate a color enhancement adjustment interface, such as color enhancement adjustment interface 1. Then, a scene switching detection time interval is counted. When the time interval is detected as t1 (that is, the color difference detection condition is met, where t1 can refer to a target time interval), the terminal device performs scene switching detection on the video stream (such as determining a first image frame from the video stream, and obtaining first color distribution data of the first image frame; obtaining second color distribution data of a reference image frame, and determining color distribution difference data between the first color distribution data and the second color distribution data).
[0200] When it is determined according to the color distribution difference data that the color enhancement adjustment condition is met, it means that scene switching has occurred. Then, the terminal device adaptively generates color enhancement adjustment data (such as determining target color enhancement adjustment data according to the first color distribution data), and performs color enhancement adjustment processing on the video stream (such as performing color enhancement processing on the first image frame and each second image frame according to the target color enhancement adjustment data).
[0201] When it is determined according to the color distribution difference data that the color enhancement adjustment condition is not met, it means that scene switching has not occurred. Then, the terminal device continues to use the previous color enhancement adjustment data (such as reference color enhancement adjustment data corresponding to the reference image frame), and performs color enhancement adjustment processing on the video stream (such as performing color enhancement processing on the first image frame and each second image frame according to the reference color enhancement adjustment data). When the terminal device detects that the stop condition is met (such as processing the last image frame in the video stream), the flow ends. When the terminal device detects that the stop condition is not met, the steps of counting the scene switching detection time interval and the subsequent steps are repeatedly executed.
[0202] Based on the above embodiment, the present application has the beneficial effects that: the embodiments of the present application can implement adaptive color enhancement processing for different game types, game scenes, and game color richness, avoid too low color enhancement intensity leading to no obvious changes in the picture, or too high color enhancement intensity leading to picture processing being too much, subjective perception of color being too saturated, or contrast being too high, thereby ensuring the effect of color enhancement processing.
[0203] Referring to Figure 5 , the figure is a schematic block diagram of an image processing apparatus provided by an embodiment of the present application. The image processing apparatus specifically can include:
[0204] The obtaining module 501 is configured to, when the color difference detection condition is met, determine a first image frame from the video stream, and obtain first color distribution data of the first image frame.
[0205] The processing module 502 is configured to acquire second color distribution data of a reference image frame, and determine color distribution difference data between the first color distribution data and the second color distribution data; the reference image frame is an image frame in the video stream, and a playing time corresponding to the reference image frame is earlier than a playing time corresponding to the first image frame;
[0206] The processing module 502 is further configured to, when it is determined according to the color distribution difference data that the color enhancement adjustment condition is met, determine target color enhancement adjustment data according to the first color distribution data;
[0207] The color enhancement module 503 is configured to perform color enhancement processing on the first image frame and each second image frame according to the target color enhancement adjustment data; the second image frame is an image frame in the video stream, a playing time corresponding to the second image frame is later than the playing time corresponding to the first image frame, and a time interval between the playing time corresponding to the second image frame and the playing time corresponding to the first image frame is less than or equal to a time interval threshold.
[0208] Optionally, the processing module 502 is further configured to:
[0209] acquire reference color enhancement adjustment data corresponding to the reference image frame when it is determined according to the color distribution difference data that the color enhancement adjustment condition is not met;
[0210] perform color enhancement processing on the first image frame and each second image frame according to the reference color enhancement adjustment data.
[0211] Optionally, when the acquiring module 501 is used to acquire the first color distribution data of the first image frame, the acquiring module 501 is specifically configured to:
[0212] convert the first image frame from a first color space to a second color space to obtain a first image frame converted in color space; the second color space includes a hue channel;
[0213] determine a first proportion of target class pixel points in the first image frame converted in color space, the hue of the target class pixel points being one or more of red, green and blue;
[0214] determine the first color distribution data of the first image frame according to the first proportion.
[0215] Optionally, the first color distribution data includes the first proportion, and the second color distribution data includes a second proportion; the second proportion is a proportion of the target class pixel points in a reference image frame converted into the second color space.
[0216] The processing module 502 is specifically configured to:
[0217] determine a change rate between the first proportion and the second proportion;
[0218] determine the color distribution difference data between the first color distribution data and the second color distribution data according to the change rate between the first proportion and the second proportion.
[0219] Optionally, the acquisition module 501 is specifically configured to:
[0220] determine a first red proportion of the pixel points with a red hue, a first green proportion of the pixel points with a green hue, and a first blue proportion of the pixel points with a blue hue in the first image frame converted in the color space;
[0221] determine the first red proportion, the first green proportion, and the first blue proportion as the first proportion of the target class pixel points in the first image frame converted in the color space;
[0222] The second proportion includes a second red proportion, a second green proportion, and a second blue proportion, and the second red proportion, the second green proportion, and the second blue proportion are proportions of the pixel points with a red hue, the pixel points with a green hue, and the pixel points with a blue hue in the reference image frame converted into the second color space, respectively;
[0223] The processing module 502 is specifically configured to:
[0224] determine a first total proportion according to the first red proportion, the first green proportion, and the first blue proportion, and determine a second total proportion according to the second red proportion, the second green proportion, and the second blue proportion;
[0225] determine the change rate between the first total proportion and the second total proportion as the change rate between the first proportion and the second proportion.
[0226] Optionally, the second color space further includes a saturation channel and a brightness channel, and the processing module 502 is further configured to:
[0227] determine an average saturation value of the target class pixel points in the first image frame converted in the color space, and determine an average brightness value of the target class pixel points in the first image frame converted in the color space.
[0228] The processing module 502 is specifically configured to:
[0229] determine the target color enhancement adjustment data according to the first proportion, the average saturation value, and the average brightness value included in the first color distribution data.
[0230] Optionally, the processing module 502 is specifically configured to:
[0231] obtain a video type corresponding to the video stream;
[0232] determine a hue weight, a saturation weight, and a brightness weight according to the video type corresponding to the video stream;
[0233] determine the target color enhancement adjustment data according to the first proportion, the hue weight, the average saturation value, the saturation weight, the average brightness value, and the brightness weight.
[0234] Optionally, the processing module 502 is specifically configured to:
[0235] perform weighted sum processing on the first proportion, the average saturation value, and the average brightness value according to the hue weight, the saturation weight, and the brightness weight, to determine the target color enhancement adjustment data.
[0236] The color enhancement module 503 is specifically configured to:
[0237] determine a first contrast enhancement value, a first saturation enhancement value, and a first brightness enhancement value according to the target color enhancement adjustment data;
[0238] perform enhancement processing on contrast, saturation, and brightness of the first image frame and each second image frame respectively according to the first contrast enhancement value, the first saturation enhancement value, and the first brightness enhancement value, to obtain the first image frame and each second image frame after color enhancement processing.
[0239] Optionally, the processing module 502 is configured to:
[0240] determine the contrast enhancement adjustment data according to the first proportion and the hue weight, determine the saturation enhancement adjustment data according to the saturation average value and the saturation weight, and determine the brightness enhancement adjustment data according to the brightness average value and the brightness weight;
[0241] determine the target color enhancement adjustment data according to the contrast enhancement adjustment data, the saturation enhancement adjustment data, and the brightness enhancement adjustment data;
[0242] The color enhancement module 503 is configured to:
[0243] determine the second contrast enhancement value according to the contrast enhancement adjustment data, determine the second saturation enhancement value according to the saturation enhancement adjustment data, and determine the second brightness enhancement value according to the brightness enhancement adjustment data;
[0244] enhance the contrast, saturation, and brightness of the first image frame and each second image frame according to the second contrast enhancement value, the second saturation enhancement value, and the second brightness enhancement value, respectively, to obtain the color-enhanced first image frame and each second image frame.
[0245] Based on the image processing device, when the color difference detection condition is met, the first image frame is determined from the video stream, and the first color distribution data of the first image frame is obtained.
[0246] Then, the second color distribution data of a reference image frame before the first image frame is obtained, and the color distribution difference data between the first color distribution data and the second color distribution data is determined.
[0247] When it is determined according to the color distribution difference data that the color enhancement adjustment condition is met, it is considered that a scene switch occurs between the reference image frame and the first image frame.
[0248] Based on the first color distribution data and the second color distribution data with small data volume for scene switch detection, the content of the image frame is avoided to be recognized for scene recognition, thereby improving the efficiency of scene switch detection and reducing the cost.
[0249] Finally, target color enhancement adjustment data is determined according to the first color distribution data, and the first image frame and each second image frame after the first image frame are subjected to color enhancement processing according to the target color enhancement adjustment data.
[0250] Compared with color enhancement processing using fixed color enhancement adjustment data, the above method realizes continuous color difference detection for the video stream, thereby realizing adaptive adjustment of the color enhancement adjustment data. Color enhancement processing of the video stream based on the color enhancement adjustment data that is adaptively adjusted can improve the effect of color enhancement processing.
[0251] It should be noted that the functions of each functional module of the image processing apparatus of the embodiments of the present application can be specifically implemented according to the methods in the above method embodiments, and the specific implementation process can be referred to the related description of the above method embodiments, which will not be described here.
[0252] Please refer to Figure 6 , which is a schematic block diagram of a computer device provided by an embodiment of the present application. As Figure 6 indicated, the computer device in the present embodiment can include a processor 601, a storage device 602, and a communication interface 603. The processor 601, the storage device 602, and the communication interface 603 can exchange data.
[0253] The storage device 602 can include a volatile memory, such as a random-access memory (RAM). The storage device 602 can also include a non-volatile memory, such as a flash memory, a solid-state drive (SSD), etc. The storage device 602 can also include a combination of the above types of memories.
[0254] The processor 601 can be a central processing unit (CPU). In an embodiment, the processor 601 can also be a graphics processing unit (GPU). The processor 601 can also be a combination of a CPU and a GPU. In an embodiment, the storage device 602 is configured to store program instructions, and the processor 601 can invoke the program instructions to perform the following operations:
[0255] When the color difference detection condition is met, a first image frame is determined from the video stream, and first color distribution data of the first image frame is obtained;
[0256] acquire second color distribution data of a reference image frame, and determine color distribution difference data between the first color distribution data and the second color distribution data; the reference image frame is an image frame in the video stream, and a playing time corresponding to the reference image frame is earlier than a playing time corresponding to the first image frame;
[0257] when it is determined according to the color distribution difference data that the color enhancement adjustment condition is met, determine target color enhancement adjustment data according to the first color distribution data;
[0258] perform color enhancement processing on the first image frame and each second image frame according to the target color enhancement adjustment data; the second image frame is an image frame in the video stream, a playing time corresponding to the second image frame is later than the playing time corresponding to the first image frame, and a time interval between the playing time corresponding to the second image frame and the playing time corresponding to the first image frame is less than or equal to a time interval threshold.
[0259] Optionally, the processor 601 is further configured to:
[0260] when it is determined according to the color distribution difference data that the color enhancement adjustment condition is not met, acquire reference color enhancement adjustment data corresponding to the reference image frame;
[0261] perform color enhancement processing on the first image frame and each second image frame according to the reference color enhancement adjustment data.
[0262] Optionally, when the processor 601 is used to acquire the first color distribution data of the first image frame, the processor 601 is specifically configured to:
[0263] convert the first image frame from a first color space to a second color space to obtain a first image frame after color space conversion; the second color space includes a hue channel;
[0264] determine a first proportion of target class pixel points in the first image frame after color space conversion; the hue of the target class pixel points is one or more of red, green and blue;
[0265] determine the first color distribution data of the first image frame according to the first proportion.
[0266] Optionally, the first color distribution data includes the first proportion, and the second color distribution data includes a second proportion; the second proportion is a proportion of the target class pixel points in a reference image frame converted to the second color space;
[0267] The processor 601 is specifically configured to:
[0268] determine a change rate between the first proportion and the second proportion;
[0269] determine the color distribution difference data between the first color distribution data and the second color distribution data according to the change rate between the first proportion and the second proportion.
[0270] Optionally, the processor 601 is specifically configured to, when determining the first proportion of the target class pixel points in the first image frame converted in the color space:
[0271] determine a first red proportion of the pixel points with a hue of red, a first green proportion of the pixel points with a hue of green, and a first blue proportion of the pixel points with a hue of blue in the first image frame converted in the color space;
[0272] determine the first red proportion, the first green proportion, and the first blue proportion as the first proportion of the target class pixel points in the first image frame converted in the color space;
[0273] The second proportion includes a second red proportion, a second green proportion, and a second blue proportion, and the second red proportion, the second green proportion, and the second blue proportion are proportions of the pixel points with a hue of red, a hue of green, and a hue of blue in the reference image frame converted into the second color space, respectively.
[0274] The processor 601 is specifically configured to:
[0275] determine a first total proportion according to the first red proportion, the first green proportion, and the first blue proportion, and determine a second total proportion according to the second red proportion, the second green proportion, and the second blue proportion;
[0276] determine the change rate between the first total proportion and the second total proportion as the change rate between the first proportion and the second proportion.
[0277] Optionally, the second color space further includes a saturation channel and a brightness channel, and the processor 601 is further configured to:
[0278] determine an average value of saturation of the target class pixel points in the first image frame converted in the color space, and determine an average value of brightness of the target class pixel points in the first image frame converted in the color space;
[0279] The processor 601 is configured to:
[0280] The processor 601 is configured to determine the target color enhancement adjustment data according to the first proportion, the average saturation value, and the average brightness value included in the first color distribution data.
[0281] The processor 601 is configured to:
[0282] The processor 601 is configured to obtain a video type corresponding to the video stream.
[0283] The processor 601 is configured to determine a hue weight, a saturation weight, and a brightness weight according to the video type corresponding to the video stream.
[0284] The processor 601 is configured to determine the target color enhancement adjustment data according to the first proportion, the hue weight, the average saturation value, the saturation weight, the average brightness value, and the brightness weight.
[0285] The processor 601 is configured to:
[0286] The processor 601 is configured to determine the target color enhancement adjustment data by performing weighted sum processing on the first proportion, the average saturation value, and the average brightness value according to the hue weight, the saturation weight, and the brightness weight.
[0287] The processor 601 is configured to:
[0288] The processor 601 is configured to determine a first contrast enhancement value, a first saturation enhancement value, and a first brightness enhancement value according to the target color enhancement adjustment data.
[0289] The processor 601 is configured to perform enhancement processing on the contrast, the saturation, and the brightness of the first image frame and each second image frame, respectively, according to the first contrast enhancement value, the first saturation enhancement value, and the first brightness enhancement value, to obtain the first image frame and each second image frame after color enhancement processing.
[0290] Optionally, the processor 601 is specifically configured to:
[0291] determine the contrast enhancement adjustment data according to the first proportion and the hue weight, determine the saturation enhancement adjustment data according to the saturation average value and the saturation weight, and determine the brightness enhancement adjustment data according to the brightness average value and the brightness weight;
[0292] determine the target color enhancement adjustment data according to the contrast enhancement adjustment data, the saturation enhancement adjustment data and the brightness enhancement adjustment data;
[0293] The processor 601 is specifically configured to:
[0294] determine the second contrast enhancement value according to the contrast enhancement adjustment data, determine the second saturation enhancement value according to the saturation enhancement adjustment data, and determine the second brightness enhancement value according to the brightness enhancement adjustment data;
[0295] enhance the contrast, the saturation and the brightness of the first image frame and each second image frame according to the second contrast enhancement value, the second saturation enhancement value and the second brightness enhancement value, respectively, to obtain the first image frame and each second image frame after color enhancement processing.
[0296] Based on the computer device, when the color difference detection condition is met, the first image frame is determined from the video stream, and the first color distribution data of the first image frame is obtained.
[0297] Then, the second color distribution data of the reference image frame before the first image frame is obtained, and the color distribution difference data between the first color distribution data and the second color distribution data is determined.
[0298] When it is determined according to the color distribution difference data that the color enhancement adjustment condition is met, it is considered that the scene switching occurs between the reference image frame and the first image frame.
[0299] Based on the first color distribution data and the second color distribution data with small data volume for scene switching detection, the content of the image frame can be avoided for scene recognition, thereby improving the efficiency of scene switching detection and reducing the cost.
[0300] Finally, target color enhancement adjustment data is determined according to the first color distribution data, and the first image frame and each second image frame after the first image frame are subjected to color enhancement processing according to the target color enhancement adjustment data.
[0301] Compared with color enhancement processing using fixed color enhancement adjustment data, the above method realizes continuous color difference detection for the video stream, thereby realizing adaptive adjustment of the color enhancement adjustment data. Color enhancement processing of the video stream based on the color enhancement adjustment data that is adaptively adjusted can improve the effect of color enhancement processing.
[0302] In a specific implementation, the processor 601, the storage device 602, and the communication interface 603 described in the embodiments of the present application can execute the method in the foregoing embodiments of the present application Figure 2 or Figure 3 The implementation manners described in the related embodiments of the image processing method provided in the present application can also execute the method in the embodiments of the present application Figure 5 The implementation manners described in the related embodiments of the image processing apparatus provided in the present application will not be described here again.
[0303] In several embodiments provided in the present application, it should be understood that the disclosed method, apparatus and system can be implemented by other manners. For example, the apparatus embodiments described above are only illustrative; for example, the division of the units is only a logical function division, and another division manner can be used in actual implementation; for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units or components shown or discussed can be indirect coupling or communication connection through some interfaces, apparatuses or units, and can be electrical, mechanical or other forms.
[0304] In addition, it should be noted here that the embodiments of the present application further provide a computer readable storage medium, and the computer readable storage medium stores the computer program executed by the image processing apparatus mentioned above, and the computer program includes program instructions. When the processor executes the above program instructions, the method in the foregoing embodiments can be executed, and therefore, the description will not be repeated here. In addition, the beneficial effects of using the same method will not be described again. For technical details of the computer readable storage medium embodiments involved in the present application, please refer to the description of the method embodiments of the present application. As an example, the program instructions can be deployed on one computer device, or executed on a plurality of computer devices located in one place, or executed on a plurality of computer devices distributed in multiple places and interconnected through a communication network. The plurality of computer devices distributed in multiple places and interconnected through a communication network can constitute a blockchain system.
[0305] According to an aspect of the present application, a computer program product is provided, 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 the processor executes the computer instructions, so that the computer device can execute the method in the foregoing embodiments, and thus, no further description will be given herein.
[0306] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by a computer program instructing related hardware. The above-mentioned program can be stored in a computer readable storage medium, and when the program is executed, the program can include the processes of the above-mentioned embodiments. The storage medium can be a magnetic disc, an optical disc, a read-only memory (ROM), a random access memory (RAM), or the like.
[0307] The above only describes some embodiments of the present application, and of course cannot limit the scope of the present application. Those skilled in the art can understand that all or part of the processes of the above-mentioned embodiments can be implemented, and equivalent changes made according to the claims of the present application still fall within the scope of the present application.
Claims
1. An image processing method, characterized by, The method comprises: determining a first image frame from a video stream when a color difference detection condition is met; converting the first image frame from a first color space to a second color space to obtain a first image frame converted in color space; the second color space comprises a hue channel; determining a first proportion of target class pixel points in the first image frame converted in color space, the hue of the target class pixel points being one or more of red, green and blue; determining first color distribution data of the first image frame according to the first proportion; obtaining second color distribution data of a reference image frame, and determining color distribution difference data between the first color distribution data and the second color distribution data; wherein the reference image frame is an image frame in the video stream, and the playback time corresponding to the reference image frame is earlier than the playback time corresponding to the first image frame; determining target color enhancement adjustment data according to the first color distribution data when it is determined according to the color distribution difference data that a color enhancement adjustment condition is met; performing color enhancement processing on the first image frame and each second image frame according to the target color enhancement adjustment data; wherein the second image frame is an image frame in the video stream, the playback time corresponding to the second image frame is later than the playback time corresponding to the first image frame, and the time interval between the playback time corresponding to the second image frame and the playback time corresponding to the first image frame is less than or equal to a time interval threshold.
2. The method of claim 1, wherein, The method further comprises: obtaining reference color enhancement adjustment data corresponding to the reference image frame when it is determined according to the color distribution difference data that the color enhancement adjustment condition is not met; performing color enhancement processing on the first image frame and each second image frame according to the reference color enhancement adjustment data.
3. The method according to claim 1 or 2, characterized in that, The first color distribution data comprises the first proportion, and the second color distribution data comprises a second proportion, the second proportion being the proportion of the target class pixel points in the reference image frame converted to the second color space; wherein the determination of the color distribution difference data between the first color distribution data and the second color distribution data comprises: determining a change rate between the first proportion and the second proportion; determining the color distribution difference data between the first color distribution data and the second color distribution data according to the change rate between the first proportion and the second proportion.
4. The method of claim 3, wherein, The determination of the first proportion of target class pixel points in the first image frame converted in color space comprises: determining a first red proportion of pixel points with a red hue, a first green proportion of pixel points with a green hue, and a first blue proportion of pixel points with a blue hue in the first image frame converted in color space; determining the first red proportion, the first green proportion and the first blue proportion as the first proportion of target class pixel points in the first image frame converted in color space; The second proportion includes a second red proportion, a second green proportion and a second blue proportion, and the second red proportion, the second green proportion and the second blue proportion are proportions of pixel points with red, green and blue hues respectively in the reference image frame converted to the second color space. The determining of the change rate between the first proportion and the second proportion comprises: determining a first total proportion according to the first red proportion, the first green proportion and the first blue proportion, and determining a second total proportion according to the second red proportion, the second green proportion and the second blue proportion; The change rate between the first total proportion and the second total proportion is determined as the change rate between the first proportion and the second proportion.
5. The method according to claim 1 or 2, characterized in that, The second color space further includes a saturation channel and a brightness channel, and the method further comprises: determining an average value of saturation of the target class pixel points in the first image frame after the color space conversion, and determining an average value of brightness of the target class pixel points in the first image frame after the color space conversion; The determining of the target color enhancement adjustment data according to the first color distribution data comprises: determining target color enhancement adjustment data according to the first proportion, the average value of saturation and the average value of brightness included in the first color distribution data.
6. The method of claim 5, wherein, The determining of the target color enhancement adjustment data according to the first proportion, the average value of saturation and the average value of brightness included in the first color distribution data comprises: obtaining a video type corresponding to the video stream; determining a hue weight, a saturation weight and a brightness weight according to the video type corresponding to the video stream; determining target color enhancement adjustment data according to the first proportion and the hue weight, the average value of saturation and the saturation weight, and the average value of brightness and the brightness weight.
7. The method of claim 6, wherein, The determining of the target color enhancement adjustment data according to the first proportion and the hue weight, the average value of saturation and the saturation weight, and the average value of brightness and the brightness weight comprises: performing weighted summation processing on the first proportion, the average value of saturation and the average value of brightness according to the hue weight, the saturation weight and the brightness weight to determine target color enhancement adjustment data; The color enhancement processing of the first image frame and each second image frame according to the target color enhancement adjustment data comprises: determining a first contrast enhancement value, a first saturation enhancement value and a first brightness enhancement value according to the target color enhancement adjustment data; performing enhancement processing on contrast, saturation and brightness of the first image frame and each second image frame respectively according to the first contrast enhancement value, the first saturation enhancement value and the first brightness enhancement value to obtain the first image frame and each second image frame after color enhancement processing.
8. The method of claim 6, wherein, The target color enhancement adjustment data is determined according to the first proportion, the hue weight, the saturation average value and the saturation weight, and the brightness average value and the brightness weight. The target color enhancement adjustment data is determined according to the first proportion, the hue weight, the saturation average value and the saturation weight, and the brightness average value and the brightness weight. The target color enhancement adjustment data is determined according to the first proportion, the hue weight, the saturation average value and the saturation weight, and the brightness average value and the brightness weight. The target color enhancement adjustment data is determined according to the first proportion, the hue weight, the saturation average value and the saturation weight, and the brightness average value and the brightness weight. The target color enhancement adjustment data is determined according to the first proportion, the hue weight, the saturation average value and the saturation weight, and the brightness average value and the brightness weight. The target color enhancement adjustment data is determined according to the first proportion, the hue weight, the saturation average value and the saturation weight, and the brightness average value and the brightness weight.
9. The method of claim 1 or 2, wherein, The video stream is a cloud game video stream.
10. An image processing apparatus characterized by comprising: The device comprises: The acquisition module is configured to determine a first image frame from a video stream when a color difference detection condition is met. The processing module is configured to convert the first image frame from a first color space to a second color space to obtain a first image frame converted in color space, wherein the second color space comprises a hue channel; determine a first proportion of target class pixel points in the first image frame converted in color space, wherein the hue of the target class pixel points is one or more of red, green and blue; and determine first color distribution data of the first image frame according to the first proportion. The processing module is further configured to obtain second color distribution data of a reference image frame, and determine color distribution difference data between the first color distribution data and the second color distribution data, wherein the reference image frame is an image frame in the video stream, and the playback time corresponding to the reference image frame is earlier than the playback time corresponding to the first image frame. The processing module is further configured to determine target color enhancement adjustment data according to the first color distribution data when it is determined according to the color distribution difference data that a color enhancement adjustment condition is met. The color enhancement module is configured to perform color enhancement processing on the first image frame and each second image frame according to the target color enhancement adjustment data, wherein the second image frame is an image frame in the video stream, the playback time corresponding to the second image frame is later than the playback time corresponding to the first image frame, and the time interval between the playback time corresponding to the second image frame and the playback time corresponding to the first image frame is less than or equal to a time interval threshold.
11. A computer device, comprising: The device comprises: A processor, a storage device and a communication interface, which are connected with each other, wherein the storage device stores executable program code, and the processor is configured to invoke the executable program code to implement the image processing method according to any one of claims 1-9.
12. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, which comprises program instructions, and the program instructions are executed by a processor to implement the image processing method according to any one of claims 1-9.
13. A computer program product, characterised in that, The computer program product comprises computer programs or computer instructions, and the computer programs or computer instructions are executed by a processor to implement the image processing method according to any one of claims 1-9.
Citation Information
Patent Citations
Video processing method and device, server and storage medium
CN109862389A