Video subtitle fuzzy processing method, device, equipment and medium

By extracting video frame images and performing grayscale conversion, adaptive binarization processing, expansion processing and Gaussian blur processing, the problems of low efficiency and poor effect in the existing technology are solved, and efficient and natural blur of subtitles are achieved Processing, suitable for different types of subtitles and backgrounds, meeting copyright protection and distribution needs.

CN118537268BActive Publication Date: 2024-11-15HANGZHOU HUACE FILM & TELEVISION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411001988.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-25
Publication Date
2024-11-15
Estimated Expiration
2044-07-25

AI Technical Summary

Technical Problem

The prior art is inefficient in video subtitles processing and poor removal, especially when dealing with different types of subtitles and dynamic backgrounds, it is difficult to meet copyright protection and distribution needs.

Method used

By extracting video frame images, selecting subtitle areas, performing grayscale conversion, adaptive binarization, expansion processing and Gaussian blur processing, combining image repair and adjustment, subtitle blur processing is realized, ensuring a smooth transition between subtitle edges and backgrounds. Visual consistency.

Benefits of technology

It improves the efficiency and effect of subtitles blur processing, is suitable for subtitles of different colors and types, ensures the copyright protection and distribution needs of subtitles, reduces manual intervention, and is suitable for batch processing of large-scale video content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118537268B_ABST
    Figure CN118537268B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of data processing technology, and provides a method, device, equipment and medium for blurring video subtitles. On the one hand, by selecting a video subtitle area, and performing grayscale conversion and adaptive binarization processing on the selected area, subtitles of different colors can be blurred naturally and evenly; on the other hand, by dilation processing and Gaussian blur processing, a smooth transition between the edge of the subtitle and the video background can be ensured to avoid hard edges and visual incoherence problems; on the other hand, by repairing and adjusting the image, the readability of the original video content is retained, and the visual consistency between the repaired area and the surrounding image is further ensured. The present invention combines a variety of optimization means to improve the efficiency of blurring subtitles, and optimizes the blurring effect of subtitles.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a method, device, equipment and medium for fuzzy processing of video subtitles. Background Art

[0002] With the widespread dissemination of digital video content and the increasing demand for copyright protection, the blurring of video subtitles has become an important technical field. Subtitle blurring technology aims to protect the copyright of video content, prevent subtitles from being illegally copied or tampered with, and meet specific distribution needs. In the process of video production and publishing, subtitles are often used to provide language translation or transcription so that viewers can understand the audio content. However, in some cases, video producers may want to prevent subtitle content from being easily copied or tampered with, or may want to provide different audiences with a version of the video without subtitles. In addition, in order to comply with certain copyright regulations or the requirements of distribution platforms, the subtitles in the video need to be further processed.

[0003] Traditional subtitle processing methods usually involve manual editing or the use of specialized software tools, which are time-consuming and imprecise. Specifically, manual editing requires frame-by-frame inspection and processing, which is inefficient and prone to errors; specialized software tools may not be able to adapt to different types of subtitles (such as hard subtitles, soft subtitles, etc.) and video content, and have poor removal effects when processing dynamic backgrounds or text with similar colors to subtitles. Summary of the invention

[0004] In view of the above, it is necessary to provide a video subtitle fuzzy processing method, device, equipment and medium, aiming to solve the problem of low efficiency in video subtitle processing and poor removal effect.

[0005] A video subtitle fuzzy processing method, the video subtitle fuzzy processing method comprising:

[0006] In response to a subtitle blurring instruction for a target video, extracting each frame of the target video;

[0007] Acquire an image containing subtitles from each frame of the target video as each frame of the image to be processed;

[0008] Select the subtitle area of ​​each frame of the image to be processed to obtain each area to be processed;

[0009] Perform grayscale conversion on each area to be processed to obtain a grayscale image corresponding to each area to be processed;

[0010] Binarization is performed on the grayscale image corresponding to each area to be processed to obtain a light and dark mask corresponding to each area to be processed;

[0011] Performing dilation processing on the bright part of the light and dark mask corresponding to each area to be processed to obtain a first image corresponding to each area to be processed;

[0012] Performing restoration processing on each first image to obtain a second image corresponding to each area to be processed;

[0013] Comparing the grayscale image corresponding to each area to be processed with the black part of the light and dark mask corresponding to each area to be processed to obtain a comparison result, and adjusting each second image according to the comparison result to obtain a third image corresponding to each area to be processed;

[0014] Performing Gaussian blur processing on each third image to obtain a fourth image corresponding to each area to be processed;

[0015] Substituting each fourth image into each frame of the image to be processed, to obtain each frame of the target image corresponding to each frame of the image to be processed;

[0016] Writing each frame of the target image into each frame of the extracted target video to obtain an intermediate video file;

[0017] The audio of the target video is extracted, and the audio is superimposed on the intermediate video file to obtain a video file after the subtitles are blurred.

[0018] According to a preferred embodiment of the present invention, the binarization process is performed on the grayscale image corresponding to each area to be processed to obtain a light and dark mask corresponding to each area to be processed, comprising:

[0019] Get the color of the subtitles in each area to be processed;

[0020] Determine the binarization parameter corresponding to each area to be processed according to the color of the subtitles in each area to be processed;

[0021] Binarization is performed on each area to be processed according to the binarization parameters corresponding to each area to be processed, so as to obtain a light and dark mask corresponding to each area to be processed;

[0022] Among them, the minimum value of the binarization parameter corresponding to the white subtitle is greater than the maximum value of the binarization parameter corresponding to the other color subtitles.

[0023] According to a preferred embodiment of the present invention, the step of performing dilation processing on the bright part of the light and dark mask corresponding to each area to be processed to obtain the first image corresponding to each area to be processed includes:

[0024] Configure the ratio of vertical expansion to horizontal expansion as the expansion ratio;

[0025] Calling the dilate function in the OpenCV library, dilating the bright part of the light and dark mask corresponding to each area to be processed based on the dilation ratio, to obtain a first image corresponding to each area to be processed;

[0026] Wherein, the expansion ratio is 1.5.

[0027] According to a preferred embodiment of the present invention, performing restoration processing on each first image to obtain a second image corresponding to each area to be processed includes:

[0028] Obtaining an average value of adjacent pixels of each first image;

[0029] Each first image is filled with an average value of adjacent pixels of each first image to obtain each second image.

[0030] According to a preferred embodiment of the present invention, adjusting each second image according to the comparison result to obtain a third image corresponding to each area to be processed includes:

[0031] Obtaining, from the comparison result, an average brightness difference value and an average contrast difference value between the grayscale image corresponding to each area to be processed and the black part of the light and dark mask corresponding to each area to be processed;

[0032] The brightness and contrast of each second image are adjusted to be the same as those of each corresponding grayscale image according to the average brightness difference value and the average contrast difference value.

[0033] According to a preferred embodiment of the present invention, performing Gaussian blur processing on each third image to obtain a fourth image corresponding to each area to be processed includes:

[0034] Call cv2.GaussianBlur function to perform Gaussian blur processing on each third image to obtain each fourth image.

[0035] According to a preferred embodiment of the present invention, after obtaining the video file after the subtitle blurring process, the method further includes:

[0036] Obtain distribution requirements;

[0037] The video file is sent to a designated terminal device according to the distribution requirement.

[0038] A video subtitle fuzzy processing device, the video subtitle fuzzy processing device comprising:

[0039] An extraction unit, configured to extract each frame of the target video in response to a subtitle blurring instruction for the target video;

[0040] An acquisition unit, used for acquiring an image containing subtitles from each frame of the target video as each frame of the image to be processed;

[0041] A frame selection unit, used for selecting the subtitle area of ​​each frame of the image to be processed to obtain each area to be processed;

[0042] A grayscale conversion unit, used for performing grayscale conversion on each area to be processed to obtain a grayscale image corresponding to each area to be processed;

[0043] A binarization processing unit is used to perform binarization processing on the grayscale image corresponding to each area to be processed to obtain a light and dark mask corresponding to each area to be processed;

[0044] An expansion processing unit, used for performing expansion processing on the bright part of the light and dark mask corresponding to each area to be processed, so as to obtain a first image corresponding to each area to be processed;

[0045] A repair processing unit, used for performing repair processing on each first image to obtain a second image corresponding to each area to be processed;

[0046] An adjustment unit, used for comparing the grayscale image corresponding to each area to be processed with the black part of the light and dark mask corresponding to each area to be processed to obtain a comparison result, and adjusting each second image according to the comparison result to obtain a third image corresponding to each area to be processed;

[0047] A Gaussian blur processing unit, used for performing Gaussian blur processing on each third image to obtain a fourth image corresponding to each area to be processed;

[0048] A replacement unit, used for replacing each fourth image with each frame of the image to be processed, so as to obtain each frame of the target image corresponding to each frame of the image to be processed;

[0049] A writing unit, used for writing each frame of the target image into each frame of the extracted target video to obtain an intermediate video file;

[0050] The superimposing unit is used to extract the audio of the target video and superimpose the audio to the intermediate video file to obtain a video file after the subtitles are blurred.

[0051] A computer device, comprising:

[0052] a memory storing at least one instruction; and

[0053] The processor executes the instructions stored in the memory to implement the video subtitle fuzzy processing method.

[0054] A computer-readable storage medium stores at least one instruction, and the at least one instruction is executed by a processor in a computer device to implement the video subtitle fuzzy processing method.

[0055] It can be seen from the above technical solutions that, on the one hand, by selecting the video subtitle area and performing grayscale conversion and adaptive binarization processing on the selected area, subtitles of different colors can be blurred naturally and evenly; on the other hand, through expansion processing and Gaussian blur processing, a smooth transition between the subtitle edge and the video background can be ensured to avoid hard edges and visual incoherence problems; on the other hand, by repairing and adjusting the image, the readability of the original video content is retained, and the visual consistency between the repaired area and the surrounding image is further ensured. The present invention combines a variety of optimization methods to improve the efficiency of subtitle blur processing and optimize the subtitle blur effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 It is a flow chart of a preferred embodiment of the video subtitle fuzzy processing method of the present invention.

[0057] Figure 2 It is a functional module diagram of a preferred embodiment of the video subtitle fuzzy processing device of the present invention.

[0058] Figure 3 It is a structural schematic diagram of a computer device of a preferred embodiment of the video subtitle fuzzy processing method of the present invention. DETAILED DESCRIPTION

[0059] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is described in detail below with reference to the accompanying drawings and specific embodiments.

[0060] like Figure 1 FIG. 1 is a flowchart of a preferred embodiment of the video subtitle fuzzy processing method of the present invention. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.

[0061] The video subtitle fuzzy processing method is applied to one or more computer devices, which are devices that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and whose hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.

[0062] The computer device may be any electronic product that can perform human-computer interaction with a user, such as a personal computer, a tablet computer, a smart phone, a personal digital assistant (PDA), a game console, an interactive network television (IPTV), a smart wearable device, etc.

[0063] The computer device may also include a network device and / or a user device, wherein the network device includes, but is not limited to, a single network server, a server group consisting of multiple network servers, or a cloud consisting of a large number of hosts or network servers based on cloud computing.

[0064] The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms.

[0065] Among them, Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0066] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0067] The network where the computer device is located includes but is not limited to the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (VPN), etc.

[0068] S10, in response to a subtitle blurring instruction for a target video, extracting each frame of the target video.

[0069] In this embodiment, the target video may be a video that needs to meet specific distribution requirements and prevent subtitles from being copied or tampered with.

[0070] S11, acquiring an image containing subtitles from each frame of the target video as each frame of the image to be processed.

[0071] Among them, only images containing subtitles need to be blurred, so firstly, images containing subtitles are obtained from each frame of the target video as each frame of the image to be processed.

[0072] S12, selecting the subtitle area of ​​each frame of the image to be processed to obtain each area to be processed.

[0073] In this embodiment, the user's selection result of the subtitle area of ​​each frame of the image to be processed can be received as each area to be processed, or the subtitle area of ​​each frame of the image to be processed can be selected using a specified selection algorithm. The present invention does not limit the means of selection.

[0074] S13, performing grayscale conversion on each area to be processed to obtain a grayscale image corresponding to each area to be processed.

[0075] In this embodiment, by performing grayscale conversion on each area to be processed, each area to be processed can be converted into a grayscale image for backup, so as to be used for subsequent further processing.

[0076] S14, performing binarization processing on the grayscale image corresponding to each area to be processed to obtain a light and dark mask corresponding to each area to be processed.

[0077] In this embodiment, the binarization process is performed on the grayscale image corresponding to each area to be processed to obtain the light and dark mask corresponding to each area to be processed, which includes:

[0078] Get the color of the subtitles in each area to be processed;

[0079] Determine the binarization parameter corresponding to each area to be processed according to the color of the subtitles in each area to be processed;

[0080] Binarization is performed on each area to be processed according to the binarization parameters corresponding to each area to be processed, so as to obtain a light and dark mask corresponding to each area to be processed;

[0081] Among them, the minimum value of the binary parameter corresponding to the white subtitle is greater than the maximum value of the binary parameter corresponding to other color subtitles, that is, the binary parameter corresponding to other color subtitles is lower than the binary parameter corresponding to the white subtitle. For example: for pure white subtitles, the corresponding binary parameter value range can be configured as [240, 255]; for yellow subtitles, the corresponding binary parameter can be configured as 220; for subtitles of other colors, the corresponding binary parameters can be uniformly configured as 180.

[0082] The bright part of the light and dark mask corresponds to the subtitle part. The fuzzy processing of the subtitle is to perform fuzzy processing on the bright part of the light and dark mask.

[0083] In the above embodiment, the color of the video subtitles is dynamically identified, and different binarization parameters are adaptively configured according to different subtitle colors to ensure that subtitles of different colors are accurately matched.

[0084] S15, dilating the bright part of the light and dark mask corresponding to each area to be processed to obtain a first image corresponding to each area to be processed.

[0085] In this embodiment, the dilation process is performed on the bright part of the light-dark mask corresponding to each area to be processed to obtain the first image corresponding to each area to be processed, which includes:

[0086] Configure the ratio of vertical expansion to horizontal expansion as the expansion ratio;

[0087] Calling the dilate function in the OpenCV library, dilating the bright part of the light and dark mask corresponding to each area to be processed based on the dilation ratio, to obtain a first image corresponding to each area to be processed;

[0088] The expansion ratio is 1.5, which is a ratio value that can ensure the best optimization effect after a large number of experimental studies.

[0089] Among them, OpenCV is an open source computer vision and machine learning software library that provides a wealth of image processing and computer vision functions and is widely used in video content analysis, target tracking, image recognition and other fields. The powerful functions and flexibility of OpenCV make it an ideal choice for implementing video subtitle blurring. By using the OpenCV library, a highly automated and adaptable video subtitle blurring technology can be developed, which can effectively blur the subtitles in the video, protect the copyright and intellectual property rights of the subtitles from infringement, and at the same time improve the processing efficiency, which is suitable for various video formats and scenarios.

[0090] In the above embodiment, considering that subtitles are usually light-colored text with a black border, but the bright part of the light-dark mask (i.e., the light-colored text area) does not include the black border of the subtitle text, it is necessary to use a dilation operation to expand the area with higher brightness to ensure that the text border is also included in the blurring range, so as to make the subtitle blurring more accurate.

[0091] S16, performing restoration processing on each first image to obtain a second image corresponding to each area to be processed.

[0092] In this embodiment, performing restoration processing on each first image to obtain a second image corresponding to each area to be processed includes:

[0093] Obtaining an average value of adjacent pixels of each first image;

[0094] Each first image is filled with an average value of adjacent pixels of each first image to obtain each second image.

[0095] Specifically, the cv2.inpaint function in the OpenCV library can be used, that is, the cv2.INPAINT_TELEA algorithm is used to fill the color based on the average color of other surrounding pixels, so that the blurred subtitle part remains close to the surrounding color, avoiding abrupt visual effects, retaining the readability of the video content, reducing the visual interference of subtitles, and thus improving the audience's viewing experience.

[0096] S17, comparing the grayscale image corresponding to each area to be processed with the black part of the light and dark mask corresponding to each area to be processed to obtain a comparison result, and adjusting each second image according to the comparison result to obtain a third image corresponding to each area to be processed.

[0097] In this embodiment, adjusting each second image according to the comparison result to obtain a third image corresponding to each area to be processed includes:

[0098] Obtaining, from the comparison result, an average brightness difference value and an average contrast difference value between the grayscale image corresponding to each area to be processed and the black part of the light and dark mask corresponding to each area to be processed;

[0099] The brightness and contrast of each second image are adjusted to be the same as those of each corresponding grayscale image according to the average brightness difference value and the average contrast difference value.

[0100] In the above embodiment, the repaired area is adjusted accordingly based on the contrast between the original grayscale image and the black part of the light and dark mask, and the overall brightness and contrast of the video are applied to the processed image, thereby ensuring the visual consistency between the repaired area and the surrounding image, and maintaining the original image quality of the video while blurring the subtitles.

[0101] S18, performing Gaussian blur processing on each third image to obtain a fourth image corresponding to each area to be processed.

[0102] In this embodiment, performing Gaussian blur processing on each third image to obtain a fourth image corresponding to each area to be processed includes:

[0103] Call cv2.GaussianBlur function to perform Gaussian blur processing on each third image to obtain each fourth image.

[0104] In the above embodiment, in order to make the repaired area merge with the original image more naturally, Gaussian blur processing is performed on the repaired area to smooth the repaired edges that may appear.

[0105] In this embodiment, when performing expansion processing and adjusting brightness and contrast, the edge expansion parameters and blur parameters are adaptively adjusted according to the frame selection range and the video file resolution, that is, the parameters can be adaptively adjusted according to the actual situation of the video, thereby improving the rationality of subtitle processing.

[0106] S19, replacing each fourth image with each frame of the image to be processed, to obtain each frame of the target image corresponding to each frame of the image to be processed.

[0107] Specifically, the processed area is seamlessly replaced back into the original video frame to complete the blurring of the subtitles, thereby achieving a video playback effect that does not interfere with content understanding and enhances the visual experience.

[0108] S20, writing each frame of the target image into each frame of the extracted target video to obtain an intermediate video file.

[0109] Specifically, the processed area is seamlessly replaced back into the extracted video frame to complete the blurring of the subtitles, thereby achieving a video playback effect that does not interfere with content understanding and enhances the visual experience.

[0110] S21, extracting the audio of the target video, and superimposing the audio to the intermediate video file to obtain a video file after the subtitles are blurred.

[0111] In this embodiment, a series of operations of blurring the subtitles are performed based on the extracted video frames, and the original target video is not affected.

[0112] Specifically, the original audio is combined with the processed video file to obtain a video file after the subtitles are blurred. In addition, by blurring the subtitles, the visual interference of the subtitles is reduced, while the readability of the video content is retained, thereby improving the viewing experience of the audience.

[0113] This embodiment combines multiple optimization methods, such as adaptive binarization processing to be applicable to subtitle blurring of different colors and styles, and image restoration and adjustment operations to be applicable to subtitle blurring of different resolutions and video qualities, so it has wide applicability. In addition, the entire processing flow is highly automated, reducing the need for manual intervention, thereby improving processing efficiency and being suitable for batch processing of large-scale video content.

[0114] In this embodiment, after obtaining the video file after the subtitle blur processing, the method further includes:

[0115] Obtain distribution requirements;

[0116] The video file is sent to a designated terminal device according to the distribution requirement.

[0117] The designated terminal device may be a video receiving end designated by the distribution requirement, and for the protection of copyright, etc., the subtitles of the video received by the designated terminal device need to be blurred to prevent the subtitles from being copied or tampered with.

[0118] It can be seen from the above technical solutions that, on the one hand, by selecting the video subtitle area and performing grayscale conversion and adaptive binarization processing on the selected area, subtitles of different colors can be blurred naturally and evenly; on the other hand, through expansion processing and Gaussian blur processing, a smooth transition between the subtitle edge and the video background can be ensured to avoid hard edges and visual incoherence problems; on the other hand, by repairing and adjusting the image, the readability of the original video content is retained, and the visual consistency between the repaired area and the surrounding image is further ensured. The present invention combines a variety of optimization methods to improve the efficiency of subtitle blur processing and optimize the subtitle blur effect.

[0119] like Figure 2 As shown, it is a functional module diagram of a preferred embodiment of the video subtitle fuzzy processing device of the present invention. The video subtitle fuzzy processing device 11 includes an extraction unit 110, an acquisition unit 111, a frame selection unit 112, a grayscale conversion unit 113, a binarization processing unit 114, an expansion processing unit 115, a repair processing unit 116, an adjustment unit 117, a Gaussian blur processing unit 118, a replacement unit 119, a writing unit 120, and an overlay unit 121. The module / unit referred to in the present invention refers to a series of computer program segments that can be executed by a processor and can complete fixed functions, which are stored in a memory. In this embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.

[0120] The extraction unit 110 is used to extract each frame of the target video in response to a subtitle blurring instruction for the target video;

[0121] The acquisition unit 111 is used to acquire an image containing subtitles from each frame of the target video as each frame of the image to be processed;

[0122] The frame selection unit 112 is used to frame the subtitle area of ​​each frame of the image to be processed to obtain each area to be processed;

[0123] The grayscale conversion unit 113 is used to perform grayscale conversion on each area to be processed to obtain a grayscale image corresponding to each area to be processed;

[0124] The binarization processing unit 114 is used to perform binarization processing on the grayscale image corresponding to each area to be processed to obtain a light and dark mask corresponding to each area to be processed;

[0125] The expansion processing unit 115 is used to perform expansion processing on the bright part of the light and dark mask corresponding to each area to be processed, so as to obtain a first image corresponding to each area to be processed;

[0126] The repair processing unit 116 is used to perform repair processing on each first image to obtain a second image corresponding to each area to be processed;

[0127] The adjustment unit 117 is used to compare the grayscale image corresponding to each area to be processed with the black part of the light and dark mask corresponding to each area to be processed to obtain a comparison result, and adjust each second image according to the comparison result to obtain a third image corresponding to each area to be processed;

[0128] The Gaussian blur processing unit 118 is used to perform Gaussian blur processing on each third image to obtain a fourth image corresponding to each area to be processed;

[0129] The replacing unit 119 is used to replace each fourth image with each frame of the image to be processed, so as to obtain each frame of the target image corresponding to each frame of the image to be processed;

[0130] The writing unit 120 is used to write each frame of the target image into each frame of the extracted target video to obtain an intermediate video file;

[0131] The superimposing unit 121 is used to extract the audio of the target video and superimpose the audio to the intermediate video file to obtain a video file after the subtitles are blurred.

[0132] It can be seen from the above technical solutions that, on the one hand, by selecting the video subtitle area and performing grayscale conversion and adaptive binarization processing on the selected area, subtitles of different colors can be blurred naturally and evenly; on the other hand, through expansion processing and Gaussian blur processing, a smooth transition between the subtitle edge and the video background can be ensured to avoid hard edges and visual incoherence problems; on the other hand, by repairing and adjusting the image, the readability of the original video content is retained, and the visual consistency between the repaired area and the surrounding image is further ensured. The present invention combines a variety of optimization methods to improve the efficiency of subtitle blur processing and optimize the subtitle blur effect.

[0133] like Figure 3 FIG. 1 is a schematic diagram of the structure of a computer device of a preferred embodiment of the video subtitle fuzzy processing method of the present invention.

[0134] The computer device 1 may include a memory 12, a processor 13 and a bus, and may also include a computer program stored in the memory 12 and executable on the processor 13, such as a video subtitle blurring processing program.

[0135] Those skilled in the art will appreciate that the schematic diagram is merely an example of the computer device 1 and does not constitute a limitation on the computer device 1. The computer device 1 may be a bus-type structure or a star-type structure. The computer device 1 may also include more or less other hardware or software than shown in the diagram, or a different arrangement of components. For example, the computer device 1 may also include input and output devices, network access devices, etc.

[0136] It should be noted that the computer device 1 is only an example, and other existing or future electronic products that are suitable for the present invention should also be included in the protection scope of the present invention and included here by reference.

[0137] The memory 12 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the memory 12 may be an internal storage unit of the computer device 1, such as a mobile hard disk of the computer device 1. In other embodiments, the memory 12 may also be an external storage device of the computer device 1, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc. equipped on the computer device 1. Further, the memory 12 may also include both an internal storage unit of the computer device 1 and an external storage device. The memory 12 may not only be used to store application software and various types of data installed in the computer device 1, such as the code of a video subtitle blurring processing program, etc., but may also be used to temporarily store data that has been output or is to be output.

[0138] In some embodiments, the processor 13 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 13 is the control core (Control Unit) of the computer device 1, and uses various interfaces and lines to connect various components of the entire computer device 1, and executes various functions and processes data of the computer device 1 by running or executing programs or modules stored in the memory 12 (for example, executing a video subtitle fuzzy processing program, etc.), and calling data stored in the memory 12.

[0139] The processor 13 executes the operating system of the computer device 1 and various installed applications. The processor 13 executes the applications to implement the steps in the above-mentioned embodiments of the video subtitle fuzzy processing method, for example Figure 1 Steps shown.

[0140] Exemplarily, the computer program may be divided into one or more modules / units, and the one or more modules / units are stored in the memory 12 and executed by the processor 13 to complete the present invention. The one or more modules / units may be a series of computer-readable instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the computer device 1. For example, the computer program may be divided into an extraction unit 110, an acquisition unit 111, a frame selection unit 112, a grayscale conversion unit 113, a binarization processing unit 114, an expansion processing unit 115, a repair processing unit 116, an adjustment unit 117, a Gaussian blur processing unit 118, a replacement unit 119, a writing unit 120, and an overlay unit 121.

[0141] The above-mentioned integrated unit implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, and includes a number of instructions for enabling a computer device (which can be a personal computer, a computer device, or a network device, etc.) or a processor to execute the part of the video subtitle fuzzy processing method described in each embodiment of the present invention.

[0142] If the module / unit integrated in the computer device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware devices through a computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of each of the above-mentioned method embodiments can be implemented.

[0143] The computer program includes computer program code, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory, etc.

[0144] Furthermore, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.

[0145] The blockchain referred to in this invention is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the blockchain underlying platform, platform product service layer, and application service layer.

[0146] The bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 The bus is represented by only one straight line, but it does not mean that there is only one bus or one type of bus. The bus is configured to realize the connection and communication between the memory 12 and at least one processor 13, etc.

[0147] Although not shown, the computer device 1 may also include a power source (such as a battery) for supplying power to various components. Preferably, the power source may be logically connected to the at least one processor 13 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include any components such as one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, and power status indicators. The computer device 1 may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.

[0148] Furthermore, the computer device 1 may also include a network interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used to establish a communication connection between the computer device 1 and other computer devices.

[0149] Optionally, the computer device 1 may further include a user interface, which may be a display, an input unit (such as a keyboard), or a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch device. The display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the computer device 1 and to display a visual user interface.

[0150] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.

[0151] Figure 3 Only the computer device 1 having components 12-13 is shown, and it can be understood by those skilled in the art that Figure 3 The structure shown does not constitute a limitation on the computer device 1, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.

[0152] Combination Figure 1 , the memory 12 in the computer device 1 stores a plurality of instructions to implement a video subtitle fuzzy processing method, and the processor 13 can execute the plurality of instructions to implement:

[0153] An extraction unit, configured to extract each frame of the target video in response to a subtitle blurring instruction for the target video;

[0154] An acquisition unit, used for acquiring an image containing subtitles from each frame of the target video as each frame of the image to be processed;

[0155] A frame selection unit, used for selecting the subtitle area of ​​each frame of the image to be processed to obtain each area to be processed;

[0156] A grayscale conversion unit, used for performing grayscale conversion on each area to be processed to obtain a grayscale image corresponding to each area to be processed;

[0157] A binarization processing unit is used to perform binarization processing on the grayscale image corresponding to each area to be processed to obtain a light and dark mask corresponding to each area to be processed;

[0158] An expansion processing unit, used for performing expansion processing on the bright part of the light and dark mask corresponding to each area to be processed, so as to obtain a first image corresponding to each area to be processed;

[0159] A repair processing unit, used for performing repair processing on each first image to obtain a second image corresponding to each area to be processed;

[0160] An adjustment unit, used for comparing the grayscale image corresponding to each area to be processed with the black part of the light and dark mask corresponding to each area to be processed to obtain a comparison result, and adjusting each second image according to the comparison result to obtain a third image corresponding to each area to be processed;

[0161] A Gaussian blur processing unit, used for performing Gaussian blur processing on each third image to obtain a fourth image corresponding to each area to be processed;

[0162] A replacement unit, used for replacing each fourth image with each frame of the image to be processed, so as to obtain each frame of the target image corresponding to each frame of the image to be processed;

[0163] A writing unit, used for writing each frame of the target image into each frame of the extracted target video to obtain an intermediate video file;

[0164] The superimposing unit is used to extract the audio of the target video and superimpose the audio to the intermediate video file to obtain a video file after the subtitles are blurred.

[0165] Specifically, the specific implementation method of the processor 13 for the above instructions can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.

[0166] It should be noted that the data involved in this case were all obtained legally.

[0167] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.

[0168] The present invention can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present invention can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present invention can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0169] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0170] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.

[0171] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.

[0172] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.

[0173] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the present invention can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.

[0174] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.

Claims

1. A video subtitle fuzzy processing method, characterized in that: The video subtitle fuzzy processing method comprises: In response to a subtitle blurring instruction for a target video, extracting each frame of the target video; Acquire an image containing subtitles from each frame of the target video as each frame of the image to be processed; Select the subtitle area of ​​each frame of the image to be processed to obtain each area to be processed; Perform grayscale conversion on each area to be processed to obtain a grayscale image corresponding to each area to be processed; Binarization is performed on the grayscale image corresponding to each area to be processed to obtain a light and dark mask corresponding to each area to be processed, including: obtaining the color of the subtitles in each area to be processed; determining the binarization parameter corresponding to each area to be processed according to the color of the subtitles in each area to be processed; binarization is performed on each area to be processed according to the binarization parameter corresponding to each area to be processed to obtain a light and dark mask corresponding to each area to be processed; wherein the minimum value of the binarization parameter corresponding to the white subtitle is greater than the maximum value of the binarization parameter corresponding to the subtitles of other colors; Performing dilation processing on the bright part of the light and dark mask corresponding to each area to be processed to obtain a first image corresponding to each area to be processed; Performing restoration processing on each first image to obtain a second image corresponding to each area to be processed; Compare the grayscale image corresponding to each area to be processed with the black part of the light and dark mask corresponding to each area to be processed to obtain a comparison result, and adjust each second image according to the comparison result to obtain a third image corresponding to each area to be processed; wherein, adjusting each second image according to the comparison result to obtain the third image corresponding to each area to be processed comprises: obtaining the average brightness difference value and the average contrast difference value between the grayscale image corresponding to each area to be processed and the black part of the light and dark mask corresponding to each area to be processed from the comparison result; and adjusting the brightness and contrast of each second image to be the same as those of each corresponding grayscale image according to the average brightness difference value and the average contrast difference value; Performing Gaussian blur processing on each third image to obtain a fourth image corresponding to each area to be processed; Substituting each fourth image into each frame of the image to be processed, to obtain each frame of the target image corresponding to each frame of the image to be processed; Writing each frame of the target image into each frame of the extracted target video to obtain an intermediate video file; The audio of the target video is extracted, and the audio is superimposed on the intermediate video file to obtain a video file after the subtitles are blurred.

2. The video subtitle fuzzy processing method according to claim 1, characterized in that: The step of performing dilation processing on the bright part of the light and dark mask corresponding to each area to be processed to obtain the first image corresponding to each area to be processed comprises: Configure the ratio of vertical expansion to horizontal expansion as the expansion ratio; Calling the dilate function in the OpenCV library, dilating the bright part of the light and dark mask corresponding to each area to be processed based on the dilation ratio, to obtain a first image corresponding to each area to be processed; Wherein, the expansion ratio is 1.

5.

3. The video subtitle fuzzy processing method according to claim 1, characterized in that: The performing restoration processing on each first image to obtain a second image corresponding to each area to be processed comprises: Obtaining an average value of adjacent pixels of each first image; Each first image is filled with an average value of adjacent pixels of each first image to obtain each second image.

4. The video subtitle fuzzy processing method according to claim 1, characterized in that: The performing Gaussian blur processing on each third image to obtain a fourth image corresponding to each area to be processed comprises: Call cv2.GaussianBlur function to perform Gaussian blur processing on each third image to obtain each fourth image.

5. The video subtitle fuzzy processing method according to claim 1, characterized in that: After obtaining the video file after the subtitle blurring process, the method further includes: Obtain distribution requirements; The video file is sent to a designated terminal device according to the distribution requirement.

6. A video subtitle fuzzy processing device, characterized in that: The video subtitle fuzzy processing device comprises: An extraction unit, configured to extract each frame of the target video in response to a subtitle blurring instruction for the target video; An acquisition unit, used for acquiring an image containing subtitles from each frame of the target video as each frame of the image to be processed; A frame selection unit, used for selecting the subtitle area of ​​each frame of the image to be processed to obtain each area to be processed; A grayscale conversion unit, used for performing grayscale conversion on each area to be processed to obtain a grayscale image corresponding to each area to be processed; A binarization processing unit is used to perform binarization processing on the grayscale image corresponding to each area to be processed to obtain a light and dark mask corresponding to each area to be processed, including: obtaining the color of the subtitles in each area to be processed; determining the binarization parameter corresponding to each area to be processed according to the color of the subtitles in each area to be processed; performing binarization processing on each area to be processed according to the binarization parameter corresponding to each area to be processed to obtain a light and dark mask corresponding to each area to be processed; wherein the minimum value of the binarization parameter corresponding to the white subtitle is greater than the maximum value of the binarization parameter corresponding to the subtitles of other colors; An expansion processing unit, used for performing expansion processing on the bright part of the light and dark mask corresponding to each area to be processed, so as to obtain a first image corresponding to each area to be processed; A repair processing unit, used for performing repair processing on each first image to obtain a second image corresponding to each area to be processed; An adjustment unit, used for comparing the grayscale image corresponding to each area to be processed with the black part of the light and dark mask corresponding to each area to be processed to obtain a comparison result, and adjusting each second image according to the comparison result to obtain a third image corresponding to each area to be processed; wherein the adjusting each second image according to the comparison result to obtain the third image corresponding to each area to be processed comprises: obtaining an average brightness difference value and an average contrast difference value between the grayscale image corresponding to each area to be processed and the black part of the light and dark mask corresponding to each area to be processed from the comparison result; adjusting the brightness and contrast of each second image to be the same as those of each corresponding grayscale image according to the average brightness difference value and the average contrast difference value; A Gaussian blur processing unit, used for performing Gaussian blur processing on each third image to obtain a fourth image corresponding to each area to be processed; A replacement unit, used for replacing each fourth image with each frame of the image to be processed, so as to obtain each frame of the target image corresponding to each frame of the image to be processed; A writing unit, used for writing each frame of the target image into each frame of the extracted target video to obtain an intermediate video file; The superimposing unit is used to extract the audio of the target video and superimpose the audio to the intermediate video file to obtain a video file after the subtitles are blurred.

7. A computer device, characterized in that: The computer device comprises: a memory storing at least one instruction; and A processor executes the instructions stored in the memory to implement the video subtitle fuzzy processing method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one instruction, and the at least one instruction is executed by a processor in a computer device to implement the video subtitle fuzzy processing method according to any one of claims 1 to 5.