Remove background from images in Java

Auto Masking

Using Graph Cut auto masking with feathering

The following example demonstrates saving of the image masking results with feathering based on image size. Image masking is performed using auto calculated default strokes. The Args property of AutoMaskingGraphCutOptions can be omitted since default strokes are placed there in the end.

Re-using default strokes in repeated auto masking with new points

The following example demonstrates saving of the image masking results with feathering based on image size and re-using masking options for the new masking iteration. Image masking is performed using auto calculated default strokes. Additionally, the data of the two assumed objects are also specified in the AssumedObjects property of the AutoMaskingGraphCutOptions. After getting the initial masking results, applied background/foreground strokes are modified and another masking iteration is performed.

Using Graph Cut auto masking with specified assumed objects data

The following example demonstrates saving of the image masking results with feathering based on image size. Image masking is performed using auto calculated default strokes. Additionally, the data of the two assumed objects are also specified in the AssumedObjects property of the AutoMaskingGraphCutOptions.

Performing Graph Cut segmentation with user-defined point and feathering radius

The following example demonstrates saving of the Graph Cut image masking result with feathering set to 3. Image masking is performed using the user-defined Point array.

The following code snippet provided below demonstrates how to apply auto masking to a raster image.

Manual Masking

The following code snippet provided below demonstrates how to apply manual masking to a raster image.