Video processing method and device based on histogram rectangular area, equipment and medium

By using a histogram rectangle area method, color height map and maximum rectangle area algorithm to detect monochrome blocks and edge-filling areas in the video, the problems of detection accuracy and computational complexity in the existing technology are solved, and efficient and accurate video processing effects are achieved.

CN120807362APending Publication Date: 2025-10-17PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510946223.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-09
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

Existing video processing methods have problems such as high misjudgment rate, high computational complexity, dependence on large amounts of labeled data and high computing resource requirements when detecting monochrome blocks and black-and-white padded areas. These problems are particularly difficult to meet in the fields of healthcare and financial technology where high accuracy and stability are required.

Method used

A method based on histogram rectangle area is adopted. By obtaining the color height map of the video image, the maximum rectangle area algorithm and monotone stack are used to calculate the monochrome edge filling area, and the area threshold is used for judgment and repair.

Benefits of technology

It achieves efficient and accurate detection and repair of monochrome blocks and edge-padding areas in videos, reduces computational complexity, reduces dependence on training data, improves robustness and real-time performance, and is suitable for multiple video processing scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120807362A_ABST
    Figure CN120807362A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing, can be applied to the business fields of medical health, financial science and technology and the like, and discloses a histogram rectangular area-based video processing method, which comprises the following steps of: preprocessing a to-be-processed target video to generate a target input image; counting the number of pixels of each row or each column of the target input image in a preset counting direction, and constructing a color height map of each row or each column according to the number of the pixels; calculating the maximum rectangular area of the color height map of each row or each column through a maximum rectangular area algorithm; the maximum rectangular area is compared with an area threshold value, and if the maximum rectangular area is larger than the area threshold value, it is judged that a monochromatic edge filling area exists in the row or the column; and obtaining area information of the monochromatic edge filling area, and performing repairing processing on the target input image according to the area information. According to the method, the color height map of the target image is constructed, the maximum rectangular area of the color height map is calculated, and the monochromatic block and the edge filling area in the video are efficiently detected.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing, and in particular to a video processing method and device based on histogram rectangular area, equipment and storage medium. BACKGROUND

[0002] In the field of video processing, identifying monochrome block regions and black / white edge regions is of great significance to improving video quality and optimizing viewing experience. For example, in a video quality evaluation system, automatically detecting invalid regions in a video can improve the accuracy of scoring; in an intelligent video editing tool, automatically cropping black or white edges can significantly improve the viewing experience of the video; in a video repair system, identifying and repairing invalid borders or backgrounds can help restore the integrity of the video; in a video monitoring system, detecting invalid regions in a monitoring picture can improve identification efficiency; and in the video encoding process, identifying monochrome block regions can reduce encoding redundancy, thereby improving compression efficiency.

[0003] However, the several methods commonly used in the industry have certain limitations. The detection method based on pixel threshold sets an RGB or grayscale threshold to determine whether it is a monochrome block or a black / white edge, but this method is sensitive to noise, has a high misjudgment rate, and is difficult to handle gradual or large-area similar color regions. Image segmentation methods based on edge detection, such as Canny, Sobel, etc., can identify edges, but have high computational complexity, poor real-time performance, and poor recognition performance for edge-inconspicuous edge regions. Image classification methods based on deep learning, such as using a convolutional neural network (CNN) model to identify black or white edges, perform well in some scenarios, but rely on a large amount of labeled data and have poor model generalization ability, making it difficult to adapt to different resolutions and frame sizes of video content. Therefore, how to develop an efficient, accurate, and highly generalized monochrome block region and black / white edge region identification method is still a problem to be solved in the field of video processing.

[0004] In the field of medical health, the identification accuracy of monochrome block regions and black / white edge regions in medical image processing (such as CT, MRI, or ultrasound images) is extremely high. Misjudgment can lead to misdiagnosis or missed diagnosis, which can have a serious impact on the health of patients. For example, the method based on pixel threshold is sensitive to noise, which may misjudge normal tissue as a lesion area or miss the real lesion area. In addition, the complexity of medical images (such as the gradual change characteristics of tissues) makes it difficult for edge detection-based methods to accurately distinguish between valid and invalid information, which may result in the loss of key details.

[0005] In the field of financial technology business, financial technology business involves a large amount of sensitive financial data, and video processing technology (such as identifying single-color block regions) can be used to monitor trading environments or customer behavior. However, these technologies may introduce data security risks, leading to customer privacy leaks. At the same time, deep learning methods rely on a large amount of labeled data, which may involve data compliance issues. Financial technology business has very high requirements for the stability and performance of the system, and complex video processing algorithms (such as deep learning-based models) may require a large amount of computing resources and storage space, which will increase operating costs, especially when deployed on a large scale. SUMMARY

[0006] The main purpose of the present application is to provide a video processing method, device, equipment and storage medium based on histogram rectangular area, aiming at solving the problem of insufficient single-color block and edge filling region detection method in existing video processing in the prior art.

[0007] To achieve the above-mentioned purpose, the present application provides a video processing method based on histogram rectangular area, comprising: acquiring a target video to be processed, pre-processing the target video to be processed, and generating a target input image; counting the number of pixels of each row or each column of the target input image in a preset statistical direction, and constructing a color height map of each row or each column according to the number of pixels; calculating the maximum rectangular area of the color height map of each row or each column by the maximum rectangular area algorithm; comparing the maximum rectangular area with an area threshold value, if the maximum rectangular area is greater than the area threshold value, it is determined that the row or the column has a single-color edge filling region; acquiring the region information of the single-color edge filling region, and performing repair processing on the target input image according to the region information.

[0008] Further, to achieve the above-mentioned purpose, the present application provides a video processing device based on histogram rectangular area, comprising: a target image module for acquiring a target video to be processed, pre-processing the target video to be processed, and generating a target input image; a color height map module for counting the number of pixels of each row or each column of the target input image in a preset statistical direction, and constructing a color height map of each row or each column according to the number of pixels; a maximum rectangular area module for calculating the maximum rectangular area of the color height map of each row or each column by the maximum rectangular area algorithm; a single-color edge-filling region module configured to compare the maximum rectangular area with an area threshold, and determine that the row or the column has a single-color edge-filling region if the maximum rectangular area is greater than the area threshold; a patching processing module configured to acquire region information of the single-color edge-filling region, and perform patching processing on the target input image according to the region information.

[0009] Further, to achieve the above object, the present application also provides a computer device, which comprises a memory, a processor, and a histogram-rectangular-area-based video processing program stored in the memory and executable on the processor, and the histogram-rectangular-area-based video processing program is used to implement the steps of the histogram-rectangular-area-based video processing method as described above when executed by the processor.

[0010] Further, to achieve the above object, the present application also provides a computer-readable storage medium, which stores a histogram-rectangular-area-based video processing program, and the histogram-rectangular-area-based video processing program is used to implement the steps of the histogram-rectangular-area-based video processing method as described above when executed by a processor.

[0011] Beneficial effects: The present application relates to the technical field of image processing, and can be applied to business system platforms such as communication, medical health, and financial technology. The present application discloses a histogram-rectangular-area-based video processing method, which comprises the following steps: acquiring a target video to be processed, pre-processing the target video to be processed to generate a target input image; counting the number of pixels of each row or each column of the target input image in a preset statistical direction, and constructing a color height map of each row or each column according to the number of pixels; calculating the maximum rectangular area of the color height map of each row or each column by using a maximum rectangular area algorithm; comparing the maximum rectangular area with an area threshold, and determining that the row or the column has a single-color edge-filling region if the maximum rectangular area is greater than the area threshold; and acquiring region information of the single-color edge-filling region, and performing patching processing on the target input image according to the region information. The present application converts a target image frame into a color height map, and uses a monotonic stack to implement a maximum rectangular area algorithm, so as to efficiently detect single-color blocks and edge-filling regions in an image, and has the advantages of high robustness, strong real-time performance, and no need for a large amount of training data. BRIEF DESCRIPTION OF DRAWINGS

[0012] The present application will be further described below with reference to the accompanying drawings and embodiments. In the drawings: Figure 1 FIG. 1 is a schematic diagram of an application environment of the histogram-rectangular-area-based video processing method according to an embodiment of the present application; Figure 2A flowchart of an embodiment of the histogram-rectangular-area-based video processing method of the present application; Figure 3 A functional module diagram of a preferred embodiment of the histogram-rectangular-area-based video processing device of the present application; Figure 4 A structural diagram of a computer device in an embodiment of the present application; Figure 5 Another structural diagram of a computer device in an embodiment of the present application. DETAILED DESCRIPTION

[0013] It should be understood that the specific embodiments described herein are merely illustrative of the present application and do not limit the present application.

[0014] The histogram-rectangular-area-based video processing method provided by the embodiments of the present application can be applied in an application environment such as Figure 1 , in which a user end communicates with a service end through a network. The service end can obtain a target video to be processed through the user end, pre-process the target video to be processed to generate a target input image, count the number of pixels of each row or each column of the target input image in a preset statistical direction, and construct a color height map of each row or each column according to the number of pixels. The service end calculates the maximum rectangular area of the color height map of each row or each column through a maximum rectangular area algorithm, compares the maximum rectangular area with an area threshold, and if the maximum rectangular area is greater than the area threshold, determines that there is a single-color edge-filling region in the row or the column. The service end obtains the region information of the single-color edge-filling region, and performs a repair processing on the target input image according to the region information. The present application converts a target image frame into a color height map, and uses a monotonic stack to implement a maximum rectangular area algorithm, so as to efficiently detect single-color blocks and edge-filling regions in an image, and has the advantages of high robustness, strong real-time performance, and no need for a large amount of training data. The user end can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices. The service end can be implemented by an independent server or a server cluster composed of multiple servers. The present application will be described in detail through specific embodiments.

[0015] Please refer to Figure 2 , Figure 2 A flowchart of an embodiment of the histogram-rectangular-area-based video processing method provided by the present application. It should be noted that although a logical order is shown in the flowchart, in some cases, the steps shown or described can be performed in an order different from that herein.

[0016] As shown in Figure 2 , the histogram-rectangular-area-based video processing method provided by the present application includes the following steps: S100, obtaining a target video to be processed, preprocessing the target video to be processed to generate a target input image; S200, counting the number of pixels of each row or each column of the target input image in a preset statistical direction, and constructing a color height map of each row or each column according to the number of pixels; S300, calculating the maximum rectangular area of the color height map of each row or each column by a maximum rectangular area algorithm; S400, comparing the maximum rectangular area with an area threshold value, if the maximum rectangular area is greater than the area threshold value, determining that the row or the column has a single-color edge filling region; S500, obtaining region information of the single-color edge filling region, and performing a repair processing on the target input image according to the region information.

[0017] In this embodiment, a method for efficiently detecting and processing single-color blocks and edge filling regions in a video is provided, which is suitable for various video processing scenarios such as video quality evaluation, intelligent editing and video repair.

[0018] First, obtain the video file or video stream that needs to be processed, which can come from local files, network streams or real-time video acquisition devices. Then, decode the video into single-frame images, and convert the compressed video data into processable image frames. In order to facilitate subsequent processing, convert the RGB image to other color spaces, such as HSV or YUV. The HSV color space separates the hue, saturation and brightness of the color, which is convenient for color clustering and analysis. Then, discretize the color space into a limited color set, such as reducing the color to 256 or less, to reduce the color variety, reduce the computational complexity and improve the robustness of the algorithm. Finally, generate the target input image for subsequent color height map construction and single-color block detection.

[0019] In the selection of detection direction, the horizontal direction (each row) or the vertical direction (each column) can be selected for statistics. Generally, the horizontal direction is used to detect the top and bottom edge filling regions, while the vertical direction is used to detect the left and right edge filling regions. Next, traverse each row or each column of the target input image, and count the number of consecutive same color pixels. Construct a color height map, create a two-dimensional matrix H[i][j], where H[i][j] represents the number of consecutive same color pixels from the (i)th row and (j)th column. For example, if the color is consistent from the 0th row to the 5th row in a column, then (H[0][j]=1, H[1][j]=2, ……, H[5][j]=6).

[0020] To calculate the maximum rectangular area, a monotonically increasing stack is used to assist in the calculation. Initialize the stack to be empty and initialize the maximum area (max_area) to be 0. Traverse the color height map H[i][j] from left to right (or from top to bottom), compare the current height (h) with the height of the top element of the stack. If the current height (h) is greater than or equal to the height of the top element, push the current index into the stack. If the current height (h) is less than the height of the top element, pop the top element of the stack and calculate the area of the rectangle with the height as the height. Each time the top element of the stack is popped, the height (h) and width (width) of the column corresponding to the height are calculated, thus obtaining the area of the rectangle (area = h × width). Compare the calculated area with the current maximum area (max_area) and update the maximum area.

[0021] According to the width (W) and height (H) of the image, set an area threshold, for example, 10% of the area of the image, that is, (0.1 × W × H). Compare the calculated maximum rectangular area (max_area) with the set threshold. If (max_area) is greater than the threshold, it is considered that there is a large area of monochrome block or edge filling region in the row or column; if (max_area) is less than the threshold, it is considered that there is no large enough monochrome block or edge filling region in the row or column.

[0022] Finally, obtain the region information, including the region coordinates (record the top-left and bottom-right coordinates of the monochrome edge filling region), the region area (record the area of the monochrome edge filling region), and the color information (record the color of the monochrome edge filling region, such as black or white). According to the coordinates of the detected monochrome edge filling region, crop these regions to improve the viewing experience of the video. If the detected monochrome block is located in the middle region of the image, it can be replaced with other background color or other repair processing. Output the repaired image for use by subsequent modules (such as video editing, repair, encoding optimization, etc.).

[0023] Through the above steps, monochrome blocks and edge filling regions in the video can be efficiently detected and repaired according to the detection results. This method combines geometric features (rectangular area) and statistical features (area threshold) in image processing, and can efficiently and accurately detect monochrome blocks and edge filling regions in the video, suitable for video quality evaluation, intelligent editing, video repair, etc. in multiple fields.

[0024] For example, in the fintech sector, video processing technology has a wide range of applications and is of great significance. For example, in video conferencing and online customer service scenarios, single-color blocks or padded areas in the background can be distracting and affect the visual effect. By detecting and patching these areas, a more natural background blur can be achieved, thereby enhancing the professionalism of the video and significantly improving the user experience. Furthermore, in real-time video streams, the rapid detection and patching of single-color block areas can effectively reduce encoding redundancy, thereby reducing bandwidth requirements and improving video transmission efficiency. This is particularly important for remote collaboration and customer service in the fintech sector.

[0025] Video processing technology also plays a key role in healthcare. In telemedicine consultations, video quality directly impacts the effectiveness of doctors' diagnoses of patients. By detecting and repairing monochrome blocks or patched areas in the video, video clarity and professionalism can be significantly improved, ensuring doctors can more accurately observe the patient's condition. In real-time video streams, rapidly detecting and repairing monochrome block areas in the background not only reduces encoding redundancy and bandwidth requirements but also ensures smooth telemedicine consultations, which is crucial for improving the accessibility and efficiency of medical services. Furthermore, in scenarios such as surgical assistance and medical image analysis, video processing technology can improve the quality and analysis efficiency of medical images, providing support for precision medicine.

[0026] In one embodiment, the step S100 includes: S101, obtaining the target video to be processed; S102, decoding the target video to be processed to extract a target image frame; S103 : Perform color space conversion and color quantization processing on the target image frame to generate a target input image.

[0027] In this embodiment, a video is a dynamic media composed of a series of consecutive still images (frames). Each frame is an independent image, and when these frames are played quickly with a certain time interval (frame rate), the human eye will see continuous dynamic pictures. The frame rate is usually expressed in "frames per second" (FPS), and common frame rates include 24 FPS (film), 25 FPS (PAL television system), 30 FPS (NTSC television system), and 60 FPS (high-definition video), etc. The target video to be processed can come from various video sources, depending on the application scenario. The video can be stored in a hard disk, a USB flash disk, an optical disk, etc. storage device, usually saved in MP4, AVI, MOV, etc. format; it can also be obtained in the form of a video stream through a network server, including real-time live streaming or pre-recorded online video on demand, and the video stream is usually transmitted through HTTP, RTSP, etc. protocol; in addition, it can also be captured in real time through a camera, which can be a built-in camera (such as a notebook computer camera), an external camera (such as a USB camera), or a professional monitoring camera; or from a DV camera, a surveillance video recorder, etc. video recording device; it can also be captured by screen recording software (such as OBS, Bandicam, etc.) to capture the dynamic pictures of the computer screen, which is often used to record games, online teaching, etc.

[0028] The video file or video stream is usually stored in a compressed format, and common compression formats include H.264, H.265, MPEG-4, etc. The role of the decoder is to decode the compressed video data into the original frame data. The decoder restores the encoded data stream into a series of frames according to the specification of the video encoding format, and the decoding process may involve complex algorithms such as motion compensation, entropy decoding, etc. The decoded video data is usually stored in the memory in units of frames. Through a programming interface (such as OpenCV, FFmpeg, etc.), frames can be extracted from the decoded video data one by one. The extracted frames can be stored as image files (such as PNG, JPEG), or directly processed in memory. These extracted frames can be used for various video processing tasks, such as single color block and edge area detection, target recognition, motion detection, etc.

[0029] The target image frame is a still image in a video, usually represented in the RGB (Red, Green, Blue) color space. RGB color space is an additive color model that represents the color of each pixel in an image through the combination of red, green, and blue color channels, and the value of each channel is usually between 0 and 255, so the color of a pixel can be represented by a three-tuple (R, G, B).

[0030] Color space conversion is the process of transforming an image from one color space to another in order to better handle the color information in the image. Two commonly used color spaces are HSV and YUV. In the HSV color space, H (hue) represents the type of color, with a value range typically from 0 to 360 degrees; S (saturation) represents the purity of the color, with a value range typically from 0 to 1, where a saturation of 0 is a gray color, and a higher saturation results in a more vibrant color; V (value) represents the lightness or darkness of the color, with a value range typically from 0 to 1, where a value of 0 is black, and a higher value results in a lighter color. The HSV color space separates the hue, saturation, and value of a color, making it easier to cluster and analyze colors. In the YUV color space, Y (luma) represents the brightness information of the image, which is related to the human eye's perception of brightness; U and V (chroma) represent the color information, with U and V channels representing the blue and red color differences, respectively. The YUV color space separates the brightness information from the color information, making it easier to compress and process images, such as in video encoding, where the luma information is typically encoded at a higher resolution, while the chroma information is encoded at a lower resolution, reducing encoding redundancy.

[0031] Color quantization is the process of discretizing a color space into a finite set of colors. For example, the colors in the RGB color space can be discretized from 256 x 256 x 256 (i.e., 16.77 million colors) to 256 colors or fewer. Common color quantization methods include uniform quantization and cluster-based color quantization. Uniform quantization divides the color space uniformly into regions, with each region represented by a representative color. For example, each channel of the RGB color space can be divided into 16 intervals, resulting in a total of 16 x 16 x 16 = 4096 colors. Cluster-based color quantization uses clustering algorithms (such as K-Means) to cluster the colors in the color space into color clusters, with each cluster represented by a central color. This method can quantize the colors based on the actual color distribution of the image, better preserving the color characteristics of the image. Color quantization can reduce the number of colors, thereby reducing the complexity of image processing. For example, in detecting single-color blocks, quantization can group similar colors into a single category, improving the efficiency and accuracy of detection.

[0032] Through color space conversion and color quantization, color information can be simplified to facilitate subsequent clustering and analysis of colors. For example, in the HSV color space, different color types can be distinguished by the hue H, making it easier to identify single-color block regions. Reducing the number of colors can reduce the complexity of image processing and improve the efficiency of algorithms. For example, when calculating the maximum rectangular area, processing a discretized color space is more efficient than processing a continuous color space. In addition, through color space conversion and quantization, the impact of noise and lighting changes on color detection can be reduced, improving the robustness of the algorithm.

[0033] In the financial technology business field, for example, customer identity verification is a key step to ensure transaction security. Through video technology, remote identity verification can be achieved, thereby improving user experience while enhancing security. Specifically, using video frame extraction and processing technology, the uploaded video of the customer is decoded and key frames are extracted. Subsequently, through color space conversion and color quantization processing, target input images are generated, which will be used for face recognition and liveness detection. With efficient video processing technology, customer identity can be quickly and accurately verified, reducing the workload of manual review, while further improving security.

[0034] In the medical health business field, video processing technology also plays an important role and is widely used in remote medical treatment, medical image analysis, and patient monitoring. Remote medical services allow patients to conduct remote diagnosis with doctors through video calls, which is particularly important in remote areas or emergency situations. In order to ensure the accuracy of diagnosis, real-time decoding and processing of video streams are required to extract high-quality image frames. Through color space conversion and quantization, the display effect of the video can be optimized to ensure that doctors can clearly see the patient's symptoms. This process not only improves the accuracy of remote medical diagnosis and reduces the misdiagnosis rate, but also improves the accessibility and efficiency of medical services.

[0035] In one embodiment, the step S200 comprises: S201, creating an initial color height map; S202, traversing each row or each column of the target input image; S203, performing pixel color statistics on each row or each column of pixels; S204, in the initial color height map, if the pixel color of the current row or column is the same as that of the previous row or column, the pixel color quantity value of the current row or column is one more than that of the previous row or column; S205, in the initial color height map, if the pixel color of the current row or column is not the same as that of the previous row or column, the pixel color quantity value of the current row or column is one; S206, constructing a color height map for each row or column according to the pixel color quantity value of each row or column.

[0036] In this embodiment, the color height map is a tool for quantitatively representing the color distribution and continuity information in an image, and the main purpose is to efficiently detect whether there is a large area of monochrome block or edge filling area in the image. The color height map is a two-dimensional matrix H[i][j], where (i) represents the row index and (j) represents the column index. Each element H[i][j] of the matrix records the number of pixels of the same color in each column (or each row) of the image.

[0037] To construct the color height map, first, a two-dimensional matrix H[i][j] with the same size as the input image needs to be created, and all values are initialized to 0, indicating that no continuous same color pixels have been counted. Next, the number of continuous same color pixels is counted column by column (or row by row). Taking column-by-column counting as an example, traverse each column (j) of the image, and check the pixel color row by row from top to bottom. If the color of the current pixel is the same as that of the pixel in the last row, the value H[i][j] at this position in the color height map is the value of the last row plus 1, that is, (H[i][j]=H[i-1][j]+1); if the color of the current pixel is different from that of the pixel in the last row, the value H[i][j] at this position in the color height map is 1. Similarly, when counting row by row, traverse each row (i) of the image, and check the pixel color column by column from left to right. If the color of the current pixel is the same as that of the pixel in the left column, the value H[i][j] at this position in the color height map is the value of the left column plus 1, that is, (H[i][j]=H[i][j-1]+1); if the color of the current pixel is different from that of the pixel in the left column, the value H[i][j] at this position in the color height map is 1.

[0038] Specifically, assume that there is an image after color quantization, and the color is represented by a simple number (for example, 0 represents black and 1 represents white). The pixel color distribution of a column is as follows:

[0039] According to the above rules, the process of constructing the color height map is as follows: Row 0, color 0, no last row to compare, so (H[0][j]=1); Row 1, color 0, same as row 0, so (H[1][j]=H[0][j]+1=2); Row 2, color 0, same as row 1, so (H[2][j]=H[1][j]+1=3); Line 3, color is 1, different from Line 2, so (H[3][j] = 1); Line 4, color is 1, same as Line 3, so (H[4][j] = H[3][j] + 1 = 2); Line 5, color is 0, different from Line 4, so (H[5][j] = 1).

[0040] Finally, the color height map H[i][j] for this column is:

[0041] The main role of the color height map is to quantitatively represent the color distribution and continuity information in the image, making it easier for subsequent algorithms (such as the maximum rectangular area algorithm) to process. Through the color height map, it can efficiently detect whether there is a large area of single color block or edge filling area in the image. The process of constructing the color height map is to count the number of consecutive pixels of the same color in each column (or each row), which quantitatively presents the color distribution and continuity information in the image, providing necessary input data for the subsequent maximum rectangular area algorithm.

[0042] In video processing, vertical direction statistics and horizontal direction statistics each have their unique advantages and applicable scenarios, and the specific choice depends on the detection target. Vertical direction statistics are particularly suitable for detecting black or white edges at the top, bottom, left or right of the image. These areas are usually common edge filling positions in videos, so through vertical direction column-by-column statistics, single color blocks in these edge areas can be efficiently detected. In addition, vertical direction statistics can also effectively detect large-area single color blocks. For example, when there is a large-area single color background in the video, vertical direction statistics can clearly identify the continuity of these areas, helping to distinguish between background and foreground content. Although vertical direction statistics are more efficient in detecting edge areas, horizontal direction statistics are also important in some cases. If it is necessary to detect horizontal direction single color blocks or edge filling areas, such as horizontal direction single color strips that may exist in the middle part of the image, it is necessary to perform horizontal direction statistics on each row. This kind of statistics can help identify color continuity and area size in the horizontal direction, providing data support for subsequent analysis.

[0043] For example, in the field of financial technology, the application of image processing technology can significantly improve the efficiency and accuracy of data processing. Banks and financial institutions often need to process a large number of paper documents and scanned images, such as transaction records and financial statements. By constructing a color height map, important areas in the image can be efficiently detected, such as tables, signatures, and other key information. This method not only helps to automatically identify and extract this information, but also reduces errors caused by manual operations, improving overall data processing efficiency. In addition, image processing technology can also be used for visual analysis of financial transactions. By analyzing the visual images of transaction data, abnormal areas or patterns can be detected, helping financial institutions to timely detect potential fraud or market fluctuations, enhancing risk prevention and control capabilities.

[0044] In the field of medical health, image processing technology also plays an important role in medical image analysis. For example, when analyzing X-ray, CT scan or MRI images, constructing a color height map can be used to more accurately identify lesion areas, tissue structures or organ contours. By detecting single color blocks and edge filling areas in the image, different tissue types can be quickly located and distinguished, providing doctors with clearer diagnostic evidence. In addition, this technology can also be used for automatic segmentation and classification of medical images. By analyzing the color distribution and continuity in the image, the area of interest, such as a tumor or diseased tissue, can be automatically segmented, improving the accuracy and efficiency of diagnosis and providing strong support for clinical decision-making.

[0045] In one embodiment, the step S300 comprises: S3011, creating a monotonically increasing stack and initializing the monotonically increasing stack to empty, and initializing the maximum area to zero; S3012, traversing the color height map of the row or the column according to the pre-designed calculation direction, comparing the height of the color height map of the row or the column with the height of the top element; S3013, when the height of the color height map is greater than or equal to the height of the top element, the row or column is pressed into the monotonically increasing stack; S3014, when the height of the color height map is less than the height of the top element, the top element is popped out; S3015, obtaining the height of the popped top element, and calculating the maximum rectangular area according to the height of the top element and the row or the column; S3016, comparing the maximum rectangular area with the maximum area, if the maximum rectangular area is greater than the maximum area, replacing the maximum rectangular area with a new maximum area.

[0046] In this embodiment, to calculate the maximum rectangular area for each row, a monotonically increasing stack is used to efficiently process the data in the color height map. The characteristic of a monotonically increasing stack is that the elements in the stack always maintain a monotonically increasing order, which enables the algorithm to quickly handle changes in the height of the pillars.

[0047] First, a monotonically increasing stack is initialized to store the index of the column currently being processed. The stack is initially empty to ensure that there are no initial elements. Also, the maximum area max_area is initialized to 0 to record the maximum rectangular area of ​​the current row.

[0048] Next, we traverse each column (i.e., each "bar" in the histogram) from left to right. For each column, we obtain the current height ( h = H[i][j]) and compare it with the height of the top element on the stack. If the current height ( h ) is greater than or equal to the height of the top element on the stack, we push the current column index ( j ) onto the stack. If the current height ( h ) is less than the height of the top element on the stack, we pop the top element off the stack and calculate the area of ​​the rectangle with that height as the top element.

[0049] The specific steps are as follows: Pop the top element of the stack and get its index (top_index). Get the height (height = H[i][top_index]). Determine the left boundary, which is the index of the current top element (if the stack is empty, the left boundary is -1). The right boundary is the current index (j). The rectangle width (width) is right -left + 1. The rectangle area (area) is height × width. Compare the calculated area with the current maximum area (max_area) and update the maximum area.

[0050] By calculating the maximum rectangular area in the color height map row by row using the monotone stack algorithm, we can efficiently detect whether there are large monochromatic blocks or padded areas in each row. This method leverages the properties of the monotone stack to ensure an O(n) time complexity, making it suitable for real-time processing.

[0051] For example, in the financial technology industry, the application of the maximum rectangle area algorithm can significantly improve the security and stability of monitoring systems and trading places. For example, the monitoring system of a financial institution needs to detect abnormal behavior or illegal intrusion in real time. Through this algorithm, single-color blocks or edge-complementing regions in the monitoring video can be quickly identified to determine whether there is abnormal occlusion or interference. Once an abnormal region is detected, the system can immediately trigger an alarm and notify security personnel, improving the reliability and security of the monitoring system. In addition, in financial trading places such as stock trading halls or bank business outlets, by detecting single-color block regions in the video, possible equipment failures or network problems can be quickly identified for timely maintenance and repair, ensuring the stable operation of the trading system.

[0052] In the medical health field, the maximum rectangle area algorithm also has important application value. In telemedicine, doctors need to view the real-time status of patients through video consultation systems. Through this algorithm, single-color blocks or edge-complementing regions in the video can be detected to ensure the integrity and clarity of the video signal. If a large area of single-color blocks or edge-complementing regions is detected, it may indicate that the video signal has interference or transmission problems, and the system can automatically prompt doctors or technicians to check and repair. In addition, this technology can also be used for pre-processing of medical images. In medical imaging such as X-ray, CT, and MRI, there may be invalid background regions or noise in the image. By detecting these single-color block regions, the image can be automatically cropped or repaired to improve the diagnostic value of the image. For example, in a CT scan image, the detected single-color block region may be a shadow or artifact of the scanning device, which can be removed by the algorithm to allow doctors to more clearly observe the lesion site.

[0053] In one embodiment, the step S300 further comprises: S3021, after traversing all the color height maps of the rows or columns, checking whether the monotonic increasing stack is empty; S3022, if the monotonic increasing stack is not empty, sequentially popping the remaining top elements in the monotonic increasing stack; S3023, calculating the area of the rectangle according to the top element, comparing the area of the rectangle with the maximum area, and if the area of the rectangle is greater than the maximum area, replacing the maximum area with the new area of the rectangle.

[0054] In this embodiment, when calculating the maximum rectangle area of each row (or each column) of the color height map using the monotonic stack algorithm, special processing is required for the remaining elements in the monotonic stack after traversal. These elements correspond to rectangular regions that may span the entire right boundary of the histogram, so their areas need to be calculated separately.

[0055] After traversing all the columns, first check if the monotonic stack is empty. If the stack is not empty, it means there are still unprocessed columns. The heights of these columns are monotonically increasing, and no smaller height has been encountered during the traversal to trigger a pop operation. Therefore, these remaining elements need to be popped from the stack one by one, and the corresponding rectangular area of each element is calculated.

[0056] For each popped element, the specific steps to calculate its corresponding rectangular area are as follows: first, pop the top element of the stack to get the index of the top element (top_index). Then get the height of the column, height (height) = (H[i][top_index]). Next, determine the left boundary. If the stack is empty, the left boundary (left) is -1; if the stack is not empty, the left boundary (left) is the index of the current top element of the stack. The right boundary (right) is the width of the histogram (W) (i.e., the total number of columns). The width (width) is calculated as (right-left-1). Finally, the area (area) is calculated as (height×width), and the calculated area is compared with the current maximum area (max_area) to update the maximum area.

[0057] Specifically, assume that the color height map H[i][j] of a certain row is: (H[i] = [2, 1, 5, 6, 2, 3]). After traversing all the columns, the state of the stack may be: (stack = [1, 4]). The process of processing the remaining elements in the stack is as follows: first, pop the index 4, (top_index = 4), (height = H[i][4] = 2), left boundary (left = 1) (index of the current top element of the stack), right boundary (right = 6) (width of the histogram), width (width = 6-1-1 = 4), area (area = 2×4 = 8). Then update (max_area = max(max_area, 8)). Finally, the maximum rectangular area of this row is 8.

[0058] Processing the remaining elements in the stack is an important part of the maximum rectangular area algorithm. By popping the remaining elements in the stack and calculating their corresponding rectangular area, it can be ensured that all possible rectangular regions are considered. This step ensures the completeness and accuracy of the algorithm, which can correctly calculate the maximum rectangular area of continuous same color in each row (or each column).

[0059] For example, in the field of financial technology, image recognition and data extraction techniques play a crucial role, especially when dealing with financial documents such as checks, invoices, contracts, and more. By detecting monochrome blocks and edge-filling regions in the document, key information can be quickly located and extracted, significantly improving the efficiency and accuracy of automated processing. Take the example of check image recognition, which is an important part of financial technology. By detecting monochrome blocks and edge-filling regions on the check, the border and key information area (such as amount, date, signature, etc.) of the check can be quickly located. This not only helps to automatically extract check information, but also reduces manual intervention, further improving processing speed and accuracy.

[0060] In the field of medical health, this technology also has important application value, especially in medical image processing and data analysis. When dealing with X-ray, CT, MRI and other medical images, by detecting monochrome blocks and edge-filling regions in the image, key information can be quickly located and extracted, improving the efficiency and accuracy of diagnosis. For example, when processing X-ray, CT or MRI images, this technology can be used to identify monochrome blocks and edge-filling regions, and then quickly locate the lesion area or the boundary of normal tissue. This is very helpful for automatically segmenting and labeling medical images, which can significantly improve the efficiency of doctors' diagnosis and provide stronger support for clinical decision-making.

[0061] In one embodiment, the step S400 comprises: S4011, setting the area threshold according to the target input image; S4012, comparing the maximum rectangular area with the area threshold; S4013, when the maximum rectangular area is less than or equal to the area threshold, it is determined that the row or the column does not exist monochrome edge-filling region; S4014, when the maximum rectangular area is greater than the area threshold, it is determined that the row or the column exists monochrome edge-filling region.

[0062] In this embodiment, the maximum rectangular area in the color height map of each row (or each column) is calculated by the monotone stack algorithm to detect whether there is a large area of monochrome blocks or edge-filling regions in the image. This rectangular area represents the maximum area of continuous same color in the row (or column). In order to determine whether a rectangular region is "large" enough, a threshold needs to be set. Usually, this threshold is a percentage of the total area of the image.

[0063] Specifically, assuming the width of the image is W and the height is H, the total area of the image is WH. For example, set the threshold to 10% of the image area, i.e., 0.1 x W x H. For each row (or each column), if the maximum rectangular area max_area calculated is greater than the set threshold, it is considered that there is a large area of single-color block or edge filling area in the row (or column); if max_area is less than or equal to the set threshold, it is considered that there is no large enough single-color block or edge filling area in the row (or column).

[0064] Specifically, assuming the width of the image is W = 100 and the height is H = 100, the total area of the image is 100 x 100 = 10000. Set the threshold to 10% of the image area, i.e., 0.1 x 10000 = 1000. Assuming that the maximum rectangular area calculated by the color height map of a certain row is 1200, then max_area = 1200, and max_area > 1000 (threshold), so there is a large area of single-color block or edge filling area in the row. If the maximum rectangular area calculated by the color height map of another row is 800, then max_area = 800, and max_area < 1000 (threshold), so there is no large enough single-color block or edge filling area in the row.

[0065] By setting an area threshold to determine whether there is a large area of single-color block or edge filling area, false positives caused by noise or small area color blocks can be effectively avoided. The threshold can be adjusted according to specific application scenarios, for example, different thresholds can be set for images of different resolutions. The process of calculating the maximum rectangular area and threshold judgment has low computational complexity and is suitable for real-time processing. By calculating the maximum rectangular area in the color height map of each row (or each column) and comparing it with the set threshold, it is determined whether there is a large area of single-color block or edge filling area. This method combines the geometric features (rectangular area) and statistical features (area threshold) in image processing, and can efficiently and accurately detect single-color blocks and edge filling areas in videos.

[0066] For example, in the financial technology business, the application scenarios of video processing technology are diverse, including remote identity verification, online customer service support, and financial transaction monitoring. In the process of remote account opening or identity verification, users usually need to upload identity documents or perform face recognition through video. However, single-color edge filling areas (such as black or white edges) in the video may negatively affect the accuracy of image recognition. By detecting and removing these edge filling areas, it can ensure that the uploaded document images are clear and complete, thereby significantly improving the success rate and security of identity verification. This method not only improves user experience, but also enhances the overall efficiency of the system.

[0067] In the field of medical health, video processing technology also plays an important role and is widely used in remote medical treatment, surgical assistance, medical image analysis and other scenarios. Remote medical treatment platform highly depends on high-quality video calls to realize remote consultation between doctors and patients. The single-color edge filling area in the video may interfere with the observation and diagnosis of the patient's symptoms by the doctor. By automatically detecting and removing these edge filling areas, it can ensure that the medical information in the video is clear and complete, thereby improving the quality of remote medical services and further improving the quality of medical images and the accuracy of diagnosis.

[0068] In one embodiment, the step S400 further comprises: S4021, selecting a plurality of continuous rows or columns of regions according to a preset rule; S4022, obtaining the maximum rectangular area of each row or each column in the plurality of continuous rows or columns of regions, and the corresponding color information; S4023, comparing the maximum rectangular area of each row or each column with the area threshold; S4024, if the maximum rectangular area of each row or each column in the plurality of continuous rows or columns of regions is greater than the area threshold, and the color information of the plurality of continuous rows or columns of regions is consistent, it is determined that the plurality of continuous rows or columns of regions exist single-color edge filling area.

[0069] In this embodiment, the introduction of multi-row consistency judgment aims to improve the accuracy and robustness of detecting large-area single-color blocks or edge filling areas. Relying solely on the maximum rectangular area of a single row may result in false positives due to noise or local color changes. Therefore, by analyzing the maximum rectangular area and color information of a plurality of continuous rows, it can more comprehensively evaluate whether there is a true single-color block or edge filling area in the image.

[0070] First, a plurality of continuous rows of regions are selected according to a preset rule, for example, the top, bottom or middle region of the image can be selected. For example, the top 5 rows, bottom 5 rows or middle 5 rows of the image can be selected. For each row, the maximum rectangular area is calculated using the maximum rectangular area algorithm, and the maximum rectangular area and the corresponding color information (such as black or white) of each row are recorded. In this way, the relevant data of a plurality of continuous rows can be collected.

[0071] Next, consistency judgment is performed on these rows. If the maximum rectangular area of a plurality of continuous rows exceeds a set threshold (for example, 10% of the image area), it is initially considered that these rows have a large-area single-color block or edge filling area. At the same time, it is checked whether the colors of these rows are consistent (for example, all black or all white). If the colors are consistent, it is further confirmed that these rows belong to the same type of single-color block or edge filling area. If the colors of these rows are consistent and the maximum rectangular area exceeds the threshold, it can be determined as black or white edge.

[0072] However, the location factor of the rectangular region also needs to be considered. If the maximum rectangular area appears in the middle region of the image (rather than the edge region), it is more likely to be a single-color block background rather than a border region. In this case, even if the maximum rectangular area exceeds the threshold, it should be considered as a background region rather than a border region due to its location in the middle of the image.

[0073] By multi-line consistency judgment, combining the maximum rectangular area and color information of consecutive multiple lines, it can more accurately detect whether there is a large area of single-color block or border region in the image. This method not only considers the area size, but also combines color consistency and region location and other factors, thereby significantly improving the accuracy and robustness of detection.

[0074] For example, in the financial technology (FinTech) business, video processing technology plays an important role, especially in remote onboarding and online identity verification scenarios. Users often need to upload photos or videos of identity documents in these scenarios, and video processing technology can optimize image quality by detecting single-color blocks and border regions in videos. For example, when users take photos of identity documents, they often place the documents on a single-color background. By detecting the single-color background region, the system can automatically crop the background and extract a clear image of the document. In addition, if there are black or white borders in the video, these regions may interfere with the quality of the document image. By detecting and removing these border regions, the usability of the document image can be significantly improved, thereby improving the accuracy and efficiency of identity verification.

[0075] In the medical health business, video processing technology also has wide applications, especially in remote medical care, surgical assistance, and medical image analysis. By detecting single-color blocks and border regions in videos, the quality and diagnostic efficiency of medical images can be significantly improved. In the surgical process, video processing technology can assist surgeons in surgical operations. For example, by detecting and removing single-color blocks or border regions in surgical videos, background interference can be reduced, allowing surgeons to focus more on the surgical area. In addition, real-time analysis of single-color blocks and border regions in surgical videos can provide real-time surgical assistance information to help surgeons perform surgical operations more accurately. The application of this technology not only improves the safety and efficiency of surgery, but also provides higher quality visual support for remote medical care and medical image analysis.

[0076] In an embodiment, a histogram rectangular area-based video processing device is provided, which corresponds one-to-one with the histogram rectangular area-based video processing method in the above-mentioned embodiments. Referring to Figure 3 , Figure 3Fig. 1 is a schematic diagram of a function module of a preferred embodiment of the histogram-based rectangular area video processing device of the present application. The function modules include a target image module 10, a color height map module 20, a maximum rectangular area module 30, a single-color edge filling region module 40, and a patch processing module 50. The function modules are described in detail as follows: The target image module 10 is configured to acquire a target video to be processed, pre-process the target video to be processed, and generate a target input image. The color height map module 20 is configured to count the number of pixels in each row or each column of the target input image in a preset statistical direction, and construct a color height map for each row or each column based on the number of pixels. The maximum rectangular area module 30 is configured to calculate the maximum rectangular area of the color height map for each row or each column by using a maximum rectangular area algorithm. The single-color edge filling region module 40 is configured to compare the maximum rectangular area with an area threshold value, and determine that there is a single-color edge filling region in the row or the column if the maximum rectangular area is greater than the area threshold value. The patch processing module 50 is configured to acquire region information of the single-color edge filling region, and perform patch processing on the target input image based on the region information.

[0077] In one embodiment, the target image module 10 includes: A target video unit configured to acquire the target video to be processed. A target image frame unit configured to decode and process the target video to be processed, and extract a target image frame. A target input image unit configured to perform color space conversion and color quantization on the target image frame, and generate a target input image.

[0078] In one embodiment, the color height map module 20 includes: An initial height map unit configured to create an initial color height map. A target image traversal unit configured to traverse each row or each column of the target input image. A target input image unit configured to count the number of pixels in each row or each column. A color same unit configured to, in the initial color height map, if the pixel color of a current row or a current column is the same as the pixel color of a previous row or a previous column, then the number of pixel colors of the current row or the current column is one more than the number of pixel colors of the previous row or the previous column. A color different unit configured to, in the initial color height map, if the pixel color of a current row or a current column is different from the pixel color of a previous row or a previous column, then the number of pixel colors of the current row or the current column is one. A color height map unit is configured to construct a color height map for each row or each column according to the pixel color quantity values of each row or each column.

[0079] In one embodiment, the maximum rectangular area module 30 comprises: A monotonically increasing stack unit is configured to create a monotonically increasing stack and initialize the monotonically increasing stack as empty and initialize the maximum area as zero; A height comparison unit is configured to traverse the color height map of the row or the column according to a pre-designed calculation direction, compare the height of the color height map of the row or the column with the height of the top element of the stack; A push stack unit is configured to push the row or the column into the monotonically increasing stack when the height of the color height map is greater than or equal to the height of the top element of the stack; A pop stack unit is configured to pop the top element of the stack when the height of the color height map is less than the height of the top element of the stack; A maximum rectangular area unit is configured to obtain the height of the popped top element of the stack, calculate the maximum rectangular area according to the height of the top element of the stack and the row or the column; An area updating unit is configured to compare the maximum rectangular area with the maximum area, and replace the maximum rectangular area with a new maximum area if the maximum rectangular area is greater than the maximum area.

[0080] In one embodiment, the maximum rectangular area module 30 further comprises: A check stack unit is configured to check whether the monotonically increasing stack is empty after traversing the color height map of all the rows or all the columns; A pop remaining stack unit is configured to pop the remaining top elements of the monotonically increasing stack in sequence if the monotonically increasing stack is not empty; An area calculation unit is configured to calculate a rectangular area according to the top element of the stack, compare the rectangular area with the maximum area, and replace the rectangular area with a new maximum area if the rectangular area is greater than the maximum area.

[0081] In one embodiment, the single-color edge filling region module 40 comprises: An area threshold unit is configured to set the area threshold according to a target input image; An area comparison unit is configured to compare the maximum rectangular area with the area threshold; A non-existing single-color edge filling unit is configured to determine that there is no single-color edge filling region in the row or the column if the maximum rectangular area is less than or equal to the area threshold; An existing single-color edge filling unit is configured to determine that there is a single-color edge filling region in the row or the column if the maximum rectangular area is greater than the area threshold.

[0082] In one embodiment, the single-color edge-filling region module 40 further comprises: a continuous row or column unit configured to select a continuous multi-row or multi-column region according to a preset rule; an area and information acquisition unit configured to acquire a maximum rectangular area of each row or column in the continuous multi-row or multi-column region and corresponding color information; an area comparison unit configured to compare the maximum rectangular area of each row or column with the area threshold value; a single-color edge-filling unit configured to determine that the continuous multi-row or multi-column region is a single-color edge-filling region if the maximum rectangular area of each row or column in the continuous multi-row or multi-column region is greater than the area threshold value and the color information of the continuous multi-row or multi-column region is consistent.

[0083] In one embodiment, a computer device is provided, which can be a server, and an internal structure diagram thereof can be as shown in Figure 4 The computer device comprises a processor, a memory, a network interface and a database connected through a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for running the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is configured to communicate with an external user terminal through a network connection. The computer program is executed by the processor to implement functions or steps of a server side of a video processing method based on histogram rectangular area.

[0084] In one embodiment, a computer device is provided, which can be a user terminal, and an internal structure diagram thereof can be as shown in Figure 5 The computer device comprises a processor, a memory, a network interface, a display screen and an input device connected through a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for running the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is configured to communicate with an external server through a network connection. The computer program is executed by the processor to implement functions or steps of a user terminal side of a video processing method based on histogram rectangular area. In one embodiment, a computer device is provided, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, and the processor implements the following steps when executing the computer program: obtaining a target video to be processed, pre-processing the target video to be processed to generate a target input image; counting a pixel number of each row or each column of pixels of the target input image in a preset statistical direction, and constructing a color height map of each row or each column according to the pixel number; calculating a maximum rectangular area of the color height map of each row or each column by using a maximum rectangular area algorithm; comparing the maximum rectangular area with an area threshold value, and determining that the row or the column has a single-color edge-filling region if the maximum rectangular area is greater than the area threshold value; obtaining region information of the single-color edge-filling region, and performing a repair processing on the target input image according to the region information.

[0085] In one embodiment, a computer readable storage medium is provided, and the computer readable storage medium has a computer program stored thereon, and the computer program is executed by a processor to implement the following steps: obtaining a target video to be processed, pre-processing the target video to be processed to generate a target input image; counting a pixel number of each row or each column of pixels of the target input image in a preset statistical direction, and constructing a color height map of each row or each column according to the pixel number; calculating a maximum rectangular area of the color height map of each row or each column by using a maximum rectangular area algorithm; comparing the maximum rectangular area with an area threshold value, and determining that the row or the column has a single-color edge-filling region if the maximum rectangular area is greater than the area threshold value; obtaining region information of the single-color edge-filling region, and performing a repair processing on the target input image according to the region information.

[0086] It should be noted that the functions or steps that the computer readable storage medium or the computer device can implement correspond to the related descriptions of the server side and the user side in the foregoing method embodiments, and thus will not be described herein again to avoid repetition.

[0087] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when the computer program is executed, the processes of the above-mentioned embodiments of the methods can be included. Any reference to memory, storage, database or other medium used in the embodiments provided in the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0088] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is exemplified, and in actual application, the above-mentioned functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above.

[0089] It should be noted that if non-company software tools or components appear in the embodiments of the present application, they are only used for example introduction and do not represent actual use. The above-described embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

Claims

1. A video processing method based on histogram rectangular area, characterized in that: The following steps are involved: Obtaining a target video to be processed, preprocessing the target video to be processed, and generating a target input image; Counting the number of pixels in each row or column of the target input image in a preset statistical direction, and constructing a color height map for each row or column according to the number of pixels; Calculate the maximum rectangular area of ​​each row or column of the color height map using the maximum rectangular area algorithm; Comparing the maximum rectangular area with an area threshold, and if the maximum rectangular area is greater than the area threshold, determining that a single-color padded area exists in the row or the column; Acquire region information of the monochrome patching region, and perform patching processing on the target input image according to the region information.

2. The video processing method based on histogram rectangular area according to claim 1, characterized in that: The step of obtaining a target video to be processed, preprocessing the target video to be processed, and generating a target input image includes: Obtaining the target video to be processed; Decoding the target video to be processed and extracting the target image frame; Performing color space conversion and color quantization processing on the target image frame to generate a target input image.

3. The video processing method based on histogram rectangular area according to claim 1, characterized in that: The counting of the number of pixels in each row or each column of the target input image in a preset counting direction, and constructing a color height map for each row or each column according to the number of pixels, includes: Create an initial color height map; Traversing each row or column of the target input image; Performing pixel color statistics on the pixels in each row or column; In the initial color height map, if the pixel color of the current row or current column is the same as that of the previous row or previous column, the pixel color quantity value of the current row or current column is the pixel color quantity value of the previous row or previous column plus one; In the initial color height map, if the pixel color of the current row or current column is different from that of the previous row or previous column, the pixel color quantity value of the current row or current column is one; Construct a color height map for each row or column based on the pixel color quantity value of each row or column.

4. The video processing method based on histogram rectangular area according to claim 1, characterized in that: The maximum rectangular area of ​​each row or column of the color height map is calculated by the maximum rectangular area algorithm, including: Creating a monotonically increasing stack, initializing the monotonically increasing stack to be empty, and initializing the maximum area to zero; Traversing the color height map of the row or column according to a preset calculation direction, and comparing the height of the color height map of the row or column with the height of the top element of the stack; When the height of the color height map is greater than or equal to the height of the top element of the stack, the row or column is pushed into the monotonically increasing stack; When the height of the color height map is less than the height of the top element of the stack, the top element of the stack is popped out; Obtain the height of the popped-up top element of the stack, and calculate the maximum rectangular area based on the height of the top element of the stack and the row or column; The maximum rectangular area is compared with the maximum area. If the maximum rectangular area is larger than the maximum area, the maximum rectangular area is replaced with the new maximum area.

5. The video processing method based on histogram rectangular area according to claim 4, characterized in that: The method of calculating the maximum rectangular area of ​​each row or column of the color height map by the maximum rectangular area algorithm further includes: After traversing the color height maps of all the rows or columns, checking whether the monotonically increasing stack is empty; If the monotonically increasing stack is not empty, popping out the remaining top elements in the monotonically increasing stack in sequence; The area of ​​the rectangle is calculated according to the top element of the stack, and the area of ​​the rectangle is compared with the maximum area. If the area of ​​the rectangle is larger than the maximum area, the area of ​​the rectangle is replaced by the new maximum area.

6. The video processing method based on histogram rectangular area according to claim 1, characterized in that: The comparing the maximum rectangular area with an area threshold, and determining that a single-color padding area exists in the row or the column if the maximum rectangular area is greater than the area threshold, includes: Setting the area threshold according to the target input image; Comparing the maximum rectangle area with an area threshold; When the area of ​​the largest rectangle is less than or equal to the area threshold, it is determined that there is no single-color edge-filling area in the row or column; When the area of ​​the largest rectangle is greater than the area threshold, it is determined that a single-color patching area exists in the row or the column.

7. The video processing method based on histogram rectangular area according to claim 1, characterized in that: The step of comparing the maximum rectangular area with an area threshold and determining that a single-color edge-padded area exists in the row or column if the maximum rectangular area is greater than the area threshold further includes: Select multiple consecutive rows or columns according to preset rules; Obtaining the maximum rectangular area of ​​each row or column in the continuous multi-row or multi-column area, and the corresponding color information; Comparing the maximum rectangular area of ​​each row or column with the area threshold; If the maximum rectangular area of ​​each row or column in the continuous multiple rows or columns is greater than the area threshold, and the color information of the continuous multiple rows or columns is consistent, it is determined that a single-color filling area exists in the continuous multiple rows or columns.

8. A video processing device based on histogram rectangular area, characterized in that: The video processing device based on the histogram rectangular area includes: A target image module is used to obtain a target video to be processed, pre-process the target video to be processed, and generate a target input image; A color height map module is used to count the number of pixels in each row or column of the target input image in a preset statistical direction, and construct a color height map for each row or column based on the number of pixels; The maximum rectangular area module is used to calculate the maximum rectangular area of ​​each row or column of the color height map through the maximum rectangular area algorithm; a monochrome patching region module, configured to compare the maximum rectangular area with an area threshold, and if the maximum rectangular area is greater than the area threshold, determine that a monochrome patching region exists in the row or column; The patching processing module is used to obtain the region information of the monochrome patching region and perform patching processing on the target input image according to the region information.

9. A computer device, characterized in that: The computer device includes a memory, a processor, and a video processing program based on histogram rectangular area stored in the memory and capable of running on the processor. When the video processing program based on histogram rectangular area is executed by the processor, the steps of the video processing method based on histogram rectangular area are implemented as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that The storage medium stores a video processing program based on the histogram rectangular area. When the video processing program based on the histogram rectangular area is executed by the processor, the steps of the video processing method based on the histogram rectangular area are implemented as described in any one of claims 1 to 7.