Video frame optimization method, mobile terminal and computer-readable storage medium
By identifying and processing pixel points in the flickering area in the video frame, updating and deflashing processing formulas using μ value, generating an optimized video frame, solving the brightness flickering problem when recording video and improving the video playback quality.
Patent Information
- Application Number
- CN201910883421.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-09-18
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2039-09-18
AI Technical Summary
When recording video, it is affected by the exposure time, recording frame rate and ambient lighting conditions, resulting in poor video image quality and flickering, affecting the user's viewing experience.
By obtaining pixel points in the flickering area in the video frame, updating the formula and deflashing processing formula using the μ value, deflashing these pixel points, and generating an optimized video frame.
It alleviates the brightness flickering during video playback and improves the quality of video playback.
Smart Images

Figure CN110675342B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a video frame optimization method, a mobile terminal, and a computer-readable storage medium. Background Art
[0002] Video recording is a frequently used application among many mobile applications. However, due to factors such as exposure time, frame rate, and ambient lighting conditions, video recording can experience flickering, resulting in poor image quality during playback and severely impacting the user's viewing experience. Summary of the Invention
[0003] The main purpose of the present invention is to provide a video frame optimization method, a mobile terminal and a computer-readable storage medium, aiming to solve the technical problem in the prior art that the image quality of the recorded video is low due to the influence of objective factors.
[0004] To achieve the above object, the present invention provides a video frame optimization method, which includes:
[0005] Obtaining a video frame to be processed, and determining pixels in a flickering area in the video frame;
[0006] performing a de-flickering process on the pixel points;
[0007] When the de-flickering process is completed for all pixels in the flickering area, an optimized video frame is obtained.
[0008] Optionally, determining the pixel points in the flickering area in the video frame includes:
[0009] Calculate the μ value corresponding to each pixel in the current video frame;
[0010] Calculate the difference between each pixel point in the current video frame and the μ value corresponding to each pixel point;
[0011] If the difference between the μ values corresponding to the pixel points is less than a preset difference, it is determined that the pixel point is in the flickering area.
[0012] Optionally, the current video frame is not the first video frame, and the calculating of the μ value corresponding to each pixel point in the current video frame includes:
[0013] The μ value corresponding to each pixel point in the current video frame is calculated using the μ value update formula, which is as follows:
[0014] μ t (x, y) = (1-a)*μ t-1 (x, y) + a*I
[0015] Among them, a is the fusion factor, μ t-1 (x, y) is the μ value of the pixel at (x, y) in the previous video frame, I is the pixel value of the pixel at (x, y) in the current video frame, μ t (x, y) is the μ value of the pixel at (x, y) in the current video frame.
[0016] Optionally, the performing a de-flickering process on the pixel point includes:
[0017] The pixel point is de-flickered using a de-flickering processing formula, which is as follows:
[0018] B=W0*B t-1 +W1*B t
[0019] Among them, W0 and W1 are weights, B t-1 is the pixel value of the corresponding position of the pixel point in the previous video frame, B t is the pixel value of the pixel point, and B is the new pixel value of the pixel point after de-flickering processing.
[0020] Optionally, obtaining a video frame to be processed and determining pixels in a flickering area in the video frame includes:
[0021] Obtaining a video frame to be processed and recording information of the video frame to be processed, wherein the recording information includes a recording time, a recording location, and a recording frame rate;
[0022] If the recording time is within a preset time period, the recording location is at a preset location, and the recording frame rate is greater than a preset rate, then the pixel points in the flickering area of the video frame are determined.
[0023] Optionally, the step of obtaining a video frame to be processed and determining pixels in a flickering area in the video frame further includes:
[0024] Obtain a video frame to be processed, and detect whether the video corresponding to the video frame to be processed is a flickering video;
[0025] If the video corresponding to the to-be-processed video frame is a flickering video, then pixel points in a flickering area of the video frame are determined.
[0026] Optionally, detecting whether the video corresponding to the to-be-processed video frame is a flickering video includes:
[0027] Acquire two adjacent video frames from the video frame to be processed;
[0028] Obtaining a frame difference image based on the two adjacent video frames;
[0029] performing binarization processing on the frame difference image to obtain a binarized image;
[0030] Performing connected domain extraction on the binary image to obtain a plurality of connected regions;
[0031] If there is a connected area whose area is greater than or equal to a preset area threshold among the plurality of connected areas, it is determined that the video corresponding to the to-be-processed video frame is a flickering video.
[0032] Optionally, after obtaining the frame difference image based on the two adjacent video frames, the method further includes:
[0033] Detecting whether the average brightness value of the frame difference image is greater than or equal to a preset brightness value;
[0034] If the average brightness value of the frame difference image is greater than or equal to the preset brightness value, a step of binarizing the frame difference image to obtain a binarized image is performed.
[0035] In addition, to achieve the above-mentioned purpose, the present invention also provides a mobile terminal, which includes: a memory, a processor, and a video frame optimization program stored in the memory and runnable on the processor, and when the video frame optimization program is executed by the processor, the steps of the video frame optimization method described above are implemented.
[0036] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, on which a video frame optimization program is stored. When the video frame optimization program is executed by a processor, the steps of the video frame optimization method described above are implemented.
[0037] In the present invention, a video frame to be processed is obtained, and pixels in the flickering area of the video frame are identified; a de-flickering process is performed on the pixels; and when the de-flickering process is completed for all pixels in the flickering area, an optimized video frame is obtained. By performing a de-flickering process on the pixels in the flickering area of the video frame, an optimized video frame is obtained, which alleviates brightness flicker during video playback and improves video playback quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 A schematic diagram of the hardware structure of a mobile terminal for implementing various embodiments of the present invention;
[0039] Figure 2 A communication network system architecture diagram provided by an embodiment of the present invention;
[0040] Figure 3 This is a flow chart of an embodiment of a video frame optimization method according to the present invention;
[0041] Figure 4 for Figure 3 A detailed flow chart of step S10 in an embodiment;
[0042] Figure 5 for Figure 3 Detailed flowchart of another embodiment of step S10.
[0043] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments. DETAILED DESCRIPTION
[0044] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0045] In the subsequent description, suffixes such as "module," "component," or "unit" used to represent elements are only used to facilitate the description of the present invention and have no specific meaning. Therefore, "module," "component," or "unit" can be used interchangeably.
[0046] In the embodiments of the present invention, the video frame optimization method is applied to a mobile terminal, which can be implemented in various forms. For example, the mobile terminal involved in the present invention may include a mobile phone, a tablet computer, a laptop computer, a PDA, a personal digital assistant (PDA), and the like.
[0047] The following description will be made by taking a tablet computer as an example. It will be understood by those skilled in the art that, in addition to components specifically used for mobile purposes, the configuration according to the embodiment of the present invention can also be applied to other types of mobile terminals.
[0048] See also Figure 1 , Figure 1 To implement the hardware structure diagram of the mobile terminal of each embodiment of the present invention, the terminal 100 may include: RF (Radio Frequency, radio frequency) unit 101, WiFi module 102, audio output unit 103, A / V (audio / video) input unit 104, sensor 105, display unit 106, user input unit 107, interface unit 108, memory 109, processor 110, and power supply 111 and other components. Those skilled in the art will understand that Figure 1 The terminal structure shown in the figure does not constitute a limitation to the mobile terminal. The mobile terminal may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0049] The following combination Figure 1 A detailed introduction to the various components of the mobile terminal:
[0050] The RF unit 101 can be used to send and receive information or receive signals during calls. Specifically, it receives downlink information from the base station and transmits it to the processor 110 for processing. It also transmits uplink data to the base station. Typically, the RF unit 101 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier, a duplexer, and more. Furthermore, the RF unit 101 can communicate with the network and other devices via wireless communication. The above-mentioned wireless communications may use any communication standard or protocol, including but not limited to GSM (Global System of Mobile communication), GPRS (General Packet Radio Service), CDMA2000 (Code Division Multiple Access 2000), WCDMA (Wideband Code Division Multiple Access), TD-SCDMA (Time Division-Synchronous Code Division Multiple Access), FDD-LTE (Frequency Division Duplexing-Long Term Evolution) and TDD-LTE (Time Division Duplexing-Long Term Evolution), etc.
[0051] WiFi is a short-range wireless transmission technology. Mobile terminals can help users send and receive emails, browse web pages, and access streaming media through the WiFi module 102. It provides users with wireless broadband Internet access. Figure 1 The WiFi module 102 is shown, but it is understandable that it is not an essential component of the mobile terminal and can be omitted as needed without changing the essence of the invention.
[0052] The audio output unit 103 can convert audio data received by the RF unit 101 or the WiFi module 102 or stored in the memory 109 into an audio signal and output it as sound when the mobile terminal 100 is in a call signal reception mode, a talk mode, a recording mode, a voice recognition mode, a broadcast reception mode, or the like. Furthermore, the audio output unit 103 can also provide audio output related to a specific function performed by the terminal 100 (e.g., a call signal reception sound, a message reception sound, etc.). The audio output unit 103 may include a speaker, a buzzer, or the like.
[0053] The A / V input unit 104 is used to receive audio or video signals. The A / V input unit 104 may include a graphics processing unit (GPU) 1041 and a microphone 1042. The GPU 1041 processes image data of still images or videos captured by an image capture device (e.g., a camera) in video capture mode or image capture mode. The processed image frames may be displayed on the display unit 106. The image frames processed by the GPU 1041 may be stored in the memory 109 (or other storage medium) or transmitted via the RF unit 101 or the WiFi module 102. The microphone 1042 may receive sound (audio data) in operating modes such as a phone call mode, a recording mode, and a voice recognition mode, and may process such sound into audio data. In the phone call mode, the processed audio (voice) data may be converted into a format that can be transmitted to a mobile communication base station via the RF unit 101. The microphone 1042 may implement various types of noise cancellation (or suppression) algorithms to eliminate (or suppress) noise or interference generated during the reception and transmission of audio signals.
[0054] The mobile terminal 100 also includes at least one sensor 105, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 1061 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 1061 and / or the backlight when the mobile terminal 100 is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the terminal posture (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that can be configured in the terminal, such as fingerprint sensors, pressure sensors, iris sensors, molecular sensors, gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be described in detail here.
[0055] The display unit 106 is used to display information input by the user or information provided to the user. The display unit 106 may include a display panel 1061, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
[0056] The user input unit 107 can be used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the terminal. Specifically, the user input unit 107 may include a touch panel 1071 and other input devices 1072. The touch panel 1071, also known as a touch screen, can collect user touch operations on or near it (such as operations performed by the user using a finger, stylus, or any other suitable object or accessory on or near the touch panel 1071) and drive the corresponding connection device according to a pre-set program. The touch panel 1071 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch direction and detects the signal caused by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device and converts it into touch point coordinates, which are then sent to the processor 110. It can also receive commands sent by the processor 110 and execute them. In addition, the touch panel 1071 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 1071, the user input unit 107 may further include other input devices 1072. Specifically, the other input devices 1072 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, power keys, etc.), a trackball, a mouse, a joystick, etc., and are not specifically limited here.
[0057] Furthermore, the touch panel 1071 may cover the display panel 1061. When the touch panel 1071 detects a touch operation on or near it, it transmits the information to the processor 110 to determine the type of touch event. Subsequently, the processor 110 provides a corresponding visual output on the display panel 1061 according to the type of touch event. Figure 1 In the embodiment, the touch panel 1071 and the display panel 1061 are two independent components to realize the input and output functions of the mobile terminal. However, in some embodiments, the touch panel 1071 and the display panel 1061 can be integrated to realize the input and output functions of the mobile terminal, which is not limited here.
[0058] The interface unit 108 serves as an interface through which at least one external device can be connected to the mobile terminal 100. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, etc. The interface unit 108 may be used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements within the mobile terminal 100 or may be used to transmit data between the mobile terminal 100 and an external device.
[0059] Memory 109 can be used to store software programs and various data. Memory 109 may primarily include a program storage area and a data storage area. The program storage area may store an operating system and at least one application required for a function (such as a sound playback function or an image playback function); the data storage area may store data generated based on the use of the mobile phone (such as audio data, a phone book, etc.). Furthermore, memory 109 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0060] Processor 110 is the control center of the mobile terminal, connecting all components of the mobile terminal using various interfaces and circuits. By running or executing software programs and / or modules stored in memory 109 and accessing data stored in memory 109, it performs various functions of the mobile terminal and processes data, thereby providing overall monitoring of the terminal's main screen display. Processor 110 may include one or more processing units; preferably, processor 110 may integrate an application processor and a modem processor, wherein the application processor primarily processes the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into processor 110.
[0061] The mobile terminal 100 may also include a power supply 111 (such as a battery) for supplying power to various components. Preferably, the power supply 111 may be logically connected to the processor 110 through a power management system, thereby managing functions such as charging, discharging, and power consumption through the power management system.
[0062] although Figure 1 Not shown, the mobile terminal 100 may further include a Bluetooth module, etc., which will not be described in detail here.
[0063] like Figure 1 As shown, the memory 109 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a video frame optimization program. The processor 110 may be configured to call the video frame optimization program stored in the memory 109 and perform the following steps:
[0064] Obtaining a video frame to be processed, and determining pixels in a flickering area in the video frame;
[0065] performing a de-flickering process on the pixel points;
[0066] When the de-flickering process is completed for all pixels in the flickering area, an optimized video frame is obtained.
[0067] Furthermore, the processor 110 may be configured to call the video frame optimization program stored in the memory 109 and further perform the following steps:
[0068] Calculate the μ value corresponding to each pixel in the current video frame;
[0069] Calculate the difference between each pixel point in the current video frame and the μ value corresponding to each pixel point;
[0070] If the difference between the μ values corresponding to the pixel points is less than a preset difference, it is determined that the pixel point is in the flickering area.
[0071] Furthermore, the processor 110 may be configured to call the video frame optimization program stored in the memory 109 and further perform the following steps:
[0072] The μ value corresponding to each pixel point in the current video frame is calculated using the μ value update formula, which is as follows:
[0073] μ t (x, y) = (1-a)*μ t-1 (x, y) + a*I
[0074] Among them, a is the fusion factor, μ t-1 (x, y) is the μ value of the pixel at (x, y) in the previous video frame, I is the pixel value of the pixel at (x, y) in the current video frame, μ t (x, y) is the μ value of the pixel at (x, y) in the current video frame.
[0075] Furthermore, the processor 110 may be configured to call the video frame optimization program stored in the memory 109 and further perform the following steps:
[0076] The pixel point is de-flickered using a de-flickering processing formula, which is as follows:
[0077] B=W0*B t-1 +W1*B t
[0078] Among them, W0 and W1 are weights, B t-1 is the pixel value of the corresponding position of the pixel point in the previous video frame, B t is the pixel value of the pixel point, and B is the new pixel value of the pixel point after de-flickering processing.
[0079] Furthermore, the processor 110 may be configured to call the video frame optimization program stored in the memory 109 and further perform the following steps:
[0080] Obtaining a video frame to be processed and recording information of the video frame to be processed, wherein the recording information includes a recording time, a recording location, and a recording frame rate;
[0081] If the recording time is within a preset time period, the recording location is at a preset location, and the recording frame rate is greater than a preset rate, then the pixel points in the flickering area of the video frame are determined.
[0082] Furthermore, the processor 110 may be configured to call the video frame optimization program stored in the memory 109 and further perform the following steps:
[0083] Obtain a video frame to be processed, and detect whether the video corresponding to the video frame to be processed is a flickering video;
[0084] If the video corresponding to the to-be-processed video frame is a flickering video, then pixel points in a flickering area of the video frame are determined.
[0085] Furthermore, the processor 110 may be configured to call the video frame optimization program stored in the memory 109 and further perform the following steps:
[0086] Acquire two adjacent video frames from the video frame to be processed;
[0087] Obtaining a frame difference image based on the two adjacent video frames;
[0088] performing binarization processing on the frame difference image to obtain a binarized image;
[0089] Performing connected domain extraction on the binary image to obtain a plurality of connected regions;
[0090] If there is a connected area whose area is greater than or equal to a preset area threshold among the plurality of connected areas, it is determined that the video corresponding to the to-be-processed video frame is a flickering video.
[0091] Furthermore, the processor 110 may be configured to call the video frame optimization program stored in the memory 109 and further perform the following steps:
[0092] Detecting whether the average brightness value of the frame difference image is greater than or equal to a preset brightness value;
[0093] If the average brightness value of the frame difference image is greater than or equal to the preset brightness value, a step of binarizing the frame difference image to obtain a binarized image is performed.
[0094] To facilitate understanding of the embodiments of the present invention, the communication network system on which the mobile terminal of the present invention is based is described below.
[0095] See also Figure 2 , Figure 2A communication network system architecture diagram is provided for an embodiment of the present invention. The communication network system is an LTE system of universal mobile communication technology. The LTE system includes a UE (User Equipment) 201, an Evolved UMTS Terrestrial Radio Access Network (E-UTRAN) 202, an Evolved Packet Core (EPC) 203, and an operator's IP service 204, which are sequentially connected in communication.
[0096] Specifically, UE201 may be the above-mentioned terminal 100, which will not be described in detail here.
[0097] E-UTRAN 202 includes eNodeB 2021 and other eNodeBs 2022 , etc. Among them, eNodeB 2021 can be connected to other eNodeBs 2022 via a backhaul (eg, an X2 interface), and eNodeB 2021 is connected to EPC 203 , and eNodeB 2021 can provide UE 201 with access to EPC 203 .
[0098] EPC 203 may include MME (Mobility Management Entity) 2031, HSS (Home Subscriber Server) 2032, other MMEs 2033, SGW (Serving Gate Way) 2034, PGW (PDN Gate Way) 2035, and PCRF (Policy and Charging Rules Function) 2036. MME 2031 is the control node that handles signaling between UE 201 and EPC 203, providing bearer and connection management. HSS 2032 provides registers for managing functions such as the Home Location Register (not shown) and stores user-specific information such as service features and data rates. All user data can be sent through SGW2034, PGW2035 can provide IP address allocation and other functions for UE 201, PCRF2036 is the policy and charging control policy decision point for service data flow and IP bearer resources, and it selects and provides available policy and charging control decisions for the policy and charging execution function unit (not shown in the figure).
[0099] The IP service 204 may include the Internet, an intranet, an IMS (IP Multimedia Subsystem), or other IP services.
[0100] Although the above description is based on the LTE system as an example, those skilled in the art should know that the present invention is not only applicable to the LTE system, but also to other wireless communication systems, such as GSM, CDMA2000, WCDMA, TD-SCDMA, and future new network systems, and is not limited here.
[0101] Based on the above-mentioned mobile terminal hardware structure and communication network system, various embodiments of the method of the present invention are proposed.
[0102] Reference Figure 3 , Figure 3 FIG. 4 is a flow chart of an embodiment of a video frame optimization method according to the present invention.
[0103] In one embodiment, a video frame optimization method includes:
[0104] Step S10, obtaining a video frame to be processed, and determining pixel points in the flickering area of the video frame;
[0105] In this embodiment, the video is composed of several video frames, which are, in chronological order, the first video frame, the second video frame, the third video frame...the Nth video frame. The first video frame, the second video frame, the third video frame...the Nth video frame are collectively referred to as video frames to be processed.
[0106] In this embodiment, the video frames to be processed can be acquired while the video is being recorded, after the recording is completed, or while the video is being played. The video frames are acquired sequentially in the order in which they were recorded, i.e., the first video frame is acquired first, followed by the second video frame, then the third video frame, and so on.
[0107] In one embodiment, determining the pixel points in the flickering area in the video frame includes:
[0108] Calculate the μ value corresponding to each pixel in the current video frame;
[0109] In this embodiment, the current video frame is not the first video frame, that is, starting from the second video frame or the third video frame or the nth video frame, the pixel points in the flickering area in the video frame are determined.
[0110] In this embodiment, each pixel in each video frame corresponds to a μ value. The μ value corresponding to each pixel in the first video frame is the pixel value of each pixel, and the μ value corresponding to each pixel in the current video frame is calculated using the μ value update formula.
[0111] In one embodiment, the current video frame is not the first video frame, and the calculating of μ values corresponding to each pixel point in the current video frame includes:
[0112] The μ value corresponding to each pixel point in the current video frame is calculated using the μ value update formula, which is as follows:
[0113] μ t (x, y) = (1-a)*μ t-1 (x,y)+a*I (1)
[0114] Among them, a is the fusion factor, and its specific value is set according to actual needs, μ t-1 (x, y) is the μ value of the pixel at (x, y) in the previous video frame, I is the pixel value of the pixel at (x, y) in the current video frame, μ t (x, y) is the μ value of the pixel at (x, y) in the current video frame.
[0115] In this embodiment, if the current video frame is the second video frame, if it is necessary to calculate the μ value corresponding to a pixel point in the second video frame, the pixel value of the pixel point at the same position in the first video frame is used as μ. t-1 Substitute (x, y) into the above formula (1), and substitute the pixel value of the pixel point as I into the above formula (1), so as to obtain μ t (x, y), that is, the μ value corresponding to the pixel point in the second video frame. According to the same method, the same calculation process is performed on other pixel points to obtain the μ value corresponding to each pixel point in the second video frame.
[0116] In this embodiment, if the current video frame is the third video frame, if the μ value corresponding to a pixel point in the third video frame needs to be calculated, the μ value of the pixel point at the same position of the pixel point in the second video frame is used as μ t-1 Substitute (x, y) into the above formula (1), and substitute the pixel value of the pixel point as I into the above formula (1), so as to obtain μ t (x, y) is the μ value corresponding to this pixel in the third video frame. Perform the same calculation on the other pixels to obtain the μ value corresponding to each pixel in the third video frame. Similarly, the μ value corresponding to each pixel in the fourth through Nth video frames can be obtained.
[0117] The difference between each pixel point and the μ value corresponding to each pixel point in the current video frame is calculated; if the difference between the μ values corresponding to the pixel point and the pixel point is less than a preset difference, it is determined that the pixel point is in the flickering area.
[0118] According to the above embodiment, the μ value corresponding to each pixel in the current video frame is calculated. Then, the difference between the μ values corresponding to each pixel in the current video frame is further calculated. That is, the difference between the μ values corresponding to pixel 1 and pixel 1 is calculated, the difference between the μ values corresponding to pixel 2 and pixel 2 is calculated, the difference between the μ values corresponding to pixel 3 and pixel 3 is calculated, and so on, thereby obtaining a number of difference values. The difference between the μ values corresponding to the pixels is then further compared to see whether it is less than a preset difference. If the difference between a pixel and its corresponding μ value is less than the preset difference, then the pixel is determined to be in a flickering area. For example, if the difference between the μ values corresponding to pixel 1 and pixel 1 is less than the preset difference, the difference between the μ values corresponding to pixel 3 and pixel 3 is less than the preset difference, and the difference between the μ values corresponding to pixel 7 and pixel 7 is less than the preset difference, then pixels 1, 3, and 7 are determined to be in a flickering area. In this embodiment, if the difference between the μ values corresponding to a pixel is less than a preset difference, the pixel is determined to be in the foreground area. If the difference between the μ values corresponding to a pixel is not less than the preset difference, the pixel is determined to be in the background area. The foreground area is designated as a severely flickering area, and the background area is designated as a less severely flickering area. Therefore, when the difference between the μ values corresponding to a pixel is less than the preset difference, the pixel is determined to be in the flickering area.
[0119] Step S20, performing a de-flickering process on the pixel points;
[0120] In this embodiment, step S20 includes: performing a de-flickering process on the pixel point using a de-flickering process formula, and the de-flickering process formula is as follows:
[0121] B=W0*B t-1 +W1*B t
[0122] Among them, W0 and W1 are weights, B t-1 is the pixel value of the corresponding position of the pixel point in the previous video frame, B t is the pixel value of the pixel point, and B is the new pixel value of the pixel point after de-flickering processing.
[0123] In this embodiment, 1=W0+W1, and the value range of W0 is 0.3 to 0.4. The specific value of W0 is selected according to the actual situation. After determining W0, W1 can be further determined. For example, if W0 is 0.3 and W1 is 0.7, if a pixel with a pixel value of 100 needs to be de-flickered, the pixel value of the pixel at the corresponding position of the pixel in the previous video frame is obtained. If the position of the pixel that needs to be de-flickered is (3, 7), the pixel value of the pixel at the position (3, 7) in the previous video frame is obtained, such as 80. After substituting it into the above de-flickering processing formula, the new pixel value B=94 of the pixel after de-flickering is calculated. According to the same method, all pixels in the flickering area can be de-flickered.
[0124] Step S30: When the de-flickering process is completed for all the pixels in the flickering area, an optimized video frame is obtained.
[0125] In this embodiment, the de-flickering process is performed on all the pixels in the flickering area, and no process is performed on other pixels, so that the optimization work is completed, thereby obtaining an optimized version of the video frame.
[0126] In this embodiment, a video frame to be processed is obtained, and pixels in the flickering area of the video frame are identified; a de-flickering process is performed on the pixels; and when the de-flickering process is completed for all pixels in the flickering area, an optimized video frame is obtained. By performing a de-flickering process on the pixels in the flickering area of the video frame, an optimized video frame is obtained, which alleviates brightness flicker during video playback and improves video playback quality.
[0127] Reference Figure 4 , Figure 4 for Figure 3 Detailed flow chart of step S10 in the embodiment. Figure 4 In one embodiment of the video frame optimization method of the present invention, step S10 includes:
[0128] Step S101, obtaining a video frame to be processed and recording information of the video frame to be processed, wherein the recording information includes recording time, recording location, and recording frame rate;
[0129] In this embodiment, when recording a video, information such as recording time, recording location, and recording frame rate is synchronously obtained. Therefore, the video frame to be processed and the recording information of the video frame to be processed can be obtained, and the recording information includes the recording time, recording location, and recording frame rate.
[0130] Step S102 : if the recording time is within a preset time period, the recording location is within a preset location, and the recording frame rate is greater than a preset rate, then determine the pixel points in the flickering area of the video frame.
[0131] In real life, when recording video indoors, the brightness of indoor incandescent lamps fluctuates periodically, causing the video brightness to flicker significantly while recording, which also introduces a lot of noise. Furthermore, recording at a high frame rate can also cause video brightness flicker.
[0132] In this embodiment, when the recording time is within a preset time period (the preset time period can be set according to the time period when the lights need to be turned on, for example, 19:00 to 7:00), and the recording location is within a preset location (the preset location is indoors, and the map software can be used to determine whether the recording location is within the preset location), and the recording frame rate is greater than the preset rate (the preset rate is set according to actual conditions, for example, 180 frames / second), it can be determined that the current video frame to be processed will flicker during playback. Therefore, it is necessary to determine the pixel points in the flickering area in the video frame for subsequent optimization processing.
[0133] In this embodiment, whether optimization processing is necessary is determined by recording information, and subsequent optimization processing is performed only when optimization processing is necessary, thereby avoiding optimizing processing on the video frames to be processed when optimization processing is not necessary, thereby avoiding waste of resources.
[0134] Reference Figure 5 , Figure 5 for Figure 3 A detailed flow chart of another embodiment of step S10 is shown in FIG. Figure 5 In one embodiment of the video frame optimization method of the present invention, step S10 includes:
[0135] Step S103: obtaining a video frame to be processed, and detecting whether the video corresponding to the video frame to be processed is a flickering video;
[0136] In one embodiment, detecting whether the video corresponding to the to-be-processed video frame is a flickering video includes:
[0137] Acquire two adjacent video frames from the video frame to be processed;
[0138] In this embodiment, a video is composed of a plurality of video frames, which are, in chronological order, the first video frame, the second video frame, the third video frame, and so on. The first video frame, the second video frame, the third video frame, and so on are collectively referred to as the video frames to be processed. From the video frames to be processed, any two adjacent video frames are obtained.
[0139] Obtaining a frame difference image based on the two adjacent video frames;
[0140] In this embodiment, the difference in the brightness values of pixels at the same position in two adjacent video frames is calculated as the brightness value of the corresponding position in the frame difference image, thereby generating a frame difference image. For example, the brightness values of the pixel at position 1 in two adjacent video frames are A and a, respectively; the brightness values of the pixel at position 2 in two adjacent video frames are B and b, respectively; and the brightness values of the pixel at position 3 in two adjacent video frames are C and c, respectively. The brightness value of the pixel at position 1 in the resulting frame difference image is the difference between A and a, the brightness value of the pixel at position 2 in the frame difference image is the difference between B and b, and the brightness value of the pixel at position 3 in the frame difference image is the difference between C and c.
[0141] performing binarization processing on the frame difference image to obtain a binarized image;
[0142] In this embodiment, a brightness threshold is preset, and the brightness values of pixels in the frame difference image whose pixel values are greater than the brightness threshold are updated to 255, and the pixel values of pixels in the frame difference image whose pixel values are less than the brightness threshold are updated to 0, thereby obtaining a binary image.
[0143] Performing connected domain extraction on the binary image to obtain a plurality of connected regions;
[0144] In this embodiment, connected regions are extracted from the binary image, i.e., regions consisting of adjacent pixels with the same brightness value are extracted to obtain several connected regions. For example, if the brightness values of a pixel and its upper, lower, left, and right pixels are all equal, these five pixels constitute a connected region.
[0145] If there is a connected area whose area is greater than or equal to a preset area threshold among the plurality of connected areas, it is determined that the video corresponding to the to-be-processed video frame is a flickering video.
[0146] In this embodiment, the area of a connected region is determined by the number of pixels. For example, if a connected region consists of 5 pixels, the area of the connected region is 5. The preset area threshold is set based on actual conditions, for example, 20. That is, when at least one connected region among a plurality of connected regions consists of 20 or more pixels, the video corresponding to the to-be-processed video frame is determined to be a flickering video.
[0147] Furthermore, after obtaining the frame difference image based on the two adjacent video frames, the method further includes:
[0148] Detecting whether the average brightness value of the frame difference image is greater than or equal to a preset brightness value; if the average brightness value of the frame difference image is greater than or equal to the preset brightness value, performing a step of binarizing the frame difference image to obtain a binarized image.
[0149] In this embodiment, after obtaining the frame difference image, the average brightness of the frame difference image is calculated. If the average brightness of the frame difference image is less than a preset brightness value (the preset brightness value is set according to actual conditions), it can be determined that there is no brightness flicker between the two adjacent video frames, which means that the video corresponding to the video frame to be processed does not contain flicker. Only when the average brightness is greater than or equal to the preset brightness, the subsequent judgment steps are performed.
[0150] Step S104 : If the video corresponding to the to-be-processed video frame is a flickering video, then determine the pixel points in the flickering area of the video frame.
[0151] In this embodiment, if the video corresponding to the to-be-processed video frame is determined to be a flickering video, then optimization processing is necessary, and subsequent optimization processing is performed. That is, subsequent optimization processing is performed only when optimization processing is necessary, thereby avoiding optimizing the to-be-processed video frame when optimization processing is not necessary, thereby avoiding waste of resources.
[0152] In addition, an embodiment of the present invention further proposes a computer-readable storage medium, on which a video frame optimization program is stored. When the video frame optimization program is executed by a processor, the steps of each embodiment of the above video frame optimization method are implemented.
[0153] The specific embodiments of the computer-readable storage medium of the present invention are substantially the same as the various embodiments of the above-mentioned video frame optimization method, and are not described in detail here.
[0154] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or system comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or system. In the absence of further limitations, an element defined by the phrase "comprising a..." does not exclude the presence of other identical elements in the process, method, article, or system comprising the element.
[0155] The serial numbers of the above embodiments of the present invention are for description only and do not represent the advantages or disadvantages of the embodiments.
[0156] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better embodiment. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0157] The above are only preferred embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention description and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A video frame optimization method, characterized in that: The video frame optimization method comprises: Obtaining a video frame to be processed, and determining pixels in a flickering area in the video frame; performing a de-flickering process on the pixel points; When the de-flickering process is completed for all pixels in the flickering area, an optimized video frame is obtained; The determining of the pixel points in the flickering area in the video frame includes: Calculate the μ value corresponding to each pixel in the current video frame; Calculate the difference between each pixel point in the current video frame and the μ value corresponding to each pixel point; If the difference between the μ values corresponding to the pixel point and the pixel point is less than the preset difference, it is determined that the pixel point is in the flickering area; Among them, each pixel in each video frame corresponds to a μ value, the μ value corresponding to each pixel in the first video frame is the pixel value of each pixel, and the μ value corresponding to each pixel in the current video frame is calculated by the μ value update formula; The current video frame is not the first video frame, and the calculating of μ values corresponding to each pixel point in the current video frame includes: The μ value corresponding to each pixel point in the current video frame is calculated using the μ value update formula, which is as follows: , Among them, a is the fusion factor, In the previous video frame The μ value of the pixel at In the current video frame The pixel value of the pixel at In the current video frame μ value of the pixel at ; The performing a de-flickering process on the pixel point includes: The pixel point is de-flickered using a de-flickering processing formula, which is as follows: , in, 、 is the weight, is the pixel value of the corresponding position of the pixel point in the previous video frame, is the pixel value of the pixel point, is the new pixel value of the pixel after the de-flickering process.
2. The video frame optimization method according to claim 1, wherein: The obtaining of a video frame to be processed and determining pixels in a flickering area in the video frame includes: Obtaining a video frame to be processed and recording information of the video frame to be processed, wherein the recording information includes a recording time, a recording location, and a recording frame rate; If the recording time is within a preset time period, the recording location is at a preset location, and the recording frame rate is greater than a preset rate, then the pixel points in the flickering area of the video frame are determined.
3. The video frame optimization method according to claim 1, wherein: The step of obtaining a video frame to be processed and determining the pixel points in the flickering area of the video frame further includes: Obtain a video frame to be processed, and detect whether the video corresponding to the video frame to be processed is a flickering video; If the video corresponding to the to-be-processed video frame is a flickering video, then pixel points in a flickering area of the video frame are determined.
4. The video frame optimization method according to claim 3, wherein: The detecting whether the video corresponding to the to-be-processed video frame is a flickering video includes: Acquire two adjacent video frames from the video frame to be processed; Obtaining a frame difference image based on the two adjacent video frames; performing binarization processing on the frame difference image to obtain a binarized image; Performing connected domain extraction on the binary image to obtain a plurality of connected regions; If there is a connected area whose area is greater than or equal to a preset area threshold among the plurality of connected areas, it is determined that the video corresponding to the to-be-processed video frame is a flickering video.
5. The video frame optimization method according to claim 4, wherein: After obtaining the frame difference image based on the two adjacent video frames, the method further includes: Detecting whether the average brightness value of the frame difference image is greater than or equal to a preset brightness value; If the average brightness value of the frame difference image is greater than or equal to the preset brightness value, a step of binarizing the frame difference image to obtain a binarized image is performed.
6. A mobile terminal, characterized in that: The mobile terminal includes: a memory, a processor, and a video frame optimization program stored in the memory and executable on the processor. When the video frame optimization program is executed by the processor, the steps of the video frame optimization method according to any one of claims 1 to 5 are implemented.
7. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a video frame optimization program, which, when executed by a processor, implements the steps of the video frame optimization method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Video flicker detection method and device thereof
CN104346793A
Video de-noising processing method and device
CN106303157A
Automatic location-based camera frame rate settings
US20140300759A1