Eyeon:Script/Reference/Applications/Fuse/Classes/Image/ErodeDilate

From VFXPedia

Jump to: navigation, search

Contents


Summary

The ErodeDilate function will apply an erode or dilate process to the image. The function returns a new image containing the results of the operation. Alternatively, if the first argument specifies an already existing image object, then the results will be copied into that image instead. This function requires Fusion 7.0 or later.


Usage

Image:ErodeDilate(image dest_image, table options)

dest_image (image, optional)
The image object where the results of the erode/dilate will be applied. If none is provided, a new image will be created.
options (table, required)
A table containing values which describe the various options available for the erode/dilate. See the attributes below.


Options Table

ErDl_AmountX, ErDl_AmountY
These tags specify the strength of the operation along the X and Y axis, respectively. Negative values will produce an erode operation, and positive values will produce a dilate operation. A value of 1 represents an operation equal to the width of the image.
ErDl_Filter
The filter is a string which represents the 'shape' of the effect. Valid options are :
  • "Box"
  • "Linear"
  • "Gaussian"
  • "Circle"
The circle type requires that ErDl_AmountX and ErDl_AmountY are either both positive or both negative.
ErDl_Red, ErDl_Green, ErDl_Blue, ErDl_Alpha
These four tags are used to indicate which channels of the image to affect. A value of true enables the operation for the channel. A value of false disables it. The default behaviour if this tag is not specified is true.


Example

FuRegisterClass("ErodeDilateTest", CT_Tool, {
	REGS_Category = "Fuses",
	REGS_OpIconString = "ErDlT",
	REGS_OpDescription = "ErodeDilate Test Fuse",
	REG_OpNoMask = false,
	REG_NoBlendCtrls = false,
	REG_NoObjMatCtrls = false,
	REG_NoMotionBlurCtrls = false,
	})
 
function Create()
	InAmount = self:AddInput("Amount", "Amount", {
		LINKID_DataType = "Number",
		INPID_InputControl = "SliderControl",
		INP_MinScale = -10.0,
		INP_MaxScale = 10.0,
		INP_Default = 0.0,
		})			
	InImage = self:AddInput("Input", "Input", {
		LINKID_DataType = "Image",
		LINK_Main = 1,
		})
	OutImage = self:AddOutput("Output", "Output", {
		LINKID_DataType = "Image",
		LINK_Main = 1,
		})				
end
 
function Process(req) 
	local img = InImage:GetValue(req)
	local amount = InAmount:GetValue(req).Value
	local result = Image({IMG_Like = img})
	
	img:ErodeDilate(result, {
		ErDl_Filter = "Box", 
		ErDl_Red = true,
		ErDl_Green = true,
		ErDl_Blue = true,
		ErDl_Alpha = true,
		ErDl_AmountX = amount/img.OriginalWidth, 
		ErDl_AmountY = amount/img.OriginalWidth,
		})
	
	OutImage:Set(req, result)
end


Tips for ErodeDilate (edit)

EyeonTips:Script/Reference/Applications/Fuse/Classes/Image/ErodeDilate