public final class DetectedObjectType
extends com.aspose.ms.System.Enum
The detected object types enumeration.
Saving image masking result with feathering based on image size. Image masking is performed using auto calculated default strokes. Additionally the data of the two assumed objects is also specified in the AssumedObjects property of the AutoMaskingGraphCutOptions.
List<AssumedObjectData> assumedObjects = new LinkedList<AssumedObjectData>(); assumedObjects.add(new AssumedObjectData(DetectedObjectType.Human, new Rectangle(100, 100, 150, 300))); assumedObjects.add(new AssumedObjectData(DetectedObjectType.Dog, new Rectangle(300, 100, 50, 30))); MaskingResult[] results; try (RasterImage image = (RasterImage)Image.load("input.jpg")) { try (PngOptions pngOptions = new PngOptions()) { pngOptions.setColorType(PngColorType.TruecolorWithAlpha); pngOptions.setSource(new FileCreateSource("tempFile")); AutoMaskingGraphCutOptions options = new AutoMaskingGraphCutOptions(); options.setAssumedObjects(assumedObjects); options.setCalculateDefaultStrokes(true); options.setFeatheringRadius((Math.max(image.getWidth(), image.getHeight()) / 500) + 1); options.setMethod(SegmentationMethod.GraphCut); options.setDecompose(false); options.setExportOptions(pngOptions); options.setBackgroundReplacementColor(Color.getTransparent()); results = new ImageMasking(image).decompose(options); } } try (RasterImage resultImage = (RasterImage)results[1].getImage()) { PngOptions pngOptions = new PngOptions(); pngOptions.setColorType(PngColorType.TruecolorWithAlpha); resultImage.save("output.png", pngOptions); } // release resources for (MaskingResult res : results) { res.close(); }
Modifier and Type | Field and Description |
---|---|
static int |
Backpack
The backpack object type.
|
static int |
Bottle
The bottle object type.
|
static int |
Bowl
The bowl object type.
|
static int |
Dog
The dog object type.
|
static int |
Human
The human object type.
|
static int |
Orange
The orange object type.
|
static int |
Other
Other object type.
|
static int |
SportsBall
The sports ball object type.
|
static int |
Tie
The tie object type.
|
static int |
TV
The TV object type.
|
static int |
Umbrella
The umbrella object type.
|
static int |
Vase
The vase object type.
|
Clone, CloneTo, format, format, get_Caption, get_Value, getName, getName, getNames, getNames, getNames, getUnderlyingType, getUnderlyingType, getValue, getValues, getValues, getValues, isDefined, isDefined, isDefined, isDefined, parse, parse, parse, parse, register, toObject, toString
public static final int Backpack
The backpack object type.
public static final int Bottle
The bottle object type.
public static final int Bowl
The bowl object type.
public static final int Dog
The dog object type.
public static final int Human
The human object type.
public static final int Orange
The orange object type.
public static final int SportsBall
The sports ball object type.
public static final int Tie
The tie object type.
public static final int TV
The TV object type.
public static final int Umbrella
The umbrella object type.
public static final int Vase
The vase object type.
public static final int Other
Other object type.
Copyright (c) 2008-2020 Aspose Pty Ltd. All Rights Reserved.