Class AssumedObjectData
이름 공간 : Aspose.Imaging.Masking.Options 모임: Aspose.Imaging.dll (25.4.0)
가정된 개체의 데이터 : 개체의 유형과 영역을 포함합니다.
public class AssumedObjectData
Inheritance
상속 회원들
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
이미지 마스크 결과를 저장하여 이미지 크기에 기초한 페테레이션으로. 이미지 마스크는 자동으로 계산된 기본 충격을 사용하여 수행됩니다. 또한 두 개의 가정된 개체의 데이터는 AutoMaskingGraphCutOptions의 AssumedObjects 속성에서도 지정됩니다.
List<assumedobjectdata> assumedObjects = new List<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;
using (RasterImage image = (RasterImage)Image.Load("input.jpg"))
{
AutoMaskingGraphCutOptions options = new AutoMaskingGraphCutOptions
{
AssumedObjects = assumedObjects,
CalculateDefaultStrokes = true,
FeatheringRadius = (Math.Max(image.Width, image.Height) / 500) + 1,
Method = SegmentationMethod.GraphCut,
Decompose = false,
ExportOptions =
new PngOptions()
{
ColorType = PngColorType.TruecolorWithAlpha,
Source = new FileCreateSource("tempFile")
},
BackgroundReplacementColor = Color.Transparent
};
results = new ImageMasking(image).Decompose(options);
}
using (RasterImage resultImage = (RasterImage)results[1].GetImage())
{
resultImage.Save("output.png", new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
}</assumedobjectdata></assumedobjectdata>
이미지 마스크 결과는 이미지 크기에 기초한 마스크와 새 마스크 이테라션을위한 마스크 옵션을 다시 사용합니다. 이미지 마스크는 자동으로 계산 된 기본 마스크를 사용하여 수행됩니다. 또한 두 개의 가정된 개체의 데이터는 또한 AutoMaskingGraphCutOptions의 AssumedObjects 속성에 지정됩니다. 초기 마스크 결과를 얻은 후에, 적용 된 배경 / 전구 마스크가 수정되고 또 다른 마스크 이테라션이 수행됩니다.
List<assumedobjectdata> assumedObjects = new List<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;
AutoMaskingGraphCutOptions options;
using (RasterImage image = (RasterImage)Image.Load("input.jpg"))
{
options = new AutoMaskingGraphCutOptions
{
AssumedObjects = assumedObjects,
CalculateDefaultStrokes = true,
FeatheringRadius = 3,
Method = SegmentationMethod.GraphCut,
Decompose = false,
ExportOptions =
new PngOptions()
{
ColorType = PngColorType.TruecolorWithAlpha,
Source = new FileCreateSource("tempFile")
},
BackgroundReplacementColor = Color.Transparent
};
results = new ImageMasking(image).Decompose(options);
}
// At this point applied foreground/background strokes can be analyzed and based on it additional
// foreground/background strokes can be manually provided.
Point[] appliedBackgroundStrokes = options.DefaultBackgroundStrokes;
Point[] appliedForegroundStrokes = options.DefaultForegroundStrokes;
Rectangle[] appliedObjectRectangles = options.DefaultObjectsRectangles;
using (RasterImage resultImage = (RasterImage)results[1].GetImage())
{
resultImage.Save("output.png", new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
}
using (RasterImage image = (RasterImage)Image.Load("input.jpg"))
{
// Re-using AutoMaskingGraphCutOptions there is no need to perform default strokes calculations second time.
options.CalculateDefaultStrokes = false;
// When both default strokes and ObjectsPoints in the Args property of AutoMaskingArgs are provided, Point arrays are end up combined.
// The first ObjectsPoints array is considered to be a background points array and
// the second ObjectsPoints array is considered to be a foreground points array.
// When both DefaultObjectsRectangles and ObjectsRectangles in the Args property of AutoMaskingArgs are provided,
// only the array from the Args is being used.
options.Args = new AutoMaskingArgs()
{
ObjectsPoints = new Point[][]
{
new Point[] { new Point(100, 100), new Point(150, 100) },
new Point[] { new Point(500, 200) },
},
ObjectsRectangles = new Rectangle[]
{
new Rectangle(100, 100, 300, 300),
}
};
results = new ImageMasking(image).Decompose(options);
}
using (RasterImage resultImage = (RasterImage)results[1].GetImage())
{
resultImage.Save("output.png", new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
}</assumedobjectdata></assumedobjectdata>
이미지 크기에 기초한 마스크 결과를 저장하고, 얻은 기본 충격을 수정하고 새로운 마스크 이테라션을 위해 사용합니다. 이미지 마스크는 자동으로 계산 된 기본 충격을 사용하여 수행됩니다. 또한 두 개의 가정된 개체의 데이터는 또한 AutoMaskingGraphCutOptions의 AssumedObjects 속성에 지정됩니다. 초기 마스크 결과를 얻은 후에, 적용 된 배경 / 전구 충격을 수정하고 새로운 GraphCutMaskingOptions를 사용하여 또 다른 마스크 이테라션이 수행됩니다.
List<assumedobjectdata> assumedObjects = new List<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;
AutoMaskingGraphCutOptions options;
using (RasterImage image = (RasterImage)Image.Load("input.jpg"))
{
options = new AutoMaskingGraphCutOptions
{
AssumedObjects = assumedObjects,
CalculateDefaultStrokes = true,
FeatheringRadius = 3,
Method = SegmentationMethod.GraphCut,
Decompose = false,
ExportOptions =
new PngOptions()
{
ColorType = PngColorType.TruecolorWithAlpha,
Source = new FileCreateSource("tempFile")
},
BackgroundReplacementColor = Color.Transparent
};
results = new ImageMasking(image).Decompose(options);
}
// At this point applied foreground/background strokes can be analyzed and based on it additional
// foreground/background strokes can be manually provided.
Point[] appliedBackgroundStrokes = options.DefaultBackgroundStrokes;
Point[] appliedForegroundStrokes = options.DefaultForegroundStrokes;
Rectangle[] appliedObjectRectangles = options.DefaultObjectsRectangles;
using (RasterImage resultImage = (RasterImage)results[1].GetImage())
{
resultImage.Save("output.png", new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
}
appliedBackgroundStrokes[5] = new Point(100, 100);
appliedBackgroundStrokes[15] = new Point(150, 100);
appliedForegroundStrokes[1] = new Point(500, 200);
appliedObjectRectangles[0] = new Rectangle(100, 100, 300, 300);
using (RasterImage image = (RasterImage)Image.Load("input.jpg"))
{
GraphCutMaskingOptions graphCutOptions = new GraphCutMaskingOptions()
{
FeatheringRadius = 3,
Method = SegmentationMethod.GraphCut,
Decompose = false,
ExportOptions = new PngOptions()
{
ColorType = PngColorType.TruecolorWithAlpha,
Source = new FileCreateSource("tempFile")
},
BackgroundReplacementColor = Color.Transparent,
Args = new AutoMaskingArgs()
{
ObjectsPoints = new Point[][]
{
appliedBackgroundStrokes,
appliedForegroundStrokes
},
ObjectsRectangles = appliedObjectRectangles
}
};
results = new ImageMasking(image).Decompose(graphCutOptions);
}
using (RasterImage resultImage = (RasterImage)results[1].GetImage())
{
resultImage.Save("output.png", new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
}</assumedobjectdata></assumedobjectdata>
Constructors
AssumedObjectData()
Aspose.Imaging.Masking.Options.AssumedObjectData 클래스의 새로운 예를 시작합니다.
public AssumedObjectData()
AssumedObjectData(탐지, 탐지 탐지)
Aspose.Imaging.Masking.Options.AssumedObjectData 클래스의 새로운 예를 시작합니다.
public AssumedObjectData(DetectedObjectType type, Rectangle bounds)
Parameters
type
DetectedObjectType
개체의 종류를 말한다.
bounds
Rectangle
개체의 한계를 둔다.
Examples
이미지 마스크 결과를 저장하여 이미지 크기에 기초한 페테레이션으로. 이미지 마스크는 자동으로 계산된 기본 충격을 사용하여 수행됩니다. 또한 두 개의 가정된 개체의 데이터는 AutoMaskingGraphCutOptions의 AssumedObjects 속성에서도 지정됩니다.
List<assumedobjectdata> assumedObjects = new List<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;
using (RasterImage image = (RasterImage)Image.Load("input.jpg"))
{
AutoMaskingGraphCutOptions options = new AutoMaskingGraphCutOptions
{
AssumedObjects = assumedObjects,
CalculateDefaultStrokes = true,
FeatheringRadius = (Math.Max(image.Width, image.Height) / 500) + 1,
Method = SegmentationMethod.GraphCut,
Decompose = false,
ExportOptions =
new PngOptions()
{
ColorType = PngColorType.TruecolorWithAlpha,
Source = new FileCreateSource("tempFile")
},
BackgroundReplacementColor = Color.Transparent
};
results = new ImageMasking(image).Decompose(options);
}
using (RasterImage resultImage = (RasterImage)results[1].GetImage())
{
resultImage.Save("output.png", new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
}</assumedobjectdata></assumedobjectdata>
이미지 마스크 결과는 이미지 크기에 기초한 마스크와 새 마스크 이테라션을위한 마스크 옵션을 다시 사용합니다. 이미지 마스크는 자동으로 계산 된 기본 마스크를 사용하여 수행됩니다. 또한 두 개의 가정된 개체의 데이터는 또한 AutoMaskingGraphCutOptions의 AssumedObjects 속성에 지정됩니다. 초기 마스크 결과를 얻은 후에, 적용 된 배경 / 전구 마스크가 수정되고 또 다른 마스크 이테라션이 수행됩니다.
List<assumedobjectdata> assumedObjects = new List<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;
AutoMaskingGraphCutOptions options;
using (RasterImage image = (RasterImage)Image.Load("input.jpg"))
{
options = new AutoMaskingGraphCutOptions
{
AssumedObjects = assumedObjects,
CalculateDefaultStrokes = true,
FeatheringRadius = 3,
Method = SegmentationMethod.GraphCut,
Decompose = false,
ExportOptions =
new PngOptions()
{
ColorType = PngColorType.TruecolorWithAlpha,
Source = new FileCreateSource("tempFile")
},
BackgroundReplacementColor = Color.Transparent
};
results = new ImageMasking(image).Decompose(options);
}
// At this point applied foreground/background strokes can be analyzed and based on it additional
// foreground/background strokes can be manually provided.
Point[] appliedBackgroundStrokes = options.DefaultBackgroundStrokes;
Point[] appliedForegroundStrokes = options.DefaultForegroundStrokes;
Rectangle[] appliedObjectRectangles = options.DefaultObjectsRectangles;
using (RasterImage resultImage = (RasterImage)results[1].GetImage())
{
resultImage.Save("output.png", new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
}
using (RasterImage image = (RasterImage)Image.Load("input.jpg"))
{
// Re-using AutoMaskingGraphCutOptions there is no need to perform default strokes calculations second time.
options.CalculateDefaultStrokes = false;
// When both default strokes and ObjectsPoints in the Args property of AutoMaskingArgs are provided, Point arrays are end up combined.
// The first ObjectsPoints array is considered to be a background points array and
// the second ObjectsPoints array is considered to be a foreground points array.
// When both DefaultObjectsRectangles and ObjectsRectangles in the Args property of AutoMaskingArgs are provided,
// only the array from the Args is being used.
options.Args = new AutoMaskingArgs()
{
ObjectsPoints = new Point[][]
{
new Point[] { new Point(100, 100), new Point(150, 100) },
new Point[] { new Point(500, 200) },
},
ObjectsRectangles = new Rectangle[]
{
new Rectangle(100, 100, 300, 300),
}
};
results = new ImageMasking(image).Decompose(options);
}
using (RasterImage resultImage = (RasterImage)results[1].GetImage())
{
resultImage.Save("output.png", new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
}</assumedobjectdata></assumedobjectdata>
이미지 크기에 기초한 마스크 결과를 저장하고, 얻은 기본 충격을 수정하고 새로운 마스크 이테라션을 위해 사용합니다. 이미지 마스크는 자동으로 계산 된 기본 충격을 사용하여 수행됩니다. 또한 두 개의 가정된 개체의 데이터는 또한 AutoMaskingGraphCutOptions의 AssumedObjects 속성에 지정됩니다. 초기 마스크 결과를 얻은 후에, 적용 된 배경 / 전구 충격을 수정하고 새로운 GraphCutMaskingOptions를 사용하여 또 다른 마스크 이테라션이 수행됩니다.
List<assumedobjectdata> assumedObjects = new List<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;
AutoMaskingGraphCutOptions options;
using (RasterImage image = (RasterImage)Image.Load("input.jpg"))
{
options = new AutoMaskingGraphCutOptions
{
AssumedObjects = assumedObjects,
CalculateDefaultStrokes = true,
FeatheringRadius = 3,
Method = SegmentationMethod.GraphCut,
Decompose = false,
ExportOptions =
new PngOptions()
{
ColorType = PngColorType.TruecolorWithAlpha,
Source = new FileCreateSource("tempFile")
},
BackgroundReplacementColor = Color.Transparent
};
results = new ImageMasking(image).Decompose(options);
}
// At this point applied foreground/background strokes can be analyzed and based on it additional
// foreground/background strokes can be manually provided.
Point[] appliedBackgroundStrokes = options.DefaultBackgroundStrokes;
Point[] appliedForegroundStrokes = options.DefaultForegroundStrokes;
Rectangle[] appliedObjectRectangles = options.DefaultObjectsRectangles;
using (RasterImage resultImage = (RasterImage)results[1].GetImage())
{
resultImage.Save("output.png", new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
}
appliedBackgroundStrokes[5] = new Point(100, 100);
appliedBackgroundStrokes[15] = new Point(150, 100);
appliedForegroundStrokes[1] = new Point(500, 200);
appliedObjectRectangles[0] = new Rectangle(100, 100, 300, 300);
using (RasterImage image = (RasterImage)Image.Load("input.jpg"))
{
GraphCutMaskingOptions graphCutOptions = new GraphCutMaskingOptions()
{
FeatheringRadius = 3,
Method = SegmentationMethod.GraphCut,
Decompose = false,
ExportOptions = new PngOptions()
{
ColorType = PngColorType.TruecolorWithAlpha,
Source = new FileCreateSource("tempFile")
},
BackgroundReplacementColor = Color.Transparent,
Args = new AutoMaskingArgs()
{
ObjectsPoints = new Point[][]
{
appliedBackgroundStrokes,
appliedForegroundStrokes
},
ObjectsRectangles = appliedObjectRectangles
}
};
results = new ImageMasking(image).Decompose(graphCutOptions);
}
using (RasterImage resultImage = (RasterImage)results[1].GetImage())
{
resultImage.Save("output.png", new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
}</assumedobjectdata></assumedobjectdata>
AssumedObjectData(링크, 링크)
Aspose.Imaging.Masking.Options.AssumedObjectData 클래스의 새로운 예를 시작합니다.
public AssumedObjectData(string type, Rectangle bounds)
Parameters
type
string
개체의 종류를 말한다.
bounds
Rectangle
개체의 한계를 둔다.
Properties
Bounds
개체의 경계를 얻거나 설정합니다.
public Rectangle Bounds { get; set; }
부동산 가치
Type
개체의 유형을 얻거나 설정합니다.
public DetectedObjectType Type { get; set; }