Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Remove people or other contents from an image
ResourceFunction["ImageContentsRemove"][img] removes people from the image img. | |
ResourceFunction["ImageContentsRemove"][img,class] removes contents matching class from image img. | |
ResourceFunction["ImageContentsRemove"][img,{class1,class2,…}] removes contents matching any of the classes from image img. |
"MaskDilation" | 3 | number of pixels to include around the content to Inpaint |
TargetDevice | "CPU" | the target device on which to perform evaluation |
Remove a person from an image:
In[1]:= |
Out[1]= |
Use the second argument to decide which contents to remove. The choices available are "Airplane", "Bicycle", "Bird", "Boat", "Bottle", "Bus", "Car", "Cat", "Chair", "Cow", "Table", "Dog", "Horse", "Motorcycle", "Person", "Plant", "Sheep", "Sofa", "Train" and "Television":
In[2]:= |
Out[2]= |
If content detection is not accurate enough, artifacts of the removed content may persist:
In[3]:= |
Out[3]= |
"MaskDilation" allows you to increase the size of the Inpaint area:
In[4]:= |
Out[4]= |
Evaluate using the system's default GPU (if available):
In[5]:= |
In[6]:= |
Out[6]= |
Compare to CPU evaluation:
In[7]:= |
Out[7]= |
When the content to be removed is a large fraction of the image, ImageContentsRemove may produce unrealistic contents:
In[8]:= |
Out[8]= |
Use a different inpainting Method:
In[9]:= |
Out[9]= |
This work is licensed under a Creative Commons Attribution 4.0 International License