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

From VFXPedia

< Eyeon:Script | Reference | Applications | Fuse | Classes | Image
Revision as of 00:48, 16 September 2014 by Stuart (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents


Summary

The Blur function will blur the image. The function returns a new image containing the results of the blur. Alternatively, if the first argument specifies an already existing image object, then the results will be copied into that image instead.


Usage

Image:Blur(image dest_image, table options)

dest_image (image, optional)
The image object where the results of the blur 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 blur. See the attributes below.


Options Table

BLUR_Type
The blur type is a string which represents the type of blur applied to the image. Valid options are :
  • "Box"
  • "Soften"
  • "Bartlett"
  • "Sharpen"
  • "Gaussian"
  • "Hilight"
  • "Blend"
  • "Solarise"
BLUR_Red, BLUR_Green, BLUR_Blue, BLUR_Alpha
These four tags are used to tell the Blur function which channels of the image to affect. A value of true enables blur for the channel. A value of false disables it. The default behaviour if this tag is not specified is true.
BLUR_XSize, BLUR_YSize
These tags specify the strength of the blur along the X and Y axis, respectively. A value of 1 represents a blur equal to the width of the image.
BLUR_Blend
A value between 0 and 1 which indicates how much of the original input image to blend into the result of the Blur. Unlike the Blend slider presented by the Common Controls tab, this blend takes place inside the blur itself, and thus may be somewhat faster. If not specified the default value will be 1.
BLUR_Normalize
BLUR_Normalize is used when applying Glow to the blurred image. To match what the Glow tool does pass in "1.0 - glow" as the value for that tag.
BLUR_RedScale, BLUR_GreenScale, BLUR_BlueScale, BLUR_AlphaScale
The blur scale tags are multipliers for the results of the glow applied with BLUR_Normalize. These match the glow tool's "Color Scale" options.


Example

FuRegisterClass("BlurTest", CT_Tool, {
	REGS_Category = "Fuses",
	REGS_OpIconString = "BlT",
	REGS_OpDescription = "Blur Test Fuse",
	REG_OpNoMask = false,
	REG_NoBlendCtrls = false,
	REG_NoObjMatCtrls = false,
	REG_NoMotionBlurCtrls = false,
	})
 
function Create()
	InBlur = self:AddInput("Blur", "Blur", {
		LINKID_DataType = "Number",
		INPID_InputControl = "SliderControl",
		INP_Default = 100.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 blur_strength = InBlur:GetValue(req).Value
	local result = Image({IMG_Like = img})
	
	img:Blur(result, {
		BLUR_Type = "Gaussian", 
		BLUR_Red = true,
		BLUR_Green = true,
		BLUR_Blue = true,
		BLUR_Alpha = false,
		BLUR_XSize = blur_strength/img.OriginalWidth, 
		BLUR_YSize = blur_strength/img.OriginalWidth,
		})
	
	OutImage:Set(req, result)
end


Tips for Blur (edit)

As described above, a size of 1.0 creates a blur equal to the width of the image. The Blur tool in Fusion, however, uses a different scale. Here, a value of 1.0 equals a one pixel wide blur on a PAL image (720 pixels wide). Due to Fusion's resolution independence this will be a 2.6 pixel blur on an HD image.

In order to give the user a blur slider that works like the standard blur tool, divide size by 720 before calling the Blur method (see the FuseBlur example). To achieve a one pixel blur regardless of resolution, divide size by the input image's width.