GraphCutMaskingOptions Sınıfı

Summary: The GraphCut auto masking options.

Module: aspose.imaging.masking.options

Full Name: aspose.imaging.masking.options.GraphCutMaskingOptions

Inheritance: MaskingOptions

Constructors

NameAçıklama
GraphCutMaskingOptions()GraphCutMaskingOptions sınıfının yeni bir örneğini başlatır

Properties

NameTypeAccessAçıklama
BACKGROUND_OBJECT_NUMBER [static]intrArka plan nesnesi numarası
argsIMaskingArgsr/wSegmentasyon algoritması için argümanları alır veya ayarlar.
background_replacement_colorColorr/wArka plan değiştirme rengini alır veya ayarlar.
parçalaboolr/wHer şeklin maskeden ayrı bir nesne olarak mı yoksa arka plandan ayrılmış birleşik bir nesne olarak mı ayrılması gerektiğini gösteren bir değeri alır veya ayarlar.
export_optionsImageOptionsBaser/wGörüntü dışa aktarma seçeneklerini alır veya ayarlar.
feathering_radiusintr/wTüyleme yarıçapını alır veya ayarlar.
masking_areaRectangler/wMaskeleme alanını alır veya ayarlar.
methodSegmentationMethodr/wSegmentasyon yöntemini alır veya ayarlar.

Constructor: GraphCutMaskingOptions()

 GraphCutMaskingOptions() 

GraphCutMaskingOptions sınıfının yeni bir örneğini başlatır

Property: feathering_radius

Tüyleme yarıçapını alır veya ayarlar.

See also:

Example # 1: Saving Graph Cut image masking result with feathering set to 3. Image masking…

Examples

Saving Graph Cut image masking result with feathering set to 3. Image masking is performed using specified Point array.


import aspose.pycore as aspycore
from aspose.imaging import Image, Color, RasterImage
from aspose.imaging.masking.options import AutoMaskingArgs, GraphCutMaskingOptions, SegmentationMethod
from aspose.imaging.sources import FileCreateSource
from aspose.imaging.imageoptions import PngOptions
from aspose.imaging.fileformats.png import PngColorType


with aspycore.as_of(Image.load("input.jpg"), RasterImage) as image:
	obj_init = PngOptions()
	obj_init.color_type = PngColorType.TRUECOLOR_WITH_ALPHA
	obj_init.source = FileCreateSource("tempFile")
	obj_init2 = AutoMaskingArgs()
	obj_init2.objects_points = [[Point(100, 100)]]
	
	options = GraphCutMaskingOptions()
	options.feathering_radius = 3
	options.method = SegmentationMethod.GRAPH_CUT
	options.decompose = False
	options.export_options = obj_init
	options.background_replacement_color = Color.transparent
	options.args = obj_init2
	
	results = ImageMasking(image).decompose(options)

with aspycore.as_of(results[1].get_image(), RasterImage) as result_image:
	obj_init4 = PngOptions()
	obj_init4.color_type = PngColorType.TRUECOLOR_WITH_ALPHA
	result_image.save("output.png", obj_init4)
	
# tüm alt görüntüleri serbest bırak
for it in results:
	with it as _:
		pass