Search

CN-121981917-A - Image shadow eliminating method

CN121981917ACN 121981917 ACN121981917 ACN 121981917ACN-121981917-A

Abstract

The invention discloses an image shadow eliminating method, which relates to the technical field of digital image processing and comprises the following steps of S1, S2, analyzing an original image to be processed, judging whether a shadow area exists in the original image, S3, analyzing the shadow area in detail to determine shadow characteristics at least comprising color characteristics and uniformity characteristics if the shadow area exists, S4, calculating the distribution condition of the shadow area in the image, S5, matching a target processing scheme from a plurality of preset shadow processing schemes according to the shadow characteristics and the distribution condition, S6, calculating adjustment parameters for all positions in the shadow area according to the shadow characteristics, the distribution condition and the target processing scheme, and S7, processing the shadow area in the original image according to the target processing scheme and the adjustment parameters to eliminate shadows and output the processed image.

Inventors

  • LI JUNQING

Assignees

  • 深圳市腾鸿建筑设计咨询有限公司

Dates

Publication Date
20260505
Application Date
20260109

Claims (10)

  1. 1. An image shadow eliminating method, characterized by comprising the steps of: S1, acquiring an original image to be processed; S2, analyzing the original image and judging whether a shadow area exists in the original image; s3, if a shadow area exists, carrying out detailed analysis on the shadow area, and determining shadow characteristics at least comprising color characteristics and uniformity characteristics; s4, calculating the distribution condition of the shadow area in the image; s5, matching a target processing scheme from a plurality of preset shadow processing schemes according to the shadow characteristics and the distribution conditions; S6, calculating adjustment parameters for each position in the shadow area according to the shadow characteristics, the distribution condition and the target processing scheme; S7, processing the shadow area in the original image according to the target processing scheme and the adjustment parameters so as to eliminate shadows, and outputting the processed image.
  2. 2. The image shadow elimination method according to claim 1, wherein in step S3, the detailed analysis further includes determining texture features of the shadow; the shadow feature is used to distinguish between soft shadows and hard shadows.
  3. 3. The image shading removal method according to claim 1 or 2, wherein in step S4, the calculating the distribution condition includes: The boundaries of the shadow regions are identified and their distribution pattern is determined to be at least one of a single point, a continuous region, or a discrete distribution region.
  4. 4. The image shading method according to claim 3, wherein in step S5, the preset shading scheme comprises a combination of algorithms associated with different shading uniformity levels and different distribution morphologies.
  5. 5. The image shading removal method according to claim 1, wherein in step S6, the calculating adjustment parameters includes: and respectively calculating brightness compensation coefficients and/or color correction offset according to local shadow characteristics of the sub-areas or pixels in the shadow area serving as units.
  6. 6. The image shading removal method according to claim 5, wherein in step S6, for shading determined as a continuous area, a spatial smoothing constraint is introduced in calculating adjustment parameters for each position so that adjustment parameters for adjacent positions are continuously transitioned.
  7. 7. The image shadow removal method of claim 1, wherein in step S7, the processing the shadow region in the original image includes: performing progressive image processing operation on the shadow area according to the shadow uniformity characteristics determined in the step S3; wherein, for the shadow area with uniformity higher than a preset threshold value, adopting integral parameter adjustment; And for the shadow area with uniformity lower than a preset threshold value, adopting a processing mode of gradually adjusting parameters from the shadow center to the edge.
  8. 8. The image shadow removal method of claim 1, further comprising, prior to step S2, a step of preprocessing the original image, the preprocessing including at least one of noise reduction and contrast enhancement.
  9. 9. The image shadow removal method of claim 1, further comprising, after step S7, a step of post-processing the processed image, the post-processing including at least one of edge smoothing and color consistency checking.
  10. 10. The image shadow removal method of claim 1, wherein in step S2, whether a shadow area exists is judged by analyzing an overall luminance histogram feature of the image or detecting whether there is a large-area connected area having a significantly lower luminance than the periphery.

Description

Image shadow eliminating method Technical Field The invention relates to the technical field of digital image processing, in particular to an image shadow eliminating method. Background In the processes of daily office work, archives digitization and mobile terminal information acquisition, when a scanner or a camera is used for acquiring document and certificate images, local shadows appear in the images due to factors such as light source angles, object shielding or uneven ambient light. These shadows not only affect visual effects, but can also seriously interfere with subsequent automated analysis, such as Optical Character Recognition (OCR), key information extraction, and the like. The existing shadow processing methods are mainly divided into two types, namely a method based on a physical model and traditional image processing, such as illumination compensation by utilizing Retinex theory, homomorphic filtering and the like, and a method based on depth learning, wherein the mapping from shadow images to non-shadow images is learned by training a large amount of data. The method has the advantages that the method is low in calculation amount, limited in processing effect on complex shadows such as texture shadows and soft and hard shadows, parameters often need to be manually adjusted, adaptability is poor, and the method is good in effect, depends on a large-scale annotation data set and strong calculation resources, is high in model deployment cost, and is difficult to apply to embedded equipment or scenes with high requirements on real-time performance. Disclosure of Invention The invention aims to provide an image shadow eliminating method which can solve the problems of insufficient self-adaptive capacity, complex calculation or dependence on big data in the prior art. In order to solve the technical problems, the invention adopts the following technical scheme: An image shadow elimination method, comprising the steps of: S1, acquiring an original image to be processed; S2, analyzing the original image and judging whether a shadow area exists in the original image; s3, if a shadow area exists, carrying out detailed analysis on the shadow area, and determining shadow characteristics at least comprising color characteristics and uniformity characteristics; s4, calculating the distribution condition of the shadow area in the image; s5, matching a target processing scheme from a plurality of preset shadow processing schemes according to the shadow characteristics and the distribution conditions; S6, calculating adjustment parameters for each position in the shadow area according to the shadow characteristics, the distribution condition and the target processing scheme; S7, processing the shadow area in the original image according to the target processing scheme and the adjustment parameters so as to eliminate shadows, and outputting the processed image. Preferably, in step S3, the detailed analysis further includes determining texture features of shadows; the shadow feature is used to distinguish between soft shadows and hard shadows. Preferably, in step S4, the calculating the distribution condition includes: The boundaries of the shadow regions are identified and their distribution pattern is determined to be at least one of a single point, a continuous region, or a discrete distribution region. Preferably, in step S5, the preset shade processing scheme includes algorithm combinations associated with different shade uniformity degrees and different distribution forms. Preferably, in step S6, the calculating the adjustment parameter includes: and respectively calculating brightness compensation coefficients and/or color correction offset according to local shadow characteristics of the sub-areas or pixels in the shadow area serving as units. Preferably, in step S6, for the shadows determined as continuous areas, a spatial smoothing constraint is introduced in calculating the adjustment parameters for each position so that the adjustment parameters for adjacent positions are continuously transitioned. Preferably, in step S7, the processing the shadow area in the original image includes: performing progressive image processing operation on the shadow area according to the shadow uniformity characteristics determined in the step S3; wherein, for the shadow area with uniformity higher than a preset threshold value, adopting integral parameter adjustment; And for the shadow area with uniformity lower than a preset threshold value, adopting a processing mode of gradually adjusting parameters from the shadow center to the edge. Preferably, before step S2, a step of preprocessing the original image is further included, the preprocessing including at least one of noise reduction and contrast enhancement. Preferably, after step S7, a step of post-processing the processed image is further included, the post-processing including at least one of edge smoothing and color consistency checking. Preferably, in step