MCPcopy Create free account
hub / github.com/ImageEngine/cortex / LuminanceOp

Method LuminanceOp

src/IECoreImage/LuminanceOp.cpp:54–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52IE_CORE_DEFINERUNTIMETYPED( LuminanceOp );
53
54LuminanceOp::LuminanceOp()
55 : ModifyOp( "Calculates luminance and adds it as a channel.", new ImagePrimitiveParameter( "result", "The result", new ImagePrimitive() ), new ImagePrimitiveParameter( "input", "The image to modify", new ImagePrimitive() ) )
56{
57
58 m_colorChannelParameter = new StringParameter(
59 "colorChannel",
60 "The name of the channel which holds colour data. This "
61 "can have data of type Color3fData or Color3fVectorData.",
62 "Cs"
63 );
64
65 m_redChannelParameter = new StringParameter(
66 "redChannel",
67 "The name of the channel which holds the red channel of the colour data. This "
68 "can have data of type HalfData, HalfVectorData, FloatData or FloatVectorData. "
69 "However, The type of this channel must match the type of the other colour component Channels.",
70 "R"
71 );
72
73 m_greenChannelParameter = new StringParameter(
74 "greenChannel",
75 "The name of the channel which holds the green channel of the colour data. This "
76 "can have data of type HalfData, HalfVectorData, FloatData or FloatVectorData. "
77 "However, The type of this channel must match the type of the other colour component Channels.",
78 "G"
79 );
80
81 m_blueChannelParameter = new StringParameter(
82 "blueChannel",
83 "The name of the channel which holds the blue channel of the colour data. This "
84 "can have data of type HalfData, HalfVectorData, FloatData or FloatVectorData. "
85 "However, The type of this channel must match the type of the other colour component Channels.",
86 "B"
87 );
88
89 m_weightsParameter = new Color3fParameter(
90 "weights",
91 "The weights used in averaging the rgb values to produce luminance.",
92 Color3f( 0.2125, 0.7154, 0.0721 )
93 );
94
95 m_luminanceChannelParameter = new StringParameter(
96 "luminanceChannel",
97 "The name of the channel to hold the resulting luminance data.",
98 "Y"
99 );
100
101 m_removeColorChannelsParameter = new BoolParameter(
102 "removeColorChannels",
103 "When this is true, the input channels are removed after luminance is calculated.",
104 true
105 );
106
107 parameters()->addParameter( m_colorChannelParameter );
108 parameters()->addParameter( m_redChannelParameter );
109 parameters()->addParameter( m_greenChannelParameter );
110 parameters()->addParameter( m_blueChannelParameter );
111 parameters()->addParameter( m_weightsParameter );

Callers 4

testParameterDefaultsMethod · 0.80
testSeparateRGBMethod · 0.80
testCsMethod · 0.80
testMethod · 0.80

Calls 1

addParameterMethod · 0.45

Tested by 4

testParameterDefaultsMethod · 0.64
testSeparateRGBMethod · 0.64
testCsMethod · 0.64
testMethod · 0.64