Picture processing method and device, electronic equipment and storage medium

By automatically determining and cropping the invalid areas of the video image, the problem of black edges or black lines on different devices is solved, and efficient and automatic image processing is achieved, improving the user's viewing experience.

CN119991880APending Publication Date: 2025-05-13BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510177815.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-18
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

In diverse mobile devices, video screen display often occurs due to the different pixel calculation methods used by different devices or operating systems, which lead to indecent black edges or black lines. The existing technology is difficult to effectively solve this problem.

Method used

By acquiring the image to be processed and its size information, it is judged whether there is an invalid picture in the image. If it exists, it will traverse from the outside to the inside from the edge of the image to determine the pixel information, and crop the image based on the pixel information to obtain an effective picture consistent with the playback size of the playback device.

Benefits of technology

Automatic judgment and cropping of image size information is realized, manual intervention is avoided, image processing efficiency and quality is improved, and the best effect of videos is ensured when displayed on different devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119991880A_ABST
    Figure CN119991880A_ABST
Patent Text Reader

Abstract

The invention relates to a picture processing method and device, electronic equipment and a storage medium. The method comprises the steps of obtaining a to-be-processed image and size information of the to-be-processed image; according to the size information of the to-be-processed image, judging whether an invalid picture exists in the to-be-processed image or not; traversing the to-be-processed image from the edge of the image from outside to inside under the condition that an invalid picture exists in the to-be-processed image, and determining pixel information of the to-be-processed image; and cutting the to-be-processed image according to the pixel information to obtain an effective picture of the to-be-processed image. Whether an invalid picture exists in the image is judged through the size information of the to-be-processed image, and a developer does not need to test playing pictures of the playing device one by one; and the to-be-processed image is precisely cut according to the pixel information under the condition that the invalid image exists, so that the effective image is obtained, and automatic judgment and cutting processing on the image size information are realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a picture processing method, device, electronic device and storage medium. Background Art

[0002] In the current diverse mobile devices, developers often set fixed pixel values ​​to control the screen size when displaying video images. Since different devices or operating systems use different pixel calculation methods, unsightly black edges or black lines may appear around the video screen.

[0003] To solve this problem, the current measure is to adjust the size ratio for the specific models or operating systems where the problem occurs. However, this method has limitations and modifications must be made after each specific problem is discovered, resulting in some models or systems not being covered, thus affecting the user's viewing experience.

[0004] Therefore, there is an urgent need to develop a picture processing method, device, electronic device and storage medium to solve one or more of the above-mentioned problems. Summary of the invention

[0005] In view of this, in order to solve the above technical problems or part of the technical problems, the embodiments of the present invention provide a picture processing method, device, electronic device and storage medium.

[0006] In a first aspect, the present application provides a picture processing method, the method comprising:

[0007] Acquire an image to be processed and size information of the image to be processed;

[0008] According to the size information of the image to be processed, determining whether there is an invalid picture in the image to be processed;

[0009] In the case where there is an invalid picture in the image to be processed, traversing the image to be processed from the edge of the image from the outside to the inside to determine the pixel information of the image to be processed;

[0010] The image to be processed is cropped according to the pixel information to obtain a valid picture of the image to be processed, and the picture size of the valid picture is consistent with the playback size of the corresponding playback device.

[0011] In a possible implementation manner, the cropping the image to be processed according to the pixel information to obtain a valid frame of the image to be processed includes:

[0012] Determining an invalid frame of the image to be processed according to pixel information of the image to be processed;

[0013] The invalid frame is deleted from the image to be processed to obtain a valid frame of the image to be processed.

[0014] In a possible implementation manner, determining the invalid frame of the image to be processed according to the pixel information of the image to be processed includes:

[0015] Obtaining position distribution information of the black area recorded in the pixel information;

[0016] According to the position distribution information of the black area, an invalid area of ​​the image to be processed is determined, and the invalid area is a black border with the same width or the same height.

[0017] In a possible implementation, traversing the image to be processed from the edge of the image from the outside to the inside to determine the pixel information of the image to be processed includes:

[0018] Starting from the edge of the image, traversing each pixel of the image to be processed row by row or column by column in an order from the outside to the inside, to obtain the color of each pixel in the image to be processed and the position information corresponding to each pixel in the image to be processed;

[0019] According to the color of each pixel in the image to be processed and the position information corresponding to each pixel in the image to be processed, the pixel color type of the image to be processed and the position distribution information of each color pixel are obtained as the pixel information of the image to be processed.

[0020] In a possible implementation manner, judging whether there is an invalid picture in the image to be processed according to the size information of the image to be processed includes:

[0021] Obtaining position information of pre-built row index and column index in the image to be processed;

[0022] Determining, according to the position information, whether the row index or the column index matches the size information of the image to be processed;

[0023] When the row index or the column index does not match the size information of the image to be processed, an invalid frame exists in the image to be processed.

[0024] In a possible implementation, judging, according to the position information, whether the row index or the column index matches the size information of the image to be processed includes:

[0025] Determine the image height and image width recorded in the size information of the image to be processed;

[0026] Compare the position information of the row index with the image height, and determine whether the row index matches the size information of the image to be processed according to the comparison result;

[0027] The position information of the column index is compared with the image width, and it is determined whether the column index matches the size information of the image to be processed according to the comparison result.

[0028] In a possible implementation, the method further includes:

[0029] When multiple valid pictures are obtained, determining whether the picture sizes of the multiple valid pictures are consistent;

[0030] When the screen sizes of the multiple valid screens are consistent, determining whether the playback size of the player is consistent with the screen size of the valid screen;

[0031] In the case where the playback size of the player is inconsistent with the screen size of the effective screen, the black border area of ​​the player screen is deleted to make the modified playback size of the player consistent with the screen size;

[0032] In the case that the sizes of the multiple valid frames are inconsistent, the step of cropping the image to be processed according to the pixel information to obtain the valid frame of the image to be processed is performed again.

[0033] In a second aspect, the present application provides a picture processing device, the device comprising:

[0034] An acquisition module, used for acquiring an image to be processed and size information of the image to be processed;

[0035] A first judging module, used for judging whether there is an invalid picture in the image to be processed according to the size information of the image to be processed;

[0036] A traversal module, used for traversing the image to be processed from the edge of the image from the outside to the inside to determine the pixel information of the image to be processed when there is an invalid picture in the image to be processed;

[0037] The cropping module is used to crop the image to be processed according to the pixel information to obtain a valid picture of the image to be processed, and the picture size of the valid picture is consistent with the playback size of the corresponding playback device.

[0038] In a third aspect, the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the screen processing method described in any one of the embodiments of the first aspect when executing the computer program.

[0039] In a fourth aspect, the present application further provides a computer storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the image processing method described in any embodiment of the first aspect are implemented.

[0040] The above-mentioned technical scheme provided by the embodiment of the present application has the following advantages over the prior art: the method provided by the embodiment of the present application determines whether there is an invalid screen in the image through the size information of the image to be processed, without the need for developers to test the playback screen of the playback device one by one; and determines the pixel information of the image to be processed in the presence of an invalid screen, and then accurately crops the image to be processed according to the pixel information to obtain a valid screen, thereby realizing automatic judgment and cropping of image size information. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0043] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0044] Figure 1 A flowchart of a method for processing an image provided by an embodiment of the present application;

[0045] Figure 2 A schematic diagram of a flow chart of another image processing method provided in an embodiment of the present application;

[0046] Figure 3 A flowchart of another image processing method provided in an embodiment of the present application;

[0047] Figure 4 A schematic diagram of an image to be processed provided in an embodiment of the present application;

[0048] Figure 5 A schematic diagram of an effective screen provided by an embodiment of the present application;

[0049] Figure 6 A schematic diagram of a pixel traversal process provided in an embodiment of the present application;

[0050] Figure 7 A schematic diagram of the structure of a picture processing device provided in an embodiment of the present application;

[0051] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0052] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0053] The disclosure below provides many different embodiments or examples to implement different structures of the present invention. In order to simplify the disclosure of the present invention, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present invention. In addition, the present invention can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.

[0054] In order to solve the problem that the prior art cannot effectively adjust the size ratio for different types of display devices when processing images, and lacks an efficient method to adjust the size ratio specifically for a specific display device, the present application provides a picture processing method, device, electronic device and storage medium, which can automatically determine whether there is an invalid picture area in the image by analyzing the size information of the image to be processed, without the need for developers to perform tedious one-by-one tests on each different display device; and further analyze the pixel information of the image when an invalid picture is detected in the image, thereby achieving accurate cropping of the image to extract the valid picture, and can automatically complete the judgment and cropping of the image size information, significantly improving the efficiency and quality of image processing.

[0055] Figure 1 A flowchart of a method for processing a picture provided by an embodiment of the present application is shown in FIG. Figure 1 As shown, the method specifically includes:

[0056] S101, obtaining an image to be processed and size information of the image to be processed;

[0057] In this embodiment, when the video starts playing and the video content is displayed on the player interface, the video screen presented in the player is captured and used as the image to be processed subsequently. At the same time, the specific size information of the image to be processed is obtained to facilitate subsequent image processing work.

[0058] S102, judging whether there is an invalid picture in the image to be processed according to the size information of the image to be processed;

[0059] In this embodiment, the video screen displayed in the player may cause undesirable black borders or black lines to appear around the video screen on certain specific playback devices or operating systems due to the application of different pixel calculation algorithms. To address this phenomenon, the size information of the image to be processed can be analyzed to determine whether the image contains invalid black borders, thereby assisting in identifying and solving visual problems that occur during video playback, thereby improving the viewing experience.

[0060] It should be noted that, in this embodiment, the invalid picture is taken as a black border or black line as an example. In the specific picture processing process, the display color of the invalid picture is not limited. The invalid picture can also be an abnormal picture of other colors, such as green, blue, etc. The user can set the recognition standard and processing method of the invalid picture according to actual needs, so as to achieve personalized adjustment of the video playback effect.

[0061] S103, when there is an invalid picture in the image to be processed, traverse the image to be processed from the edge of the image from the outside to the inside to determine the pixel information of the image to be processed;

[0062] In this embodiment, when it is determined that there is an invalid black-bordered image in the image to be processed, the image is traversed row by row or column by column four times from the edge of the image from top to bottom, from left to right, from bottom to top, and from right to left, so as to effectively obtain detailed pixel information of the image to be processed, thereby laying a data foundation for subsequent image processing.

[0063] S104: Crop the image to be processed according to the pixel information to obtain a valid picture of the image to be processed, wherein the picture size of the valid picture is consistent with the playback size of the corresponding playback device.

[0064] In this embodiment, after obtaining detailed pixel information of the image to be processed, invalid areas in the image are identified based on the pixel information. After determining the invalid areas, the invalid areas in the image are deleted through a cropping operation, so that only the valid part of the image is retained. After the cropping is completed, the obtained valid picture will have a size that completely matches the device used to play the image, ensuring that the image can achieve the best effect when displayed on different devices.

[0065] The image processing method provided in the embodiment of the present application first obtains the image to be processed and the size information of the image, and then determines whether there is an invalid picture in the image according to the size information. The developer does not need to test each playback device one by one to obtain the picture condition of the image to be processed, that is, whether there is an invalid picture, thereby improving the efficiency and compatibility of picture processing; when it is determined that the image has an invalid picture, the pixel information of the image to be processed is determined, and then the image to be processed is accurately cropped according to the pixel information to obtain a valid picture, thereby realizing automatic judgment and cropping of image size information, being able to adapt to image processing requirements of different sizes and resolutions, being suitable for various playback devices and scenarios, reducing manual intervention, reducing operating difficulty, and improving user experience.

[0066] In an optional solution of the embodiment of the present invention, the cropping of the image to be processed according to the pixel information to obtain a valid frame of the image to be processed includes:

[0067] Determining an invalid frame of the image to be processed according to pixel information of the image to be processed;

[0068] The invalid frame is deleted from the image to be processed to obtain a valid frame of the image to be processed.

[0069] In this embodiment, the process of cropping the image to be processed according to the image pixel information to obtain the corresponding valid image mainly includes the following steps:

[0070] Step 1: Conduct an in-depth analysis of the pixel information of the image to be processed, and determine which parts of the image belong to the invalid picture area based on the analysis results. This process may involve comprehensive consideration of the color distribution factors of the image, such as edge detection and color recognition technology, to assist in determining which areas may not contain useful information, thereby effectively separating the invalid picture from the valid content.

[0071] Step 2: Delete the determined invalid images from the image to be processed to obtain the valid images of the image to be processed, ensure that the final image only contains the image parts with picture value, and improve the final presentation effect of the image and the audience's viewing experience.

[0072] The picture processing method provided in the embodiment of the present application uses pixel information of the image to be processed to determine the invalid picture in the image, and then deletes the invalid picture from the original picture to obtain a picture containing only valid content, so that the picture ratio is automatically adapted, and accurate playback of the picture content is achieved, thereby improving the user's viewing experience and the quality of the film presentation.

[0073] For example, after the video starts playing, a picture of the video screen is captured every 5 seconds to obtain (such as Figure 4), and perform pixel scanning four times row by row from top to bottom, from left to right, from bottom to top, and from right to left, thereby measuring the size of the black area at the top, left, bottom, and right border positions respectively; crop the black area and retain the area of ​​the screen without black borders (such as Figure 5 ) to get the real picture size.

[0074] In addition, when a valid picture of the image to be processed is obtained and the picture size of the valid picture is consistent with the playback size of the corresponding playback device, it is determined whether the picture quality of the valid picture meets the standard; when the picture quality of the valid picture does not meet the standard, the valid picture is optimized to improve the picture quality of the valid picture.

[0075] Specifically, the image quality of the cropped effective image is tested to determine whether it meets the preset image quality standard. The image quality standard can be set according to actual needs, including but not limited to parameters such as clarity, brightness, and contrast. When it is detected that the image quality of the effective image does not meet the standard, the effective image is further optimized to improve its image quality and ensure that the final image has the best visual effect. The optimization method may include but is not limited to image enhancement, denoising, sharpening and other processing technologies.

[0076] The image processing method provided in the embodiment of the present application can not only realize the automatic judgment and cropping of image size information, but also can perform quality detection and optimization processing on the effective image after cropping, so as to ensure that the final image presented has the best visual effect and compatibility. This greatly improves the efficiency and quality of image processing, reduces the cost of manual intervention, and improves the user experience.

[0077] In an optional solution of the embodiment of the present invention, determining the invalid frame of the image to be processed according to the pixel information of the image to be processed includes:

[0078] Obtaining position distribution information of the black area recorded in the pixel information;

[0079] According to the position distribution information of the black area, an invalid area of ​​the image to be processed is determined, and the invalid area is a black border with the same width or the same height.

[0080] In this embodiment, a black border with the same width or height as the edge of the image to be processed is used as an invalid area of ​​the image to be processed; first, the black area in the image is determined according to the pixel information of the image to be processed, and then the invalid area of ​​the black border is determined based on the position distribution information of the black area.

[0081] Specifically, determining the invalid frame of the image to be processed based on the pixel information of the image to be processed mainly includes the following steps:

[0082] Step 1: When processing image data, identify and record the location distribution of black areas in the image by analyzing pixel information.

[0083] Step 2: According to the position distribution of black areas in the image, automatically identify the black borders or black areas in the image. These areas usually do not contain valuable content and are invalid images. By analyzing the position distribution of these black areas, the scope of invalid images can be accurately defined, providing accurate data support for subsequent image cropping, thereby ensuring the accuracy and efficiency of image processing, and helping to improve the quality of the final image and the audience's viewing experience.

[0084] The image processing method provided in the embodiment of the present application obtains the position distribution information of the black area recorded by the pixel information in the image, and further identifies and determines the black borders with the same width or the same height in the image based on the position distribution information of the black area, because these borders usually represent the parts of the edge of the image that do not contain important information. The black borders with the same width or the same height in the image to be processed represent the invalid areas in the image.

[0085] In an optional solution of the embodiment of the present invention, traversing the image to be processed from the edge of the image from the outside to the inside to determine the pixel information of the image to be processed includes:

[0086] Starting from the edge of the image, traversing each pixel of the image to be processed row by row or column by column in an order from the outside to the inside, to obtain the color of each pixel in the image to be processed and the position information corresponding to each pixel in the image to be processed;

[0087] According to the color of each pixel in the image to be processed and the position information corresponding to each pixel in the image to be processed, the pixel color type of the image to be processed and the position distribution information of each color pixel are obtained as the pixel information of the image to be processed.

[0088] In this embodiment, the process of determining the pixel information of the image to be processed mainly includes the following steps:

[0089] Step 1: Starting from the edge of the image, traverse the image to be processed row by row or column by column in the order from the outside to the inside. In this process, the color information of each pixel in the image to be processed is recorded, and the specific position information corresponding to each pixel in the image to be processed is also obtained;

[0090] Step 2: The color information obtained from each pixel in the image to be processed and the position information of each pixel in the image are further analyzed to obtain the pixel color type of the image to be processed; in addition, the specific position distribution of each color pixel in the image is determined, and the above information is used to form the pixel information of the image to be processed.

[0091] Figure 2 A flowchart of another image processing method provided in an embodiment of the present application is shown as follows: Figure 2 As shown, the method specifically includes:

[0092] S201, obtaining position information of pre-built row index and column index in the image to be processed;

[0093] In image processing, an image can be viewed as a two-dimensional matrix. The row index and column index are used to locate each element in the matrix (i.e., the pixel in the image). The row index combined with the column index can accurately locate each pixel in the image. The row index is used to identify the horizontal position in the image matrix. Counting starts from the top of the image, and the row index value gradually increases from top to bottom. Usually, the first row at the top of the image is defined as row index 0, the second row is row index 1, and so on. For example, for an image of size M×N (M represents the number of rows, and N represents the number of columns), the row index ranges from 0 to M-1. The column index is used to identify the vertical position in the image matrix. Counting starts from the left side of the image, and the column index value gradually increases from left to right. The first column on the leftmost side of the image is defined as column index 0, the second column is column index 1, and so on. For an image of size M×N, the column index ranges from 0 to N-1.

[0094] In this embodiment, the row index and column index are designed based on the picture structure characteristics of the image, which can help to quickly identify and access the pixel values ​​of each row and column in the image. First, the image to be processed is analyzed to obtain the position of the pre-constructed row index and column index, so as to quickly locate the specific pixel point or area during the image processing process, thereby improving the efficiency of image analysis and processing.

[0095] S202: judging, according to the position information, whether the row index or the column index matches the size information of the image to be processed;

[0096] In this embodiment, after determining the position information of the row index and the column index in the image to be processed, it can be determined whether the row index or the column index matches the size information of the image to be processed according to the position information;

[0097] Specifically, the position information of the index in the image to be processed is used to determine whether the row index or the column index matches the height and width in the size information of the image to be processed.

[0098] If the row index or column index does not match the height or width in the size information of the image to be processed, the image needs to be adjusted accordingly to ensure that the index can correctly correspond to the specified position in the image, that is, the starting row or starting column of the image.

[0099] S203: When the row index or the column index does not match the size information of the image to be processed, an invalid frame exists in the image to be processed.

[0100] In this embodiment, when the row index and the column index do not match the size information of the image to be processed, it indicates that the corresponding row index or column index cannot be found at the image starting row or the image starting column of the image to be processed, that is, there is an invalid black border area at the edge of the image; in this case, there is an invalid picture in the image to be processed.

[0101] The image processing method provided in the embodiment of the present application uses the position information of the row index and column index pre-constructed in the image to be processed to match the size information of the image to determine whether there is an invalid picture in the image to be processed. In the process of judging the invalid picture, there is no need to judge the playback size of each image playback device one by one, and only the size information and index position of the image itself need to be matched, which greatly simplifies the judgment process of the invalid picture and improves the efficiency and accuracy of the picture processing. In addition, the image processing method is flexible and universal, can adapt to the image processing requirements of different sizes and resolutions, does not need to be specially adapted for different image playback devices, and reduces development and maintenance costs.

[0102] Figure 3 A flowchart of another image processing method provided in an embodiment of the present application is shown as follows: Figure 3 As shown, the method specifically includes:

[0103] S301, determining the image height and image width recorded in the size information of the image to be processed;

[0104] S302, comparing the position information of the row index with the image height, and determining whether the row index matches the size information of the image to be processed according to the comparison result;

[0105] S303: Compare the position information of the column index with the image width, and determine whether the column index matches the size information of the image to be processed according to the comparison result.

[0106] In this embodiment, by judging whether the positions of the row index and the column index match the image height and the image width recorded in the size information of the image to be processed, it is judged whether there is an invalid picture in the image to be processed. The image size and index position can be intelligently analyzed without human intervention, which greatly improves the automation of picture processing and can complete the processing of a large number of images in a short time, meeting the high efficiency requirements in practical applications.

[0107] Exemplarily, the image processing method comprises the following steps:

[0108] Step 1: Use the system function to obtain a screenshot of the current playback screen.

[0109] Step 2: Through the pixel traversal scanning algorithm (such as Figure 6 As shown), the screenshot of step 1 is called 4 times from top to bottom, from left to right, from bottom to top, and from right to left in turn to obtain the black border sizes top, left, bottom, and right in the four directions of top, left, bottom, and right. If top=left=bottom=right=0, it indicates that there is no black border in the image and no subsequent process is required.

[0110] Step 3: Use the system cropping function to cut off the black edges of the image in four directions to get a new image without black edges.

[0111] in, Figure 6 This is a flow chart of obtaining the black border size from top to bottom in step 2; Figure 6 As shown, the size information of the image is obtained, including the image height height, the image width width, the top black area height top, the number of rows when traversing the image pixels row, and the number of columns when traversing the image pixels col; first determine whether the position of the row index is less than the image height height, if it is initialized col, continue to determine whether the position of the column index is less than the width width, if not top++, row++ to obtain the invalid area of ​​the black border with the same height; if the column index is less than the width width, calculate the pixel index pixelldex, where pixelldex = (row×width+col)×4, and obtain the RGB value of the pixel according to pixelldex. If R, G, and B are all 0, it is black and continues col++, and continues to determine whether the next column index is less than the width width, until a non-black pixel is found, the traversal ends, and the black border height is obtained as top.

[0112] In an optional solution of the embodiment of the present invention, the method further includes:

[0113] When multiple valid pictures are obtained, determining whether the picture sizes of the multiple valid pictures are consistent;

[0114] When the screen sizes of the multiple valid screens are consistent, determining whether the playback size of the player is consistent with the screen size of the valid screen;

[0115] In the case where the playback size of the player is inconsistent with the screen size of the effective screen, the black border area of ​​the player screen is deleted to make the modified playback size of the player consistent with the screen size;

[0116] In the case that the sizes of the multiple valid frames are inconsistent, the step of cropping the image to be processed according to the pixel information to obtain the valid frame of the image to be processed is performed again.

[0117] In this embodiment, in order to ensure the accuracy of the valid area of ​​the image to be processed, the determination and cropping of the invalid area of ​​the image to be processed will be performed multiple times in sequence within a preset time. If the results of the multiple determinations and cropping actions are consistent, the result is confirmed as the valid area of ​​the image to be processed, and the processed image is output; if the results of the multiple determinations and cropping actions are inconsistent, the determination and cropping of the invalid area are performed again until a consistent result is obtained to ensure the quality of the final output image.

[0118] In addition, the image processing also has an automatic adjustment function, which can further optimize the processed image according to preset rules, such as adjusting the image brightness, contrast and other parameters to achieve better visual effects. It also has a user interaction interface, through which users can set parameters, view processing results, etc., making the entire processing process more flexible and convenient.

[0119] For example, after the above step 3, the image processing method further includes:

[0120] Step 4: Execute steps 1 to 3 every 5 seconds for a total of 3 times to obtain three pictures without black borders, p1, p2, and p3.

[0121] Step 5: Compare the sizes of p1, p2, and p3. If they are equal, change the player size to p1 and remove the black edges of the player screen. If they are not equal, repeat step 4.

[0122] Figure 7 A schematic diagram of the structure of a picture processing device provided in an embodiment of the present application is as follows: Figure 7 As shown, the device specifically includes:

[0123] An acquisition module 701 is used to acquire an image to be processed and size information of the image to be processed;

[0124] A first judging module 702 is used to judge whether there is an invalid picture in the image to be processed according to the size information of the image to be processed;

[0125] A traversal module 703 is used to traverse the image to be processed from the edge of the image from the outside to the inside to determine the pixel information of the image to be processed when there is an invalid picture in the image to be processed;

[0126] The cropping module 704 is used to crop the image to be processed according to the pixel information to obtain a valid picture of the image to be processed, wherein the picture size of the valid picture is consistent with the playback size of the corresponding playback device.

[0127] In a possible implementation, the cropping module 704 is further configured to determine an invalid frame of the image to be processed according to pixel information of the image to be processed; and delete the invalid frame from the image to be processed to obtain a valid frame of the image to be processed.

[0128] In a possible implementation, the cropping module 704 is further used to obtain position distribution information of black areas recorded in the pixel information; and determine an invalid area of ​​the image to be processed based on the position distribution information of the black areas, where the invalid area is a black border of the same width or height.

[0129] In a possible implementation, the traversal module 703 is also used to start from the edge of the image and perform a row-by-row or column-by-column traversal operation on each pixel of the image to be processed in an order from the outside to the inside to obtain the color of each pixel in the image to be processed and the corresponding position information of each pixel in the image to be processed; according to the color of each pixel in the image to be processed and the corresponding position information of each pixel in the image to be processed, the pixel color type of the image to be processed and the position distribution information of each color pixel are obtained as the pixel information of the image to be processed.

[0130] In a possible implementation, the first judgment module 702 is also used to obtain position information of pre-constructed row index and column index in the image to be processed; based on the position information, determine whether the row index or the column index matches the size information of the image to be processed; if the row index or the column index does not match the size information of the image to be processed, there is an invalid picture in the image to be processed.

[0131] In one possible implementation, the first judgment module 702 is also used to determine the image height and image width recorded in the size information of the image to be processed; compare the position information of the row index with the image height, and determine whether the row index matches the size information of the image to be processed based on the comparison result; compare the position information of the column index with the image width, and determine whether the column index matches the size information of the image to be processed based on the comparison result.

[0132] In one possible implementation, the device further includes a second judgment module 705 (not shown in the figure), which is used to determine whether the screen sizes of the multiple valid screens are consistent when multiple valid screens are obtained; when the screen sizes of the multiple valid screens are consistent, determine whether the playback size of the player is consistent with the screen size of the valid screen; when the playback size of the player is inconsistent with the screen size of the valid screen, delete the black border area of ​​the player screen to make the modified playback size of the player consistent with the screen size; when the screen sizes of the multiple valid screens are inconsistent, re-execute the step of cropping the image to be processed according to the pixel information to obtain the valid screen of the image to be processed.

[0133] The picture processing device provided in this embodiment can be as follows Figure 7 The picture processing device shown in can execute the following Figure 1-6 All the steps of picture processing in the Figure 1-6 For details, please refer to the technical effect of the picture processing shown. Figure 1-6 For the sake of brevity, the relevant description is not repeated here.

[0134] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units 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.

[0135] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown in FIG. Figure 8 As shown, an embodiment of the present application provides an electronic device, including a processor 801, a communication interface 802, a memory 803 and a communication bus 804, wherein the processor 801, the communication interface 802, and the memory 803 communicate with each other through the communication bus 804; the memory 803 is used to store computer programs; the processor 801 is used to execute the program stored in the memory 803, and implement the steps of screen processing provided by any of the above-mentioned method embodiments:

[0136] Acquire an image to be processed and size information of the image to be processed; determine whether there is an invalid picture in the image to be processed according to the size information of the image to be processed; if there is an invalid picture in the image to be processed, traverse the image to be processed from the edge of the image from the outside to the inside to determine the pixel information of the image to be processed; crop the image to be processed according to the pixel information to obtain a valid picture of the image to be processed, and the picture size of the valid picture is consistent with the playback size of the corresponding playback device.

[0137] In a possible implementation, an invalid frame of the image to be processed is determined according to pixel information of the image to be processed; and the invalid frame is deleted from the image to be processed to obtain a valid frame of the image to be processed.

[0138] In a possible implementation, position distribution information of black areas recorded in the pixel information is obtained; and based on the position distribution information of the black areas, an invalid area of ​​the image to be processed is determined, where the invalid area is a black border of the same width or height.

[0139] In one possible implementation, starting from the edge of the image, each pixel of the image to be processed is traversed row by row or column by column in an order from the outside to the inside to obtain the color of each pixel in the image to be processed and the corresponding position information of each pixel in the image to be processed; according to the color of each pixel in the image to be processed and the corresponding position information of each pixel in the image to be processed, the pixel color type of the image to be processed and the position distribution information of each color pixel are obtained as the pixel information of the image to be processed.

[0140] In one possible implementation, position information of pre-constructed row index and column index in the image to be processed is obtained; based on the position information, it is determined whether the row index or the column index matches the size information of the image to be processed; if the row index or the column index does not match the size information of the image to be processed, an invalid picture exists in the image to be processed.

[0141] In one possible implementation, determine the image height and image width recorded in the size information of the image to be processed; compare the position information of the row index with the image height, and determine whether the row index matches the size information of the image to be processed based on the comparison result; compare the position information of the column index with the image width, and determine whether the column index matches the size information of the image to be processed based on the comparison result.

[0142] In one possible implementation, when multiple valid pictures are obtained, it is determined whether the screen sizes of the multiple valid pictures are consistent; when the screen sizes of the multiple valid pictures are consistent, it is determined whether the playback size of the player is consistent with the screen size of the valid picture; when the playback size of the player is inconsistent with the screen size of the valid picture, the black border area of ​​the player screen is deleted to make the modified playback size of the player consistent with the screen size; when the screen sizes of multiple valid pictures are inconsistent, the step of cropping the image to be processed according to the pixel information to obtain the valid picture of the image to be processed is re-executed.

[0143] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0144] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.

[0145] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A picture processing method, characterized in that: include: Acquire an image to be processed and size information of the image to be processed; According to the size information of the image to be processed, determining whether there is an invalid picture in the image to be processed; In the case where there is an invalid picture in the image to be processed, traversing the image to be processed from the edge of the image from the outside to the inside to determine the pixel information of the image to be processed; The image to be processed is cropped according to the pixel information to obtain a valid picture of the image to be processed, and the picture size of the valid picture is consistent with the playback size of the corresponding playback device.

2. The method according to claim 1, characterized in that The step of cropping the image to be processed according to the pixel information to obtain a valid frame of the image to be processed includes: Determining an invalid frame of the image to be processed according to pixel information of the image to be processed; The invalid frame is deleted from the image to be processed to obtain a valid frame of the image to be processed.

3. The method according to claim 2, characterized in that The step of determining the invalid frame of the image to be processed according to the pixel information of the image to be processed comprises: Obtaining position distribution information of the black area recorded in the pixel information; According to the position distribution information of the black area, an invalid area of ​​the image to be processed is determined, and the invalid area is a black border with the same width or the same height.

4. The method according to claim 1, characterized in that The step of traversing the image to be processed from the outside to the inside from the edge of the image to determine pixel information of the image to be processed includes: Starting from the edge of the image, traversing each pixel of the image to be processed row by row or column by column in an order from the outside to the inside, to obtain the color of each pixel in the image to be processed and the position information corresponding to each pixel in the image to be processed; According to the color of each pixel in the image to be processed and the position information corresponding to each pixel in the image to be processed, the pixel color type of the image to be processed and the position distribution information of each color pixel are obtained as the pixel information of the image to be processed.

5. The method according to claim 1, characterized in that The step of judging whether there is an invalid picture in the image to be processed according to the size information of the image to be processed includes: Obtaining position information of pre-built row index and column index in the image to be processed; Determining, according to the position information, whether the row index or the column index matches the size information of the image to be processed; When the row index or the column index does not match the size information of the image to be processed, an invalid frame exists in the image to be processed.

6. The method according to claim 5, characterized in that The determining, according to the position information, whether the row index or the column index matches the size information of the image to be processed includes: Determine the image height and image width recorded in the size information of the image to be processed; Compare the position information of the row index with the image height, and determine whether the row index matches the size information of the image to be processed according to the comparison result; The position information of the column index is compared with the image width, and it is determined whether the column index matches the size information of the image to be processed according to the comparison result.

7. The method according to claim 1, characterized in that The method further comprises: When multiple valid pictures are obtained, determining whether the picture sizes of the multiple valid pictures are consistent; When the screen sizes of the multiple valid screens are consistent, determining whether the playback size of the player is consistent with the screen size of the valid screen; In the case where the playback size of the player is inconsistent with the screen size of the effective screen, the black border area of ​​the player screen is deleted to make the modified playback size of the player consistent with the screen size; In the case that the sizes of the multiple valid frames are inconsistent, the step of cropping the image to be processed according to the pixel information to obtain the valid frame of the image to be processed is performed again.

8. A picture processing device, characterized in that: include: An acquisition module, used for acquiring an image to be processed and size information of the image to be processed; A first judging module, configured to judge whether there is an invalid picture in the image to be processed according to the size information of the image to be processed; A traversal module, used for traversing the image to be processed from the edge of the image from the outside to the inside to determine the pixel information of the image to be processed when there is an invalid picture in the image to be processed; The cropping module is used to crop the image to be processed according to the pixel information to obtain a valid picture of the image to be processed, and the picture size of the valid picture is consistent with the playback size of the corresponding playback device.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the screen processing method according to any one of claims 1 to 7 are implemented.

10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the screen processing method according to any one of claims 1 to 7 are implemented.