The invention discloses a
morphological gradient region
replacement method based on SAM semantic segmentation and user guidance, and relates to the technical field of
computer vision and
image processing, and the method comprises the steps: carrying out the semantic segmentation of a to-be-processed image through an SAM model, extracting a multi-level
semantic feature, carrying out the
standardization and dimension reduction, extracting a causal factor based on
independent component analysis, and carrying out the user guidance. A directed causal factor association graph is generated through Granger causal relationship test, and a causal attribution probability graph is generated through
reverse mapping; constructing a structured causal graph, and generating a causal
mask through a graph convolutional network; encoding the original interaction
signal into a guide thermodynamic diagram; constructing a
diffusion equation, forming a gradual
change control equation by dynamically fusing and guiding the intensity distribution of the thermodynamic diagram and an image semantic
diffusion item, and iteratively solving the gradual
change control equation; generating an anisotropic morphological operation kernel according to the geometric curvature characteristics of each region in the replacement
mask; and fusing the optimized replacement
mask with the target content based on a gradient domain optimization
algorithm to generate a gradient replacement image.