Search

CN-116486412-B - Picture material processing method, device and equipment

CN116486412BCN 116486412 BCN116486412 BCN 116486412BCN-116486412-B

Abstract

The application discloses a processing method, a device and equipment of a picture material, relates to the technical field of image processing, and can divide a text part and a background part of the picture material in a fine granularity way so as to avoid processing errors caused by large-scale image restoration. The method comprises the steps of receiving a picture material, obtaining a text region in the picture material, generating a mask for the text region in the picture material, dividing the text region into a bright region and a dark region by using an average gray value of the text region, wherein the bright region and the dark region respectively correspond to a text part and a background part, identifying the corresponding relation between the bright region and the dark region in the text region and the text part and the background part respectively, merging the masks of all the text regions in the picture material by utilizing the corresponding relation, generating a mask set of the picture material, processing the picture material by using an image restoration algorithm according to the mask set of the picture material, and obtaining the restored picture material.

Inventors

  • LI JINGJING
  • ZHAO SONG

Assignees

  • 拉扎斯网络科技(上海)有限公司

Dates

Publication Date
20260505
Application Date
20230420

Claims (10)

  1. 1. A method of processing picture material, comprising: receiving a picture material, and acquiring a text region in the picture material; generating a mask for a text region in the picture material, and dividing the text region into a bright region and a dark region by using an average gray value of the text region, wherein the bright region and the dark region respectively correspond to a text part and a background part; The method comprises the steps of performing expansion or corrosion operation on a character area, recognizing the corresponding relation between a bright area and a dark area in the character area and a text part and a background part respectively according to the change trend of the average gray value corresponding to the character area after the expansion or corrosion operation, merging masks of all the character areas in a picture material by utilizing the corresponding relation to generate a mask set of the picture material, judging that the expanded background part is the bright area, the bright area corresponds to the background part, and the dark area corresponds to the character part if the average gray value corresponding to the character area after the expansion operation is large, judging that the corroded background part is the dark area, the dark area corresponds to the background part, and the bright area corresponds to the character part if the average gray value corresponding to the character area is small, judging that the expanded background part is the dark area corresponds to the text part, and the dark area corresponds to the background part if the average gray value corresponding to the character area is small, judging that the corroded background part is the bright area, and the dark area corresponds to the bright area after the corrosion operation; And processing the text part of the picture material by using an image restoration algorithm according to the mask set of the picture material to obtain the restored picture material.
  2. 2. The method of claim 1, wherein the receiving the picture material, obtaining text regions in the picture material, comprises: receiving a picture material, and preprocessing the picture material, wherein the preprocessing at least comprises picture channel conversion processing and gray scale processing; And determining the vertex coordinates of an original text region from the preprocessed picture material by using a text recognition technology, and performing edge expansion processing on the boundary of the original text region according to the vertex coordinates of the original text region to obtain the text region in the picture material.
  3. 3. The method of claim 1, wherein the generating a mask for a text region in the picture material, dividing the text region into a bright region and a dark region using an average gray value of the text region, comprises: Generating a mask through a rectangular frame aiming at a text region in the picture material, so that the inside of the rectangular frame and the outside of pixels of the rectangular frame have different filling values; and calculating an average gray value of a text region according to the gray value corresponding to the mask and the picture material, and dividing the text region into a bright region and a dark region by using the average gray value, wherein the bright region and the dark region respectively correspond to a text part and a background part.
  4. 4. A method according to claim 3, wherein the calculating an average gray value of a text region according to the gray value corresponding to the picture material of the mask, and dividing the text region into a bright region and a dark region using the average gray value comprises: multiplying the mask by the gray value corresponding to the picture material to obtain the gray value corresponding to the text region in the picture material, and calculating the average gray value of the text region according to the gray value corresponding to the text region in the picture material; using the average gray value of the text area as a dividing threshold value, traversing and comparing the brightness value with each pixel in the picture material, and dividing the text area into a bright area and a dark area; if the brightness value corresponding to the pixel is larger than the average gray value of the text region, dividing the pixel in the text region into bright regions; if the brightness value corresponding to the pixel is smaller than or equal to the average gray value of the text region, dividing the pixel in the text region into a dark region; The bright area corresponds to one of the text portion and the background portion, and the dark area corresponds to the other of the text portion and the background portion.
  5. 5. The method of claim 1, wherein the identifying the correspondence between the bright and dark regions in the text region and the text and background portions, respectively, and combining the masks of all text regions in the picture material using the correspondence, generates a mask set of the picture material, comprises: Carrying out corrosion operation on the character area, and identifying the corresponding relation between a bright area and a dark area in the character area and the text part and the background part respectively according to the average gray value of the character area after the corrosion operation; Combining masks of all the text areas in the picture material by utilizing the corresponding relation to obtain a mask set covering all the text areas; And performing at least one round of expansion operation according to the preset expansion check on the mask set covering all the text areas, and generating a mask set of the picture material according to the mask set of the expanded text areas.
  6. 6. The method of claim 5, wherein the performing the etching operation on the text region, and identifying the correspondence between the bright region and the dark region in the text region and the text portion and the background portion, respectively, according to the average gray value of the text region after the etching operation, comprises: according to a preset corrosion check, performing corrosion operation on the character area, and counting the average gray value of the character area after the corrosion operation; If the average gray value of the character area after the corrosion operation is larger than the average gray value of the character area before the corrosion operation, identifying and obtaining a background part corresponding to a bright area in the character area and a text part corresponding to a dark area in the character area; and if the average gray value of the character area after the corrosion operation is smaller than or equal to the average gray value of the character area before the corrosion operation, identifying and obtaining a text part corresponding to a bright area in the character area and a background part corresponding to a dark area in the character area.
  7. 7. The method according to any one of claims 1-6, wherein processing the text portion of the picture material using an image restoration algorithm according to the mask set of the picture material to obtain a restored picture material comprises: determining a to-be-repaired text region in a text part of the picture material by using an image repair algorithm according to the mask set of the picture material, and performing erasure processing on the to-be-repaired text region in the picture material; calculating a filling color value according to color values around the to-be-repaired text region after the erasing treatment, and performing color filling on the to-be-repaired text region by using the filling color value according to a preset repair radius to obtain the repaired picture material.
  8. 8. A method of processing picture material, comprising: The method comprises the steps of obtaining a picture material, uploading the picture material to a service platform, enabling the service platform to generate a mask for a text region in the picture material, and obtaining a corresponding average gray value corresponding to the text region after the operation of expanding or corroding according to the variation trend of the text region, identifying the corresponding relation between the bright region and the dark region in the text region and a text portion and a background portion respectively, merging the masks of all the text regions in the picture material by using the corresponding relation, generating a mask set of the picture material, processing the text portion of the picture material by using an image restoration algorithm according to the mask set of the picture material, so as to obtain a restored picture material, judging that the expanded background portion is the bright region and the dark region corresponds to the text portion after the operation of expanding, judging that the corresponding gray value corresponds to the bright region is the bright region and the dark region corresponds to the background portion after the operation of corroding, judging that the background portion corresponds to the bright region and the dark region corresponds to the background portion after the operation of expanding, judging that the bright region corresponds to the bright region and the dark region corresponds to the background portion after the operation of corroding, judging that the bright region corresponds to the bright region and the dark region corresponds to the background portion; receiving repaired picture materials; and if the repaired picture material meets the resource release condition, releasing the repaired picture material into resource bits of different service scenes.
  9. 9. A processing apparatus for picture material, comprising: the acquisition unit is used for receiving the picture material and acquiring a text region in the picture material; a dividing unit, configured to generate a mask for a text region in the picture material, and divide the text region into a bright region and a dark region by using an average gray value of the text region, where the bright region and the dark region respectively correspond to a text portion and a background portion; The identification unit is used for identifying the corresponding relation between the bright area and the dark area in the character area and the text part and the background part respectively according to the change trend of the average gray value corresponding to the character area obtained after the expansion or corrosion operation, merging the masks of all the character areas in the picture material by utilizing the corresponding relation to generate a mask set of the picture material, judging that the expanded background part is the bright area, the bright area is corresponding to the background part and the dark area is corresponding to the text part if the average gray value corresponding to the character area is large after the expansion operation, judging that the corroded background part is the dark area, the dark area is corresponding to the background part if the average gray value corresponding to the character area is large after the corrosion operation, and the bright area is corresponding to the text part; and the processing unit is used for processing the text part of the picture material by using an image restoration algorithm according to the mask set of the picture material to obtain the restored picture material.
  10. 10. A processing apparatus for picture material, comprising: The uploading unit is used for obtaining picture materials, uploading the picture materials to the service platform, enabling the service platform to generate masks for text areas in the picture materials, performing outward expansion or corrosion operation on the text areas, and recognizing corresponding relations between bright areas and dark areas in the text areas and text parts and background parts respectively according to variation trends of average gray values corresponding to the text areas obtained after the outward expansion or corrosion operation, combining the masks of all the text areas in the picture materials by using the corresponding relations, generating mask sets of the picture materials, and processing the text parts of the picture materials by using an image restoration algorithm according to the mask sets of the picture materials to obtain restored picture materials; if the average gray value corresponding to the character area after the expansion operation is larger, judging that the expanded background part is a bright area, and the bright area corresponds to the background part and the dark area corresponds to the character part; if the average gray value corresponding to the character area after the corrosion operation is larger, judging that the corroded background part is a dark area, and corresponding the dark area to the background part and corresponding the bright area to the character part; if the average gray value of the character area corresponding to the character area after the expansion operation is smaller, judging that the expanded background part is a dark part, and the bright area corresponds to the character part, and the dark area corresponds to the background part; The receiving unit is used for receiving the repaired picture material; And the releasing unit is used for releasing the repaired picture materials into the resource bits of different service scenes if the repaired picture materials meet the resource releasing conditions.

Description

Picture material processing method, device and equipment Technical Field The present application relates to the field of image processing technologies, and in particular, to a method, an apparatus, and a device for processing a picture material. Background With the continuous development of the internet industry, more and more users choose to perform resource interaction on a network platform, in the resource interaction scene of many online network platforms, a server needs to upload a large amount of picture materials around resources, and for the server, the quality of the picture materials greatly influences the click rate of the users. In general, the quality of the picture material provided by the service side is often uneven, and no matter the picture material is beautified or applied to other resource positions, a series of processing is always required to be carried out on the character marks in the picture material before the picture material is put into production and used. In the related art, the processing mode of the picture material mainly depends on manual work, and the picture material meeting the requirements of a platform can be obtained after the character marks in the picture material are erased through a drawing tool. However, the mode of erasing the character marks through the drawing tool needs to identify the appointed character area, is influenced by the edge pixel points in the picture material, and has a certain error in the identification process of the appointed character area, so that the accuracy of erasing the character marks is influenced, and the processing effect of the picture material is not ideal. Disclosure of Invention In view of this, the present application provides a method, an apparatus and a device for processing a picture material, and mainly aims to solve the problem that in the prior art, a way of erasing a character print by using a drawing tool has a certain error in the process of identifying a designated character area, which affects the accuracy of erasing the character print, and results in an unsatisfactory processing effect of the picture material. According to a first aspect of the present application, there is provided a method for processing picture material, applied to a service platform, the method comprising: receiving a picture material, and acquiring a text region in the picture material; generating a mask for a text region in the picture material, and dividing the text region into a bright region and a dark region by using an average gray value of the text region, wherein the bright region and the dark region respectively correspond to a text part and a background part; identifying the corresponding relation between the bright area and the dark area in the text area and the text part and the background part respectively, and combining masks of all the text areas in the picture material by utilizing the corresponding relation to generate a mask set of the picture material; And processing the text part of the picture material by using an image restoration algorithm according to the mask set of the picture material to obtain the restored picture material. Further, the receiving the picture material and obtaining the text region in the picture material includes: receiving a picture material, and preprocessing the picture material, wherein the preprocessing at least comprises picture channel conversion processing and gray scale processing; And determining the vertex coordinates of an original text region from the preprocessed picture material by using a text recognition technology, and performing edge expansion processing on the boundary of the original text region according to the vertex coordinates of the original text region to obtain the text region in the picture material. Further, the generating a mask for a text region in the picture material, dividing the text region into a bright region and a dark region using an average gray value of the text region, includes: Generating a mask through a rectangular frame aiming at a text region in the picture material, so that the inside of the rectangular frame and the outside of pixels of the rectangular frame have different filling values; and calculating an average gray value of a text region according to the gray value corresponding to the mask and the picture material, and dividing the text region into a bright region and a dark region by using the average gray value, wherein the bright region and the dark region respectively correspond to a text part and a background part. Further, the calculating an average gray value of the text area according to the gray value corresponding to the mask and the picture material, and dividing the text area into a bright area and a dark area by using the average gray value includes: multiplying the mask by the gray value corresponding to the picture material to obtain the gray value corresponding to the text region in the picture material, and calculating the ave