Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to fall within the scope of the application.
The embodiment of the application provides an image quality improving method, an image quality improving device, computer equipment and a storage medium. Specifically, the image quality improving method according to the embodiment of the present application may be performed by a computer device, where the computer device may be a terminal or a server. The terminal can be a smart phone, a tablet personal computer, a notebook computer, a desktop computer, a smart television, a smart sound box, a wearable smart device, a smart vehicle-mounted terminal and other devices, and the terminal can also comprise a client, wherein the client can be a video client, a browser client or an instant messaging client and the like. The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or 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, a content distribution network (Content Delivery Network, CDN), basic cloud computing services such as big data and an artificial intelligent platform.
The embodiment of the application can be applied to various scenes such as games, game basic technologies, data processing and the like.
For example, when the method is run on a terminal, the terminal device stores a game application and is used to present virtual scenes in a game screen. The terminal device is used for interacting with a user through a graphical user interface, for example, the terminal device downloads and installs a game application program and runs the game application program. The way in which the terminal device presents the graphical user interface to the user may include a variety of ways, for example, the graphical user interface may be rendered for display on a display screen of the terminal device, or presented by holographic projection. For example, the terminal device may include a touch display screen for presenting a graphical user interface including game screens and receiving operation instructions generated by a user acting on the graphical user interface, and a processor for running the game, generating the graphical user interface, responding to the operation instructions, and controlling the display of the graphical user interface on the touch display screen.
For example, when the method is run on a server, it may be a cloud game. Cloud gaming refers to a game style based on cloud computing. In the cloud game operation mode, an operation subject of the game application program and a game picture presentation subject are separated, and the storage and operation of the method are completed on a cloud game server. The game image presentation is completed at a cloud game client, which is mainly used for receiving and sending game data and presenting game images, for example, the cloud game client may be a display device with a data transmission function, such as a mobile terminal, a television, a computer, a palm computer, a personal digital assistant, etc., near a user side, but the terminal device for processing game data is a cloud game server in the cloud. When playing the game, the user operates the cloud game client to send an operation instruction to the cloud game server, the cloud game server runs the game according to the operation instruction, codes and compresses data such as game pictures and the like, returns the data to the cloud game client through a network, and finally decodes the data through the cloud game client and outputs the game pictures.
For example, when the method is running on a server, it may be live cloud. Cloud live broadcast refers to a live broadcast mode based on cloud computing. In the cloud live broadcast operation mode, an operation main body of a live broadcast application program and a live broadcast picture presentation main body are separated, and the storage and operation of the method are completed on a cloud live broadcast server. The live image presentation is completed at a client of the live cloud, and the live cloud audience is mainly used for receiving and sending live data and presenting live images, for example, the live cloud audience may be a display device with a data transmission function, such as a mobile terminal, a television, a computer, a palm computer, a personal digital assistant, etc., near a user side, but the computer device performing live data processing is a live cloud server of the cloud. When live broadcasting is carried out, a user operates the cloud live broadcasting audience terminal to send an operation instruction to the cloud live broadcasting server, the cloud live broadcasting server operates a live broadcasting program according to the operation instruction, data such as live broadcasting pictures and the like are encoded and compressed, the data are returned to the cloud live broadcasting audience terminal through a network, and finally, the cloud live broadcasting audience terminal decodes and outputs the live broadcasting pictures.
First, partial terms or terminology appearing in the course of describing the embodiments of the application are explained as follows:
Artificial intelligence (ARTIFICIAL INTELLIGENCE, AI) is the theory, method, technique, and application system that simulates, extends, and extends human intelligence using a digital computer or a machine controlled by a digital computer, perceives the environment, obtains knowledge, and uses the knowledge to obtain optimal results. In other words, artificial intelligence is an integrated technology of computer science that attempts to understand the essence of intelligence and to produce a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence, i.e. research on design principles and implementation methods of various intelligent machines, enables the machines to have functions of sensing, reasoning and decision.
Cloud technology (Cloud technology) refers to a hosting technology for integrating hardware, software, network and other series resources in a wide area network or a local area network to realize calculation, storage, processing and sharing of data. The cloud technology is based on the general names of network technology, information technology, integration technology, management platform technology, application technology and the like applied by the cloud computing business mode, can form a resource pool, and is flexible and convenient as required. Cloud computing technology will become an important support. Background services of technical networking systems require a large amount of computing, storage resources, such as video websites, picture-like websites, and more portals. Along with the high development and application of the internet industry, each article possibly has an own identification mark in the future, the identification mark needs to be transmitted to a background system for logic processing, data with different levels can be processed separately, and various industry data needs strong system rear shield support and can be realized only through cloud computing.
Cloud gaming (Cloud gaming), which may also be referred to as game on demand, is an online gaming technology based on Cloud computing technology. Cloud gaming technology enables lightweight devices (THIN CLIENT) with relatively limited graphics processing and data computing capabilities to run high quality games. In a cloud game scene, the game is not run in a player game terminal, but is run in a cloud server, the cloud server renders the game scene into a video and audio stream, and the video and audio stream is transmitted to the player game terminal through a network. The player game terminal does not need to have strong graphic operation and data processing capability, and only needs to have basic streaming media playing capability and the capability of acquiring player input instructions and sending the player input instructions to the cloud server.
A blockchain system may be a distributed system formed by a client, a plurality of nodes (any form of computing device in an access network, such as a server, user terminal) connected by way of network communications. The nodes form a point-To-point (P2P, peer To Peer) network, the P2P protocol is an application layer protocol running on top of a transmission control protocol (TCP, transmission Control Protocol) protocol, in a distributed system, any machine such as a server and a terminal can be added To become a node, and the node comprises a hardware layer, a middle layer, an operating system layer and an application layer.
Video coding, which is to convert the original video format file into another video format file by compression technology, the converted data can be called code stream.
Video decoding-the reverse process of video encoding.
The cloud server is a server running a game in the cloud, and has functions such as video enhancement (pre-coding processing) and video coding.
The intelligent terminal is a device which has rich man-machine interaction modes, has the capability of accessing the Internet, is generally provided with various operating systems and has stronger processing capability. The intelligent terminal comprises a smart phone, a living room television, a tablet personal computer, a vehicle-mounted terminal, a palm game host and the like.
In order to enable the cloud server and the intelligent terminal to perform better cooperation and cooperation, joint optimization is achieved, video coding configuration can be reasonably allocated according to hardware capacity and real-time performance of the intelligent terminal in the cloud game process, computing tasks such as video image processing and video content analysis are reasonably allocated, and cloud game image quality experience is further improved under limited cloud server resources.
And video coding cooperation, namely selecting optimal coding and decoding configuration and coding and decoding strategy according to the coding and decoding capability of the intelligent terminal and combining the game type and the user network type.
Video rendering cooperation, namely reasonably dividing video rendering tasks according to the graphic processing capability of the intelligent terminal, so that the cloud server and the intelligent terminal can effectively cooperate to improve video image quality. Including rendering region coordination, rendering task coordination, video analysis and processing coordination, and the like.
And the terminal state collaboration is to dynamically adjust the coding collaboration task and rendering collaboration strategy of the cloud server and the intelligent terminal according to the real-time performance of the operation of the intelligent terminal, so as to guarantee the optimal experience of the user in real time.
The cloud server and intelligent terminal collaboration framework mainly comprises a cloud server, an end cloud collaboration policy, an end cloud collaboration protocol, an intelligent terminal collaboration interface, a software and hardware collaboration module and the like.
The cloud server is a server running a game in the cloud, and has functions such as video enhancement (pre-coding processing) and video coding.
The terminal cloud cooperative strategy comprises a video coding cooperative strategy, a video rendering cooperative strategy and a terminal state cooperative strategy. And the cloud server formulates an optimal video coding rendering collaborative strategy according to the equipment capability reported by the intelligent terminal and by combining the game type and the user network environment. Meanwhile, the cloud server acquires the operation performance of the intelligent terminal in real time through terminal state coordination, and dynamically adjusts the terminal cloud coordination strategy.
The cloud end cooperative protocol refers to a unified protocol for data interaction between a cloud server and an intelligent terminal.
The intelligent terminal cooperative interface is an intelligent terminal software and hardware module interface, and can effectively interact with the intelligent terminal through the interface, configure video coding and rendering parameters and acquire real-time operation performance of hardware.
The intelligent terminal rendering capability comprises three types, ①, ②, ③ and ③, wherein the intelligent terminal rendering capability does not have video image processing capability, and the intelligent terminal rendering capability has partial video image processing capability. Specifically, the terminal rendering capability definition is shown in table 1, and the video processing algorithm type definition is shown in table 2.
Table 1 terminal rendering capability definition
Table 2 video processing algorithm type definition
When the rendering capability of the intelligent terminal is that the intelligent terminal does not have the video image processing capability, the equipment only has the basic video playing function and does not have the video image processing capability realized by hardware.
When the rendering capability of the intelligent terminal is that the intelligent terminal has a part of video image processing capability, the intelligent terminal has a specific video image processing capability realized by hardware besides a basic video playing function, but the intelligent terminal only can complete the part of video image processing function due to limited equipment performance. Two cases are included, ①, namely, at a given video frame rate, only partial region video image processing can be completed, and full image processing cannot be completed. ② At a given video frame rate, only a partial sub-process of the entire video image processing task can be completed, and the entire process cannot be completed.
When the rendering capability of the intelligent terminal is the full video image processing capability, the device has a basic video playing function, and also has the specific video image processing capability realized by hardware, and can complete the video image processing of all areas and all processes under a given video frame rate.
The cloud server determines a rendering function set to be started according to the game type, and then determines an optimal rendering cooperative mode of the current device through the device type and rendering capability reported by the intelligent terminal. The specific rendering collaborative strategy comprises rendering region collaboration, rendering task collaboration and video analysis collaboration.
The rendering region cooperation refers to a specific video enhancement task, and the rendering regions of the cloud server and the intelligent terminal are divided according to the computing capability of the terminal. Cloud server rendering is completed before video encoding (video preprocessing), and intelligent terminal rendering is completed after video decoding (video post-processing).
For intelligent terminal equipment without video image processing capability, video image enhancement is completed in a cloud server, the flow is shown in a flow chart of completing video image enhancement by the cloud server shown in fig. 1, video content generation and video content acquisition are carried out in a cloud end (cloud server), video image enhancement processing is carried out in all areas of the cloud end, video image encoding is carried out to obtain a video image code stream, then the cloud end transmits the video image code stream to a terminal (intelligent terminal) through network transmission, the terminal carries out video image decoding on the video image code stream, and then video image display is carried out.
For intelligent terminal equipment with partial video image processing capability, video image enhancement can be achieved by completing partial areas in a cloud server, partial areas are completed in an intelligent terminal, the flow is shown in a flow chart of collaborative rendering of the cloud server and the intelligent terminal according to areas, video content generation and video content acquisition are carried out at a cloud end (cloud server), video image enhancement processing of an area a is carried out at the cloud end, then video image encoding is carried out, a video image code stream is obtained, then the cloud end transmits the video image code stream to a terminal (intelligent terminal) through network transmission, the terminal carries out video image decoding on the video image code stream, carries out video image enhancement processing on an area b in the decoded video image, and then video image display is carried out.
For intelligent terminal equipment with complete video image processing capability, video image enhancement can be completely finished in the intelligent terminal, the flow is shown in a flow chart of finishing video image enhancement of the intelligent terminal shown in fig. 3, video content generation and video content acquisition are carried out at a cloud end (cloud server), video image encoding is carried out to obtain a video image code stream, the cloud end transmits the video image code stream to the terminal (intelligent terminal) through network transmission, the terminal carries out video image decoding on the video image code stream, video image enhancement processing of all areas is carried out at the terminal, and then video image display is carried out.
Rendering task collaboration is specific video enhancement task oriented, such tasks may be divided into different independent subtasks, each subtask corresponding to a different video image enhancement algorithm. The video enhancement task A shown in FIG. 4 is formed by cascading 3 independent subtasks, wherein the cooperation of rendering tasks can enable one part of video image enhancement tasks to be completed in a cloud server and the other part of video image enhancement tasks to be completed in an intelligent terminal according to the computing capability of the terminal. The video enhancement task completed by the cloud server is completed before video encoding (video preprocessing), and the video enhancement task completed by the intelligent terminal is completed after video decoding (video post-processing).
Video analytics coordination refers to the coordination of two tasks, video content analysis and video image enhancement. And the cloud server determines whether the video content analysis task is finished by the cloud server or the intelligent terminal according to the computing capability of the terminal. The video content analysis results are used to guide video image enhancement and video encoding of the current video frame or the subsequent video frame.
For intelligent terminal equipment without video content analysis capability, video content analysis is completed in a cloud server, and video analysis results are used for guiding video image enhancement of a cloud, cloud video image encoding and intelligent terminal video image enhancement. The method comprises the steps of completing a flow chart of video content analysis by a cloud server shown in fig. 5, generating video content at a cloud end (cloud server), collecting video content, analyzing video images at the cloud end, guiding video image enhancement of the cloud end and cloud end video image coding according to video analysis results, transmitting video image code streams obtained after video image coding from the cloud end to a terminal (intelligent terminal) through network transmission, decoding the video image code streams by the terminal, carrying out video image enhancement processing on the decoded video images based on video analysis results, and then displaying the video images.
For intelligent terminal equipment with video content analysis, a video content analysis task is completed in the intelligent terminal, and a video analysis result is used for guiding video image enhancement of a cloud, cloud video image coding and intelligent terminal video image enhancement. The flow is shown in a flow chart of collaborative rendering of the cloud server and the intelligent terminal according to an algorithm, video image analysis is carried out on the terminal, and an analysis result is sent to the cloud;
The method comprises the steps of generating video content at a cloud end (cloud server), collecting the video content, carrying out video image coding to obtain a video image code stream of a current video frame, transmitting the video image code stream of the current video frame from the cloud end to a terminal (intelligent terminal) through network transmission, carrying out video image decoding on the video image code stream of the current video frame by the terminal, carrying out video image analysis on the decoded current video frame, and transmitting a video analysis result to the cloud end, so that the cloud end carries out video image enhancement and video coding on video images of subsequent video frames according to the video analysis result, carrying out video image enhancement on the video images of the current video frame and/or the subsequent video frames by the terminal according to the video analysis result, and then carrying out video image display by the terminal.
Wherein, the video rendering collaborative optimization data structure requirements are as shown in table 3:
table 3 intelligent terminal rendering capability data structure requirements
And the cloud server determines the optimal rendering collaborative mode of the current equipment according to the rendering capability of the intelligent terminal and in combination with the game type, and returns to the completed rendering algorithm, rendering area and image recognition task required by the intelligent terminal.
A schematic diagram of a video rendering collaborative optimization connection flow as shown in fig. 7:
1. And the cloud server initiates a rendering capability request to the intelligent terminal through the START client. The request protocol field includes a protocol version number, a video frame rate, and a rendering algorithm type query. For example, enumerated rendering algorithm types may refer to table 2.
Likewise, the cloud server may also initiate a video content analysis capability request to the intelligent terminal through the START client.
2. When receiving the capability information acquisition request, the intelligent terminal returns a state mark (success 0, failure is a specific error code), a supported protocol version number and terminal equipment capability information.
3. After receiving the terminal rendering capability information, the cloud server determines the optimal rendering collaborative configuration of the current terminal equipment and sends the collaborative task to the intelligent terminal.
4. And after receiving the rendering collaborative task, the intelligent terminal performs a video rendering/analyzing task.
The START client is a cloud game client and is installed on the intelligent terminal.
The video rendering collaborative optimization connection protocol is exemplified as follows:
1. video rendering capability request:
{
"render_ability": {
"version": "1.0",
"resolution": "8",
"framerate": "8",
"type": "1,2"
}
}
2. video analysis capability request:
{
"analysis_ability": {
"version": "1.0",
"resolutuin": "8",
"framerate": "8",
"type": "1001"
}
}
3. video rendering capability response:
{
"render_ability": {
"state": "0",
"version": "1.0",
"renders": "2"
},
"render1": {
"type": "1",
"performances": "1",
"performance1": "8,8,10"
},
"render2": {
"type": "2",
"performances": "1",
"performance1": "8,8,5"
}
}
4. Video rendering capability response (only partial rendering capability is supported):
{
"render_ability": {
"state": "0",
"version": "1.0",
"renders": "1"
},
"render1": {
"type": "2",
"performances": "1",
"performance1": "8,8,5"
}
}
5. video rendering capability response (rendering capability not supported):
{
"render_ability": {
"state": "0",
"version": "1.0",
"renders": "0"
}
}
6. Video rendering capability response (protocol request failure):
{
"render_ability": {
"state": "-1",
"version": "0.9"
}
}
7. video analytics capability response:
{
"analysis_ability": {
"state": "0",
"version": "1.0",
"analyses": "1"
},
"analysis1": {
"type": "1001",
"performances": "1",
"performance1": "8,8,10"
}
}
8. video rendering/analysis task down (example 1: region video sharpening enhancement):
{
"render_task": {
"version": "1.0",
"renders": "1"
},
"render1": {
"type": "1",
"name": "unsharp masking",
"scale": "100",
"regions": "2",
"region1": "0,0,33,33",
"region2": "67,67,100,100"
},
"render1_args": {
"threshold": "0",
"amount": "50",
"radius": "5"
}
}
9. video rendering/analysis task down (example 2: regional video sharpening enhancement + full view HDR):
{
"render_task": {
"version": "1.0",
"renders": "2"
},
"render1": {
"type": "1",
"name": "unsharp masking",
"scale": "100",
"regions": "2",
"region1": "0,0,33,33",
"region2": "67,67,100,100"
},
"render1_args": {
"threshold": "0",
"amount": "50",
"radius": "5"
},
"render2": {
"type": "2",
"name": "hdr",
"scale": "100",
"regions": "1",
"region1": "0,0,100,100"
}
}
10. video rendering/analysis task down (example 3: full view HDR + video complexity analysis):
{
"render_task": {
"version": "1.0",
"renders": "1"
},
"render1": {
"type": "2",
"name": "hdr",
"scale": "100",
"regions": "1",
"region1": "0,0,100,100"
},
"analysis_task": {
"version": "1.0",
"analyses": "1"
},
"analysis1": {
"type": "1002",
"name": "xxx",
"scale": "100",
"regions": "1",
"region1": "33,33,67,67"
}
}
At present, an HDR terminal needs to provide an HDR video resource to exert the optimal performance, but in a cloud game scene, not all games have HDR rendering capability, and at present, an SDR rendering scheme is generally adopted, so that the HDR terminal cannot exert the characteristics of the HDR terminal. The rendering flow chart of SDR video collection, coding and decoding shown in FIG. 15 is used for collecting SDR video in cloud game scenes, coding the SDR video to obtain an SDR video code stream, transmitting the SDR video code stream to a terminal through network transmission by the cloud, decoding the SDR video by the terminal, and rendering SDR images to output the SDR video.
Real-time audio interactive products such as cloud games, cloud live broadcast, cloud conferences, video calls and the like often need real-time coding and transmission of image pictures. Taking cloud games as an example, the games run at the cloud, the cloud server transmits real-time picture codes of the games to the player's terminal, and the calculation such as game scene rendering and game picture processing is completed at the cloud server, so that the player's terminal can enjoy high-quality game pictures without having strong graphic running and data processing capabilities.
In the link of image coding transmission, if the picture of the image is complex, in order to clearly restore the complex scene details in the image, a mode of reducing quantization parameters is often adopted to improve the image quality of the image. However, reducing the quantization parameter can improve the image quality, but increases the size of the encoded code stream of the frame image, which deteriorates the smoothness of the code rate. If complex pictures appear continuously, the image quality is frequently improved by reducing quantization parameters, the code stream of the frame images is likely to exceed the preset code rate allocated to the frame images by an encoder, so that the code rate control is invalid, the frame rate is sacrificed to ensure the image quality, the picture of the cloud game is blocked, unsmooth and the like, or the image quality is sacrificed to ensure the frame rate, so that the image quality of the image is reduced.
The embodiment of the application provides an image quality improving method, which is used for detecting the image quality of an image, filtering the image according to the image quality detecting result to reduce unnecessary byte occupation in the image by filtering in a scene with lower image quality, and encoding the filtered image so as to improve the image quality of the encoded image by using saved bytes in the encoding process. The image quality improving method of the embodiment of the application does not influence the setting of quantization parameters, so that adverse effects on the stability of the code rate are not generated, the transmission requirement of the preset code rate can be met, the frame rate is not sacrificed due to the image quality improvement, and the smooth picture of the image after the image quality improvement treatment is ensured when the transmission interaction is implemented.
The method provided by the embodiment of the application can be applied to real-time audio interaction products such as cloud games, cloud live broadcasting, cloud conferences, video calls and the like, so that the image quality of the low-image-quality scene after encoding is improved.
Referring to fig. 8, fig. 8 is a schematic system diagram of an information display device in a game according to an embodiment of the application. The system may include at least one terminal 1000, at least one server 2000, at least one database 3000, and a network 4000. Terminal 1000 held by a user may be connected to servers of different games through network 4000. Terminal 1000 can be any device having computing hardware capable of supporting and executing software products corresponding to a game. In addition, terminal 1000 can have one or more multi-touch sensitive screens for sensing and obtaining input from a user through touch or slide operations performed at multiple points of one or more touch sensitive display screens. In addition, when the system includes a plurality of terminals 1000, a plurality of servers 2000, and a plurality of networks 4000, different terminals 1000 may be connected to each other through different networks 4000, through different servers 2000. The network 4000 may be a wireless network or a wired network, such as a Wireless Local Area Network (WLAN), a Local Area Network (LAN), a cellular network, a 2G network, a 3G network, a 4G network, a 5G network, etc. In addition, the different terminals 1000 may be connected to other terminals or to a server or the like using their own bluetooth network or hotspot network. For example, multiple users may be online through different terminals 1000 so as to be connected via an appropriate network and synchronized with each other to support multiplayer games. In addition, the system may include a plurality of databases 3000, the plurality of databases 3000 being coupled to different servers 2000, and information related to the game environment may be continuously stored in the databases 3000 while different users play the multiplayer game online.
In this embodiment of the present application, when performing image quality enhancement processing, the server 2000 may be specifically configured to obtain an image parameter value, where the image parameter value includes a coding count value, a distortion variable value, and a capacity of a distortion array, perform image quality detection on an image to be processed according to the image parameter value to obtain an image quality detection result corresponding to the image to be processed, filter the image to be processed according to the image quality detection result, code the filtered image to be processed according to the image quality detection result to obtain a coding code stream, and output the image to be processed according to the coding code stream.
In an embodiment of the present application, in a cloud game scene, game frames are generated at the server 2000, and the server 2000 can encode and transmit game images. Different players may access held terminal 1000 to server 2000 via network 4000 to receive and display corresponding game images via terminal 1000.
In other embodiments of the present application, the image quality improving method may also be performed by terminal 1000. For example, terminal 1000 has a downloaded game client, a game can be directly run on terminal 1000, a game screen is generated by terminal 1000, and terminal 1000 improves the image quality of the game screen by the image quality improving method of the present application.
The following will describe in detail. It should be noted that the following description order of embodiments is not a limitation of the priority order of embodiments.
The embodiments of the present application provide a method for improving image quality, which may be executed by a terminal or a server, or may be executed by the terminal and the server together.
Referring to fig. 9 to 17, fig. 9 to 17 are schematic flow diagrams of an image quality improving method according to an embodiment of the application. The method comprises the following steps:
At step 210, image parameter values are obtained.
Optionally, the image parameter values include a coding count value, a distortion variable value, and a capacity of a distortion array.
Optionally, the image processed by the image quality improvement method is finally encoded. The coding count value is used for counting the number of the images which are processed, and the step length of the coding count value is 1, namely after 1 frame of image is processed by the image quality improving method each time, the coding count value is increased by 1 after the frame of image is coded. Alternatively, in some embodiments, the step size of the encoded count value may also be a value of 2, 3,4 or more than 4, which are not listed here. Taking the step size of the code count value of 2 as an example, it is shown that the code count value is increased by 2 after the image quality improvement processing of one frame image is completed, and then the next adjacent frame image is directly encoded without performing the image quality detection of step 220 and the filtering process of step 230. Similarly, when the step size of the coding count value is n, it means that the next n-1 frame image is directly coded after the processing of one frame image is completed. For continuous static images of multiple frames or images with small motion variation amplitude, as the human eyes easily capture details of the images, a small counter step length can be set so as to ensure that the human eyes have higher image quality on the visual effect of the continuous images of the multiple frames. For images with larger continuous motion variation amplitude of multiple frames, the human eyes can hardly capture details of the images, so that larger counter step length can be set, and a certain degree of blurring of pictures is allowed, so that the image processing efficiency is improved.
Alternatively, the distortion variable value is embodied by an absolute error transform sum (Sum of absolute transformed difference, SATD). SATD is a common metric used in video coding to represent coding distortion. And carrying out Hadamard (hadamard) transformation on the residual square matrix of the predicted value and the true value, and adding all coefficients of the transformed square matrix to obtain the SATD value. Alternatively, embodiments of the present application use the SATD value as a distortion variable to measure the distortion level of an image.
Optionally, the distortion array is an array including a plurality of variables, the total number of the variables is the capacity of the distortion array, each variable is used for measuring the distortion degree of one frame of image, and the distortion array can measure the distortion degree of multiple frames of images according to the plurality of variables included in the distortion array. Optionally, embodiments of the present application use the SATD value as a variable in the distortion array to measure the distortion level of the image.
Optionally, in the case of processing the image by using the image quality improvement method for the first time, the values of the coding count value, the distortion variable value and the variables in the distortion array are set to 0, that is, the image parameter value is initialized.
Alternatively, the image quality improvement method may be performed by a trained image quality improvement model. The image quality enhancement model is an artificial intelligence (ARTIFICIAL INTELLIGENCE, AI) model. Artificial intelligence is a theory, method, technique and application system that utilizes a digital computer or a machine controlled by a digital computer to simulate, extend and expand human intelligence, sense the environment, acquire knowledge and use the knowledge to obtain the best results. In other words, artificial intelligence is an integrated technology of computer science that attempts to understand the essence of intelligence and to produce a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence, i.e. research on design principles and implementation methods of various intelligent machines, enables the machines to have functions of sensing, reasoning and decision. In the case of executing the image quality improvement method using the trained image quality improvement model, the image parameter value may be an initialized value, that is, the capacity of the coding count value, the distortion variable value, and the distortion array is set to 0, or the image parameter value is an image parameter value obtained when the image quality improvement model is trained, and the trained image quality improvement model directly applies the image parameter value obtained when the training to process the image input to the model.
And 220, detecting the image quality of the image to be processed according to the image parameter value so as to obtain an image quality detection result corresponding to the image to be processed.
And step 230, filtering the image to be processed according to the image quality detection result.
Optionally, the image quality detection is used to detect whether the image to be processed is a low-quality image. The coding transmission can be directly performed under the condition that the image quality of the image is high, and the image quality is not required to be improved by an image quality improving method. Factors that may exist to cause low image quality include high image noise, complex scenes in the image, difficulty in clearly restoring various details in the complex image by the allocatable bytes at a preset code rate, and the like. The low-quality images can be filtered in step 230 to improve the quality of the images.
Optionally, the image quality detection result includes a first detection result and a second detection result. The first detection result indicates that the current frame image is a low-quality image or that the current frame image is an image that needs to be subjected to filtering processing. The second detection result indicates that the current frame image does not need to be subjected to filtering processing.
The human eye is lower in sensitivity to high-frequency parts in the image, is more sensitive to low-frequency parts, and the fact that the human eye senses that the image quality of the image is low is one of reasons that the high-frequency parts in the image are more. Optionally, the image quality detection result in step 220 can reflect whether a high-frequency part to be filtered exists in the image to be processed, and step 230 filters the image to be processed, so that high-frequency components in the image to be processed can be filtered, bytes occupied by original high-frequency components are allocated to low-frequency components under a preset code rate, and the code rate is concentrated on the low-frequency components sensitive to human eyes. In this way, the image quality perceived by the human eye can be improved without increasing the code rate, and the image quality perceived by the human eye can be improved. In addition, the process of improving the image quality does not influence the setting of quantization parameters, so that adverse effects on the stability of the code rate are avoided, the transmission requirement of the preset code rate can be met, the frame rate is not sacrificed due to the improvement of the image quality, and the smooth picture of the image after the image quality improvement treatment is ensured when transmission interaction is implemented.
Alternatively, as shown in fig. 10, step 220 may be implemented through steps 310 to 340, specifically:
Step 310, it is determined whether the code count value is greater than or equal to capacity.
In step 320, in the case where the code count value is greater than or equal to the capacity, the maximum variable value is selected among the variables of the distortion array.
Step 330, determining whether the distortion variable value is greater than the product of the preset weight and the maximum variable value.
Step 340, outputting the first detection result when the distortion variable value is greater than the product of the preset weight value and the maximum variable value.
Alternatively, the first detection result indicates that the current frame image is a low quality image, or that the current frame image is an image that needs to be subjected to filtering processing.
Optionally, as an example, let the code count value be i, the capacity be n, the distortion variable value be S0, the preset weight be q, the distortion array be U, u= { S1, &...
Step 310 is used for judging whether the coding count value i is greater than or equal to the capacity n, if i is less than n, step 320 to step 340 are not executed, namely, the first detection result is not output, the variable in the distortion array is updated through the SATD value of the current frame image, the next frame image is continuously collected, and step 320 is executed until i is greater than or equal to n. In this case, the variables in the distortion array U are updated at least n times, and if different variables are updated sequentially each time, each variable of the distortion array U is updated sequentially under the condition that i is greater than or equal to n, so that the distortion array U can reflect the distortion degrees corresponding to the i-n frame to the i-1 frame image.
For example, in one embodiment, i=0, n=3, i.e., distortion array u= { S1, S2, S3}, where S1, S2, S3 are all 0, is set after initializing the parameters. When i=0, the 0 th frame image is input, and as 0<3, S1 is equal to the SATD value corresponding to the 0 th frame image, and the code count value i is increased by 1. When i=1, the 1 st frame image is input, and as 1<3, S2 is equal to the SATD value corresponding to the 1 st frame image, and the code count value i is increased by 1. When i=2, the 2 nd frame image is input, and as 2<3, S3 is equal to the SATD value corresponding to the 2 nd frame image, and the code count value i is increased by 1. When i=3, the variables S1, S2, S3 of the capacity n correspond to SATD values of the 0 th frame, 1 st frame, and 2 nd frame images, respectively, and the distortion array U can reflect the distortion degree of the 0 th to 2 nd frame images. When i=3, the 3 rd frame image is input, and since 3=3, the execution condition of step 320 is satisfied, in which case the maximum variable value starts to be selected in the distortion array U.
Assuming that the maximum variable value is Smax, in step 330, the magnitude between the distortion variable value S0 and the product smax×q of the maximum variable value Smax and the preset weight q is determined, in combination with step 340, a first detection result is output when S0> smax×q, in combination with step 230, in step 230, according to the image quality detection result, the image to be processed of the current frame is filtered when the image quality detection result is the first detection result, so as to improve the image quality of the image.
The maximum variable value Smax is the maximum variable selected from the variables of the distortion array U, and the distortion array U reflects the distortion degrees corresponding to the i-n frame to the i-1 frame images, so that the maximum variable value Smax reflects the maximum distortion of the i-n frame to the i-1 frame images.
In one embodiment, the distortion variable value S0 reflects the distortion level of the i-1 st frame (last frame), i.e. the distortion variable S0 is made equal to the SATD value of the i-1 st frame, the coding count value is updated from i-1 to i, and step 310 is entered. In this case, the magnitude between the distortion variable value S0 and the product smax×q of the maximum variable value Smax and the preset weight q is determined in step 330, that is, the distortion degree of the i-1 th frame image is measured according to the maximum distortion of the i-n th frame to the i-1 th frame image, and in the case where S0> smax×q, the distortion degree of the i-1 th frame image is considered to reach the criterion of being considered as a low quality image (or an image requiring filtering, the same applies hereinafter), in which case the first detection result is outputted.
In yet another embodiment, the distortion variable value S0 reflects the distortion degree of the i-th frame (current frame) image, i.e., the coding count value is updated from i-1 to i, the SATD value of the i-th frame image is acquired, the distortion variable S0 is updated to the SATD value, and step 310 is further performed. In this case, the magnitude between the distortion variable value S0 and the product smax×q of the maximum variable value Smax and the preset weight q is determined in step 330, that is, the distortion degree of the i-th frame image is measured according to the maximum distortion of the i-n-th frame to the i-1-th frame image, and in the case where S0> smax×q, the distortion degree of the i-th frame image is considered to reach the standard considered as the low quality image, in this case, the first detection result is outputted.
The larger the value of the capacity n, the larger the sample size of the image quality detection, the easier the low-quality image can be found in the continuous multi-frame high-quality image, and the smaller the value of the capacity n, the better the timeliness of the image quality detection and the higher the processing efficiency.
The preset weight q is greater than 1, so that even if the distortion degree reflected by the maximum variable value Smax does not reach the standard of being determined as a low-quality image, the product smax×q obtained by multiplying the maximum variable value Smax by the preset weight q may reach the standard of being determined as a low-quality image, and thus, when the image corresponding to the maximum variable value Smax is not a low-quality image, the low-quality image can be determined according to the value smax×q. The larger the preset weight q is, the easier the image to be processed is judged to be the low-quality image, the smaller the preset weight q is, the more difficult the image to be processed is judged to be the low-quality image, and the value of q can be properly adjusted according to the application scene, so that the output first detection result is more accurate.
Optionally, as shown in fig. 10, step 220 may be further implemented through steps 310 to 360, where steps 310 to 340 are described in the foregoing, and are not repeated herein. The steps 350 to 360 specifically include:
step 350, outputting a second detection result in the case that the code count value is smaller than the capacity.
Optionally, the second detection result indicates that the current frame image is an image that is not subjected to the filtering process.
Step 360, outputting a second detection result in the case that the distortion variable value is less than or equal to the product of the preset weight value and the maximum variable value.
Optionally, as an example, let the code count value be i, the capacity be n, the distortion variable value be S0, the preset weight be q, the distortion array be U, u= { S1, &...
In the case where the code count value i is smaller than the capacity n, i.e., i < n, the samples in the distortion array are considered insufficient for evaluating the degree of distortion of the frame image to be processed, and thus the frame image to be processed is not subjected to the filter processing.
In the case where the distortion variable value S0 is smaller than or equal to the product Smax q of the preset weight q and the maximum variable value Smax, that is, in the case where S0 is smaller than or equal to Smax q, it is considered that the distortion degree of the frame to-be-processed image does not reach the standard of being considered as a low-quality image, and thus the filtering process is not performed on the frame to-be-processed image.
In order to better illustrate the step 220 of the image quality improving method according to the embodiment of the present application, please refer to fig. 9 to 11, and the flow of the step 220 of the image quality improving method according to the embodiment of the present application can be summarized as the following steps:
step 310, it is determined whether the code count value is greater than or equal to capacity. If yes, go to step 320, if not, go to step 350.
In step 320, in the case where the code count value is greater than or equal to the capacity, the maximum variable value is selected among the variables of the distortion array.
Step 330, determining whether the distortion variable value is greater than the product of the preset weight and the maximum variable value. If yes, go to step 340, if not, go to step 360.
Step 340, outputting the first detection result when the distortion variable value is greater than the product of the preset weight value and the maximum variable value.
Step 350, outputting a second detection result in the case that the code count value is smaller than the capacity.
Step 360, outputting a second detection result in the case that the distortion variable value is less than or equal to the product of the preset weight value and the maximum variable value.
Optionally, as shown in fig. 10, the image quality improving method further includes a step 230 of filtering the image to be processed according to the image quality detection result to improve the image quality of the image. Alternatively, as shown in fig. 12, step 230 may be implemented through steps 510 to 520, specifically:
Step 510, obtaining gradient values of a plurality of pixels of the image to be processed.
Alternatively, the gradient value is used to determine whether the pixel belongs to a high-frequency part (high-frequency component) or a low-frequency part (low-frequency component).
Step 520, filtering the pixel point corresponding to the gradient value if the gradient value is greater than the preset gradient threshold value.
Optionally, filtering the pixel points corresponding to the gradient values according to different filtering settings may include filtering one pixel point corresponding to the gradient values, and filtering the pixel point corresponding to the gradient values and the pixel points around the pixel point.
Alternatively, as shown in fig. 13, step 510 may be implemented through steps 610 to 620, specifically:
Step 610, obtaining a width value, a height value, a first variable value and a second variable value of the image to be processed, where the first variable value represents coordinate positions of a plurality of pixels along the height direction, and the second variable value represents coordinate positions of a plurality of pixels along the width direction, and under the condition that the values of the first variable value and the second variable value are determined, a pixel point of a coordinate position can be determined according to coordinates, corresponding to the first variable value and the second variable value, along the height direction and along the width direction.
Step 620, obtaining gradient values of the pixel points corresponding to the first variable and the second variable when the first variable is smaller than the difference between the height value and the preset value and the second variable is smaller than the difference between the width value and the preset value.
Alternatively, as an example, let the width value of the image to be processed be w, the height value of the image to be processed be h, the first variable value be Y, the second variable value be X, and the preset value be m. Wherein both the height and the width are in units of pixels, for example, a height of 1 pixel unit for a height value h=1. The position of a pixel point p (X, Y) in the image to be processed can be determined according to the values of the first variable value Y and the second variable value X, the pixel point p (X, Y) has a corresponding pixel value d (X, Y), and the gradient value corresponding to the pixel point p (X, Y) is set as G (X, Y). For example, when y=1 and x=1, the pixel point p (1, 1) may be determined, and when y=y and x=x, the pixel point p (X, Y) may be determined, and the pixel point p (1, 1) may be determined, and the pixel point p (X, Y) may be determined.
In one embodiment, if the preset value m=1, then in the case of Y < h-1 and X < w-1, the gradient value G (X, Y) corresponding to the pixel p (X, Y) is obtained. That is, the coordinate position Y of the pixel point p (X, Y) in the height direction of the acquired gradient value does not exceed h-1, and the coordinate position X in the width direction does not exceed w-1. If the initial value of the first variable value Y is 1 and the initial value of the second variable value X is 1, among the plurality of pixel points p (X, Y) for which gradient values are obtained, y= [1, h-2] and x= [1, w-2], that is, in the case of y= [ h-1, h ] or x= [ w-1, w ], gradient values G (X, Y) for the pixel points p (X, Y) are not obtained. In other embodiments, the preset value m may be 0 or another positive integer, for example, if m=0, then if Y < h and X is smaller than w, the gradient value G (X, Y) corresponding to the pixel point p (X, Y) is obtained. In other embodiments, the initial value of the first variable Y may be other integers greater than 1, and the initial value of the second variable X may be other integers greater than 1, which is not limited herein.
Optionally, in one embodiment, let y=y, x=x, and the gradient value G (X, Y) corresponding to the pixel point p (X, Y) be the sum of the absolute value of the horizontal gradient value Gw (X, Y) of the pixel point p (X, Y) and the absolute value of the vertical gradient value Gh (X, Y) of the pixel point p (X, Y), i.e., G (X, Y) =i Gw (X, Y) i+i G (X, Y) i. Wherein, the horizontal gradient value Gw (x, y) and the vertical gradient value Gh (x, y) of the pixel point p (x, y) are respectively obtained by the following formulas:
Gw(x,y)=d(x+1,y-1)+2*d(x+1,y)+d(x+1,y+1)-d(x-1,y-1)-2*d(x-1,y)-d(x-1,y+1);
Gh(x,y)=d(x+1,y-1)+2*d(x+1,y)+d(x+1,y+1)-d(x-1,y-1)-2*d(x-1,y)-d(x-1,y+1)。
Alternatively, in one embodiment, the gradient value G (x, y) corresponding to the pixel p (x, y) may be calculated by a convolutional neural network, where G (x, y) =gw (x, y) =i+i Gh (x, y) i. Wherein, a convolution kernel Gcw in the horizontal direction and a convolution kernel Gch in the vertical direction are set according to Gw (x, y) and Gh (x, y), respectively:
;。
Optionally, as shown in fig. 13, step 510 may be further implemented through steps 610 to 630, and steps 610 to 620 are described above, which are not repeated here. Step 630 is specifically:
In step 630, filtering is ended if the first variable value is greater than or equal to the difference between the height value and the preset value.
Alternatively, as an example, let the width value of the image to be processed be w, the height value of the image to be processed be h, the first variable value be Y, the second variable value be X, and the preset value be m. The coordinate position Y of the pixel point p (X, Y) in the height direction of the acquired gradient value does not exceed h-m, otherwise the filtering is ended. For example, if the preset value m=1, the filtering is ended if y+_h_1, i.e., if y= [ h_1, h ].
Optionally, as shown in fig. 13, step 510 may be further implemented through steps 610 to 650, and steps 610 to 630 are described above, which are not repeated here. The steps 640 to 650 specifically include:
Step 640, in the case that the second variable value is greater than or equal to the difference between the width value and the preset value, increasing the first variable value according to the preset second step length to obtain the increased first variable value, and resetting the second variable value to obtain the reset second variable value.
Step 650, obtaining the gradient value of the pixel point corresponding to the increased first variable value and the reset second variable when the increased first variable value is smaller than the difference between the height value and the preset value and the reset second variable value is smaller than the difference between the width value and the preset value.
Alternatively, as an example, let the width value of the image to be processed be w, the height value of the image to be processed be h, the first variable value be Y, the second variable value be X, and the preset value be m. Assuming that the current value of the second variable value X is X, the value of the first variable value Y is Y, the preset value of the second step length is 1, and increasing the value of the first variable value Y by 1 under the condition that X is more than or equal to w-m, namely increasing the value of the first variable value Y by y+1. Assuming that the initial value of the second variable value X is 1, the reset value of the second variable value X obtained after resetting the second variable value X is 1. That is, when x=x and X is equal to or greater than w-m, let y=y+1, and x=1 correspond to completion of gradient value detection of one line of pixels in the horizontal direction, and gradient value detection starts from the first pixel in the next line.
Step 650 corresponds to replacing the first variable value in step 620 with the incremented first variable value and replacing the second variable value with the reset second variable value. That is, when y=y+1 and x=1, if y+1<h-m is 1<w-m, the gradient value corresponding to the pixel point p (1, y+1) corresponding to the current first variable value X and second variable value Y is obtained.
In case the increased first variable value Y is greater than or equal to the difference between the width value and the preset value, the filtering is ended according to step 630. That is, in the case Y≥h-m, filtering ends according to step 630.
Optionally, as shown in fig. 12, step 230 may be further implemented through steps 510 to 530, and steps 510 to 520 are described above, which is not repeated here. Step 530 is specifically:
In step 530, if the gradient value is less than or equal to the preset gradient threshold value, or after filtering, the second variable value is increased according to the preset third step length to obtain the increased second variable value.
Alternatively, as an example, let the first variable value be X, the second variable value be Y, the gradient value corresponding to the pixel point p (X, Y) be G (X, Y), and the preset gradient threshold be Gt. Assuming that the current value of the first variable value X is X, the value of the second variable value Y is Y, the corresponding pixel point is p (X, Y), and the preset third step length takes a value of 1. In the case where the gradient value G (X, y) corresponding to the pixel p (X, y) is greater than the preset gradient threshold Gt, that is, in the case where G (X, y) > Gt, the pixel p (X, y) is filtered according to step 520, and after the filtering, the value of the first variable value X is increased by 1 according to step 530 to obtain an increased first variable value X, where the increased first variable value x=x+1. In the case that the gradient value G (X, y) corresponding to the pixel point p (X, y) is smaller than or equal to the preset gradient threshold Gt, that is, in the case that G (X, y) is less than or equal to Gt, the condition of filtering the pixel point p (X, y) in step 520 is not satisfied, so that the pixel point p (X, y) is not filtered, the value of the second variable value X is directly increased by 1 according to step 530 to obtain an increased second variable value X, and the increased second variable value x=x+1. And increasing the second variable value X according to a preset third step length, so as to detect the gradient value of the next pixel point in the same row.
Optionally, as shown in fig. 13, step 510 may be further implemented through steps 610 to 660, and steps 610 to 650 are described above, which are not repeated here. Step 660 is specifically:
Step 660, obtaining the gradient value of the pixel point corresponding to the first variable and the increased second variable when the first variable is smaller than the difference between the height value and the preset value and the increased second variable is smaller than the difference between the width value and the preset value.
Step 660 corresponds to replacing the second variable value in step 620 with the incremented second variable value. Alternatively, as an example, let the width value of the image to be processed be w, the height value of the image to be processed be h, the first variable value be Y, the second variable value be X, and the preset value be m. Assuming that the current second variable value X is X, the first variable value Y is Y, the preset third step size is 1, the next pixel p (x+1, Y) is obtained after the increased second variable X is obtained according to step 530, and step 660 is performed, which is equivalent to performing step 620 in the case of the second variable value x=x+1. Because the value of the first variable value Y is not changed, whether the gradient value corresponding to the pixel point p (x+1, Y) is acquired can be determined by only judging whether the increased second variable value x+1 is smaller than the difference value between the width value and the preset value. According to step 660 or step 620, the gradient value corresponding to pixel point p (x+1, y) is obtained under the condition of x+ 1<w-m.
Alternatively, as shown in fig. 14, the gradient threshold includes a first threshold and a second threshold. Step 520 may be implemented through steps 710 to 740, specifically:
Step 710, determining whether the gradient value is greater than a first threshold.
And step 720, performing median filtering on the pixel points corresponding to the gradient values under the condition that the gradient values are larger than the first threshold value.
In step 730, it is determined whether the gradient value is greater than a second threshold.
And step 740, performing mean filtering on the pixel points corresponding to the gradient values under the condition that the filtering gradient values are larger than the second threshold value.
Steps 710 to 740 provide two filtering modes, namely median filtering and mean filtering, to filter out the high frequency part in the image to be processed. In other embodiments, other low pass filtering means, such as gaussian filtering, may be used, without limitation. In the embodiment of the present application, step 520 may be performed by only one low-pass filtering method, or may be performed by a combination of multiple low-pass filtering methods, which is not limited herein. The present embodiment describes filtering by taking a combination of median filtering and mean filtering as an example.
Optionally, let the gradient value of the pixel p (x, y) be G (x, y), the first threshold be Gt1, the second threshold be Gt2, and the filtered gradient be Gl (x, y). Step 710 determines whether the gradient value G (X, y) is greater than the first threshold Gt1, if yes, step 720 is performed, if not, the second variable value X is increased according to step 530 according to a preset third step, for example, the increased second variable value x=x+1, and then step 620 or step 660 is performed again to determine whether to obtain the gradient value of the pixel point p (x+1, y).
Under the condition of G (x, y) > Gt1, 8 adjacent pixel points p (x, y) and the periphery thereof are obtained, wherein p (x+1, y), p (x-1, y), p (x, y+1), p (x+1, y+1), p (x-1, y+1), p (x, y-1), p (x+1, y-1) and p (x-1, y-1) are obtained, and are sequenced according to the size of the pixel values to find a fifth large pixel value Pm, so that the pixel value of the pixel point p (x, y) is equal to Pm to complete median filtering. In this way, the median Pm of 9 pixel values of the 3×3 matrix centered on the pixel point p (x, y) is taken as the pixel value of the pixel point p (x, y) by the median filtering. In other embodiments, the median Pm may be a median of a plurality of pixel values of a 4×4 matrix, a 5×5 matrix, or other matrices centered on the pixel point p (x, y), or may be a median of a plurality of pixel values of any number of pixels selected according to a preset rule including the pixel point p (x, y), for example, a preset rule that the pixel point p (x, y) is located in a 2×2 matrix at the lower left corner.
Similarly, step 730 determines whether the gradient value G (X, y) is greater than the second threshold Gt2, if yes, step 740 is performed, if not, the second variable value X is increased according to step 530 according to a preset third step, for example, the increased second variable value x=x+1, and then step 620 or step 660 is performed again to determine whether to acquire the gradient value of the pixel point p (x+1, y).
Let Pv be the average value, the pixel p (X, Y) has the corresponding pixel value d (X, Y), and in the case of G (X, Y) > Gt2, the average value Pv,Pv=d(x-1,y-1)+2*d(x,y-1)+d(x+1,y-1)+2*d(x-1,y)+8*d(x,y)+2*d(x+1,y)+d(x-1,y+1)+2*d(x,y+1)+d(x+1,y+1). is calculated according to the pixel p (X, Y) and the adjacent 8 pixels around the pixel p (x+1, Y), p (X-1, Y), p (X, y+1), p (x+1, y+1), p (X-1, y+1), p (X, Y-1), p (x+1, Y-1) and p (X-1, Y-1) to obtain the pixel value d (X, Y) =Pv/20 of the pixel p (X, Y) to complete the average value filtering. In other embodiments, the average value Pv may be calculated according to a plurality of pixel values of a 4×4 matrix, a 5×5 matrix, or other matrices centered on the pixel point p (x, y), or may be calculated according to a plurality of pixels selected by a preset rule including any number of pixel points p (x, y), for example, a preset rule that the pixel point p (x, y) is located in a2×2 matrix at the lower left corner.
Optionally, in one embodiment, step 720 performs median filtering on the pixel to obtain a filtered gradient value of the pixel, and step 730 determines whether the filtered gradient value is greater than a second threshold, if so, average filtering is performed on the pixel. For example, let the filtered gradient value of the pixel p (x, y) be Gl (x, y), and the second threshold be Gt2. Step 530 is performed to increase the second variable value X by a preset third step size, for example, the increased second variable value x=x+1, if Gl (X, y) is less than or equal to Gt2, step 620 is performed again or step 660 is performed to determine whether to acquire the gradient value of the pixel point p (x+1, y), average filtering is performed on the median filtered pixel point p (X, y) if Gl (X, y) is greater than Gt2, and step 530 is performed after filtering.
In order to better describe the step 230 of the image quality improving method according to the embodiment of the present application, please refer to fig. 9 to 8, in one embodiment, the flow of step 230 can be summarized as the following steps:
Step 610, acquiring a width value, a height value, a first variable value and a second variable value of the image to be processed, wherein the first variable value represents a coordinate position of the pixel point along the height direction, and the second variable value represents a coordinate position of the pixel point along the width direction.
Step 620, obtaining gradient values of the pixel points corresponding to the first variable and the second variable when the first variable is smaller than the difference between the height value and the preset value and the second variable is smaller than the difference between the width value and the preset value.
In step 630, filtering is ended if the first variable value is greater than or equal to the difference between the height value and the preset value.
Step 640, in the case that the second variable value is greater than or equal to the difference between the width value and the preset value, increasing the first variable value according to the preset second step length to obtain the increased first variable value, and resetting the second variable value to obtain the reset second variable value.
Step 650, obtaining the gradient value of the pixel point corresponding to the increased first variable value and the reset second variable when the increased first variable value is smaller than the difference between the height value and the preset value and the reset second variable value is smaller than the difference between the width value and the preset value.
In step 530, if the gradient value is less than or equal to the preset gradient threshold value, or after filtering, the second variable value is increased according to the preset third step length to obtain the increased second variable value.
Step 660, obtaining the gradient value of the pixel point corresponding to the first variable and the increased second variable when the first variable is smaller than the difference between the height value and the preset value and the increased second variable is smaller than the difference between the width value and the preset value.
Step 710, determining whether the gradient value is greater than a first threshold. If yes, go to step 720, otherwise go to step 530.
And step 720, performing median filtering on the pixel points corresponding to the gradient values under the condition that the gradient values are larger than the first threshold value.
In step 730, it is determined whether the gradient value is greater than a second threshold. If yes, go to step 720, otherwise go to step 530.
And step 740, performing mean filtering on the pixel points corresponding to the gradient values under the condition that the filtering gradient values are larger than the second threshold value. Step 530 is performed after the mean filtering.
Optionally, as shown in fig. 9, the image quality improving method provided in the embodiment of the present application further includes:
and step 240, encoding the filtered image to be processed according to the image quality detection result to obtain an encoded code stream.
Step 250, outputting the encoded code stream.
Optionally, after outputting the encoded code stream, step 251 is further included, where the image to be processed is output according to the encoded code stream.
Because the high-frequency part in the image to be processed is filtered in the filtering process, bytes occupied by the high-frequency part can be distributed to the low-frequency part in the encoding process, so that the code rate is concentrated on the low-frequency part sensitive to human eyes, and the image quality of the filtered image to be processed is improved. The coding code stream of the frame of the image to be processed is obtained after coding, and the code rate is not increased in the coding process, so that the frame of the image to be processed output according to the coding code stream can meet the transmission requirement of a preset code rate, the frame rate cannot be sacrificed due to image quality improvement, and the smooth picture of the image after the image quality improvement processing is ensured when transmission interaction is implemented.
Optionally, as shown in fig. 9, the image quality improving method provided in the embodiment of the present application may further include:
in step 260, the image parameter values are updated to obtain updated image parameter values.
Step 270, a new image to be processed is acquired.
And 280, detecting the image quality of the new image to be processed according to the updated image parameter value so as to obtain an image quality detection result corresponding to the new image to be processed.
Wherein step 280 corresponds to replacing the image to be processed in step 220 with a new image to be processed and replacing the image parameter value in step 220 with an updated image parameter value. That is, the step 280 is performed after the step 270 is performed, which corresponds to the step 220 being performed according to the new image to be processed and the updated image parameter value after the step 270 is performed.
Alternatively, as shown in fig. 16, step 260 may be implemented through steps 910 to 930, specifically:
in step 910, a coding distortion value of the image to be processed is obtained.
Step 920, updating the variable and the distortion variable value of the distortion array according to the coding distortion value.
Step 930, increasing the code count value according to a preset first step.
Alternatively, as an example, let the code count value be i, the capacity be n, the distortion variable value be S0, the code distortion value be Sc, the distortion array is U, u= { S1, &..the term, sj }, where S1, &..the term, sj are variables in the distortion array U, j >1, respectively. The coding distortion value Sc may be obtained by detecting the SATD value of the coded image to be processed as the coding distortion value Sc after executing step 240, or may be obtained together with the coded code stream in step 240.
Alternatively, when the encoded count value is i, the encoded distortion value Sc is ci, the value of the ith% n variable of the distortion array U may be updated to ci, and the value of the distortion variable value S0 may be updated to ci. And after the updating is finished, the coding count value i is increased according to a preset first step length. Where,% represents the remainder operation.
For example, let n= 3,i =0, the preset first step size is 1, and the distortion array u= { S1, S2, S3}, where S1, S2, S3 are the 0 th, 1 st, and 2 nd variables in the distortion array U, respectively. The encoding distortion value sc=c0, 0% 3=0 of the 0 th frame image, thus s1=c0, and s0=c0, and then the encoding count value is increased by 1. When i=1, the encoding distortion value sc=c1, 1% 3=1 of the 1 st frame image, so s2=c1, and s0=c1 are given, and then the encoding count value is increased by 1. When i=2, the encoding distortion value sc=c2, 2% 3=2 of the 2 nd frame image, so s3=c2, and s0=c2, at this time, the distortion array u= { c0, c1, c2}, and then the encoding count value is increased by 1. When i=3, the encoding distortion value sc=c3, 3%3 =0 of the 3 rd frame image, so s1=c3, and s0=c3, at which time the distortion array u= { c3, c1, c2}, then the encoding count value is increased by 1. Thus, before the i-th frame to-be-processed image is obtained each time, the value of the distortion variable value S0 is updated to be the coding distortion value Sc corresponding to the i-1-th frame to-be-processed image, and the variables contained in the distortion array U comprise the coding distortion values Sc corresponding to the i-n-th frame to the i-1-th frame to-be-processed image. Step 220 or step 280 may be performed to detect the image quality of the i-th frame to the i-1-th frame according to the coding distortion value Sc corresponding to the i-th frame to the i-1-th frame, i.e. to detect the image quality of the current frame according to the SATD value of the multi-frame historical to-be-processed image adjacent to the current frame to-be-processed image. In combination with step 330 and step 340, a first detection result is output according to the maximum SATD value of the multi-frame historical to-be-processed image adjacent to the to-be-processed image of the current frame, and the reference value (product of the preset weight value and the maximum variable value) for outputting the first detection result is dynamically changed, so that a low-quality image can be detected in the multi-frame to-be-processed image with uneven image quality distribution.
In order to better explain the image quality improving method provided by the embodiment of the present application, referring to fig. 9, 10, 16 and 17, in one embodiment, the flow of the image quality improving method can be summarized as the following steps:
In step 210, image parameter values are obtained, wherein the image parameter values include a coding count value, a distortion variable value, and a capacity of a distortion array.
And 220, detecting the image quality of the image to be processed according to the image parameter value so as to obtain an image quality detection result corresponding to the image to be processed.
And step 230, filtering the image to be processed according to the image quality detection result.
And step 240, encoding the filtered image to be processed according to the image quality detection result to obtain an encoded code stream.
Step 250, outputting the encoded code stream.
In step 910, a coding distortion value of the image to be processed is obtained.
Step 920, updating the variable and the distortion variable value of the distortion array according to the coding distortion value.
Step 930, increasing the code count value according to a preset first step.
Step 270, a new image to be processed is acquired.
And 280, detecting the image quality of the new image to be processed according to the updated image parameter value so as to obtain an image quality detection result corresponding to the new image to be processed.
All the above technical solutions may be combined to form an optional embodiment of the present application, and will not be described in detail herein.
In order to facilitate better implementation of the image quality improving method according to the embodiment of the present application, the embodiment of the present application further provides an image quality improving apparatus. Referring to fig. 18, fig. 18 is a schematic structural diagram of an image quality improving apparatus according to an embodiment of the application. The image quality improving apparatus 1100 may include:
the first obtaining unit 1101 is configured to obtain an image parameter value, where the image parameter value includes a coding count value, a distortion variable value, and a capacity of a distortion array.
The image quality detection unit 1102 is configured to perform image quality detection on an image to be processed according to the image parameter value to obtain an image quality detection result.
Alternatively, the image quality detecting unit 1102 may be configured to determine whether the encoded count value is greater than or equal to a capacity, select a maximum variable value from variables of the distortion array if the encoded count value is greater than or equal to the capacity, determine whether the distortion variable value is greater than a product of a preset weight and the maximum variable value, output a first detection result if the distortion variable value is greater than the product of the preset weight and the maximum variable value, output a second detection result if the encoded count value is less than the capacity, and output a second detection result if the distortion variable value is less than or equal to the product of the preset weight and the maximum variable value.
The first filtering unit 1103 is configured to filter the image to be processed according to the image quality detection result.
Optionally, the first filtering unit 1103 may be configured to obtain gradient values of a plurality of pixels of the image to be processed, filter the pixel corresponding to the gradient value if the gradient value is greater than a preset gradient threshold, and increase the second variable value according to a preset third step size to obtain an increased second variable value if the gradient value is less than or equal to the preset gradient threshold, or after filtering.
An encoding unit 1104, configured to encode the filtered image to be processed according to the image quality detection result to obtain an encoded code stream.
A first output unit 1105, configured to output an image to be processed according to the encoded code stream.
Optionally, the image quality improving apparatus 1100 may further include:
an updating unit 1106 is configured to update the image parameter value to obtain an updated image parameter value.
Optionally, the updating unit 1106 may be configured to obtain an encoding distortion value of the image to be processed, update a variable of the distortion array and a distortion variable value according to the encoding distortion value, and increase the encoding count value according to a preset first step.
Alternatively, the first acquisition unit 1101 may be further configured to acquire a new image to be processed.
Optionally, the image quality detection unit 1102 may be further configured to perform image quality detection on the new image to be processed according to the updated image parameter value, so as to obtain an image quality detection result corresponding to the new image to be processed.
Each unit in the image quality improving apparatus may be implemented in whole or in part by software, hardware, or a combination thereof. The above units may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor invokes and executes operations corresponding to the above units.
The image quality improving apparatus 1100 may be integrated in a terminal or a server having a memory and a processor mounted therein and having an arithmetic capability, or the image quality improving apparatus 1100 may be the terminal or the server.
Optionally, the present application further provides a computer device, including a memory and a processor, where the memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.
Fig. 19 is a schematic structural diagram of a computer device according to an embodiment of the present application, where the computer device may be a terminal or a server shown in fig. 8. As shown in fig. 19, the computer device 1200 may include a processor 1201, a memory 1202, a touch screen 1203, and a communication bus. The processor 1201, the memory 1202 and the touch display 1203 communicate with each other via a communication bus. The touch display 1203 is used for data communication between the apparatus 700 and an external device. The memory 1202 may be used to store software programs and modules, and the processor 1201 is configured to execute the software programs and modules stored in the memory 1202, such as the software programs for corresponding operations in the foregoing method embodiments.
Alternatively, the processor 1201 may invoke a software program and modules stored in the memory 1202 to obtain image parameter values including a coding count value, a distortion variable value, and a capacity of a distortion array, perform image quality detection on an image to be processed according to the image parameter values to obtain a quality detection result corresponding to the image to be processed, filter the image to be processed according to the quality detection result, code the filtered image to obtain a coded stream according to the quality detection result, and output the image to be processed according to the coded stream.
As shown in fig. 19, fig. 19 is a schematic structural diagram of a computer device according to an embodiment of the present application, where the computer device may be the terminal shown in fig. 8. The computer device 1200 includes a processor 1201 having one or more processing cores, a memory 1202 having one or more computer readable storage media, and a computer program stored on the memory 1202 and executable on the processor. Wherein the processor 1201 is electrically connected to the memory 1202. It will be appreciated by those skilled in the art that the computer device structure shown in the figures is not limiting of the computer device and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
The processor 1201 is a control center of the computer device 1200, connects various parts of the entire computer device 1200 using various interfaces and lines, and performs various functions of the computer device 1200 and processes data by running or loading software programs and/or modules stored in the memory 1202, and calling data stored in the memory 1202.
In an embodiment of the present application, the processor 1201 in the computer apparatus 1200 loads instructions corresponding to the processes of one or more application programs into the memory 1202 according to the following steps, and the processor 1201 executes the application programs stored in the memory 1202, thereby implementing various functions:
The method comprises the steps of displaying a user interface in a touch display screen, wherein the user interface comprises a plurality of interface elements, responding to a first touch operation aiming at the user interface, determining a target interface element which is currently touched on the user interface and a category to which the target interface element belongs, determining a target vibration signal corresponding to the target interface element according to the category to which the target interface element belongs and a preset corresponding relation between the interface element and the vibration signal, controlling target equipment to vibrate according to the target vibration signal, and outputting a target vibration effect, wherein the target vibration effect is used for prompting the category to which the target interface element belongs and/or a function of the target interface element.
The specific implementation of each operation above may be referred to the previous embodiments, and will not be described herein.
Optionally, as shown in FIG. 19, the computer device 1200 further includes a touch display 1203, a radio frequency circuit 1204, an audio circuit 1205, an input unit 1206, and a power supply 1207. The processor 1201 is electrically connected to the touch display 1203, the rf circuit 1204, the audio circuit 1205, the input unit 1206, and the power supply 1207, respectively. Those skilled in the art will appreciate that the computer device structure shown in FIG. 19 is not limiting of the computer device and may include more or fewer components than shown, or may be combined with certain components, or a different arrangement of components.
The touch display 1203 may be configured to display a graphical user interface and receive an operation instruction generated by a user acting on the graphical user interface. The touch display 1203 may include a display panel and a touch panel. Wherein the display panel may be used to display information entered by a user or provided to a user as well as various graphical user interfaces of a computer device, which may be composed of graphics, text, icons, video, and any combination thereof. Alternatively, the display panel may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. The touch panel may be used to collect touch operations on or near the user (such as operations on or near the touch panel by the user using any suitable object or accessory such as a finger, stylus, etc.), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Alternatively, the touch panel may include two parts, a touch detection device and a touch controller. The touch controller receives touch information from the touch detection device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 1201, and can receive and execute commands sent by the processor 1201. The touch panel may overlay the display panel, and upon detection of a touch operation thereon or thereabout, the touch panel is passed to the processor 1201 to determine the type of touch event, and the processor 1201 then provides a corresponding visual output on the display panel in accordance with the type of touch event. In the embodiment of the application, the touch panel and the display panel can be integrated into the touch display screen 1203 to realize the input and output functions. In some embodiments, however, the touch panel and the touch panel may be implemented as two separate components to perform the input and output functions. I.e. the touch sensitive display 1203 may also implement an input function as part of the input unit 1206.
The rf circuitry 1204 may be configured to receive and transmit rf signals to and from a network device or other computer device via wireless communication to establish wireless communication with the network device or other computer device.
Audio circuitry 1205 may be used to provide an audio interface between a user and a computer device through speakers, microphones, and so on. The audio circuit 1205 may convert received audio data into electrical signals for transmission to a speaker for conversion to sound signals for output by the speaker, and on the other hand, the microphone converts collected sound signals into electrical signals for receipt by the audio circuit 1205 for conversion to audio data for processing by the audio data output processor 1201 for transmission to, for example, another computer device via the radio frequency circuit 1204 or for outputting the audio data to the memory 1202 for further processing. Audio circuitry 1205 may also include an ear bud jack to provide communication between the peripheral ear bud and the computer device.
The input unit 1206 may be used to receive input digital, character information, or biometric information (e.g., fingerprint, iris, facial information, etc.), as well as to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
The power supply 1207 is used to power the various components of the computer device 1200. Alternatively, the power supply 1207 may be logically connected to the processor 1201 through a power management system, so as to perform functions of managing charging, discharging, and power consumption management through the power management system. The power supply 1207 may also include one or more of any components, such as a direct current or alternating current power supply, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
Although not shown in fig. 19, the computer device 1200 may further include a camera, a sensor, a wireless fidelity module, a bluetooth module, etc., which are not described herein.
The present application also provides a computer-readable storage medium storing a computer program. The computer readable storage medium may be applied to a computer device, and the computer program causes the computer device to execute a corresponding flow in the image quality improving method in the embodiment of the present application, which is not described herein for brevity.
The present application also provides a computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the computer device executes the corresponding flow in the image quality improving method in the embodiment of the present application, which is not described herein for brevity.
It should be appreciated that the processor of an embodiment of the present application may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method embodiments may be implemented by integrated logic circuits of hardware in a processor or instructions in software form. The Processor may be a general purpose Processor, a digital signal Processor (DIGITAL SIGNAL Processor, DSP), an Application SPECIFIC INTEGRATED Circuit (ASIC), an off-the-shelf programmable gate array (Field Programmable GATE ARRAY, FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. The disclosed methods, steps, and logic blocks in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be embodied directly in the execution of a hardware decoding processor, or in the execution of a combination of hardware and software modules in a decoding processor. The software modules may be located in a random access memory, flash memory, read only memory, programmable read only memory, or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in a memory, and the processor reads the information in the memory and, in combination with its hardware, performs the steps of the above method.
It will be appreciated that the memory in embodiments of the application may be volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. The nonvolatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable EPROM (EEPROM), or a flash Memory. The volatile memory may be random access memory (Random Access Memory, RAM) which acts as external cache memory. By way of example, and not limitation, many forms of RAM are available, such as static random access memory (STATIC RAM, SRAM), dynamic random access memory (DYNAMIC RAM, DRAM), synchronous Dynamic Random Access Memory (SDRAM), double data rate Synchronous dynamic random access memory (Double DATA RATE SDRAM, DDR SDRAM), enhanced Synchronous dynamic random access memory (ENHANCED SDRAM, ESDRAM), synchronous link dynamic random access memory (SYNCHLINK DRAM, SLDRAM), and Direct memory bus RAM (DR RAM). It should be noted that the memory of the systems and methods described herein is intended to comprise, without being limited to, these and any other suitable types of memory.
It should be appreciated that the above memory is exemplary and not limiting, and for example, the memory in the embodiments of the present application may be static random access memory (STATIC RAM, SRAM), dynamic random access memory (DYNAMIC RAM, DRAM), synchronous Dynamic Random Access Memory (SDRAM), double data rate synchronous dynamic random access memory (double DATA RATE SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (ENHANCED SDRAM, ESDRAM), synchronous connection dynamic random access memory (SYNCH LINK DRAM, SLDRAM), direct Rambus RAM (DR RAM), and the like. That is, the memory in embodiments of the present application is intended to comprise, without being limited to, these and any other suitable types of memory.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In the several embodiments provided by the present application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server) to perform all or part of the steps of the method according to the embodiments of the present application. The storage medium includes various media capable of storing program codes such as a U disk, a mobile hard disk, a ROM, a RAM, a magnetic disk or an optical disk.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.