Skip to content

Instantly share code, notes, and snippets.

@jedypod
Last active November 29, 2018 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jedypod/a42763ff20d2abbd8dd100e5af09e89c to your computer and use it in GitHub Desktop.
Save jedypod/a42763ff20d2abbd8dd100e5af09e89c to your computer and use it in GitHub Desktop.
Sample Color values of input averaging within a box size
Group {
name AutoExposure
addUserKnob {20 User}
addUserKnob {41 wb T ColorMatch.wb}
addUserKnob {41 dst_color l dst T ColorMatch.dst_color}
addUserKnob {22 calc T "n = nuke.thisNode()\nnuke.root().begin()\nn.begin()\nct = nuke.toNode('CURVETOOL')\nct\['intensitydata'].clearAnimated()\nt = nuke.frame()\nnuke.execute(ct, t, t)" +STARTLINE}
addUserKnob {26 ""}
addUserKnob {41 intensitydata T CURVETOOL.intensitydata}
addUserKnob {41 sample T ColorSampler.sample}
addUserKnob {26 ""}
addUserKnob {41 center T ColorSampler.center}
addUserKnob {41 size T ColorSampler.size}
addUserKnob {41 area T ColorSampler.area}
addUserKnob {41 percentage T ColorSampler.percentage}
}
Input {
inputs 0
name Input
xpos -200
ypos -550
}
Dot {
name Dot1
label " "
note_font "Helvetica Bold Bold Bold Bold Bold"
note_font_size 24
note_font_color 0xa5a5a501
xpos -166
ypos -438
}
set Nbfbfcfd0 [stack 0]
NoOp {
name SamplerPython
xpos -360
ypos -370
addUserKnob {20 Sampler}
addUserKnob {15 area}
area {{center.x-(size.w/2) x1 2956.858605} {center.y-(size.h/2*input.pixel_aspect) x1 1832.641304} {center.x+(size.w/2) x1 2839.141395} {center.y+(size.h/2*input.pixel_aspect) x1 2037.358696}}
addUserKnob {12 center}
center {{width/2} {height/2}}
addUserKnob {14 size R 0 100}
size {{width*percentage} {height*percentage}}
addUserKnob {7 percentage}
percentage 0.2
addUserKnob {18 sample}
sample {{"\[python -execlocal channel\\ =\\ \\\"red\\\"\\nn\\ =\\ nuke.thisNode()\\ncenter\\ =\\ n\\\['center'\\].getValue()\\nsize\\ =\\ n\\\['size'\\].getValue()\\nsample\\ =\\ n.sample(channel,\\ center\\\[0\\],\\ center\\\[1\\],\\ size\\\[0\\],\\ size\\\[1\\])\\nret\\ =\\ sample]"} {"\[python -execlocal channel\\ =\\ \\\"green\\\"\\nn\\ =\\ nuke.thisNode()\\ncenter\\ =\\ n\\\['center'\\].getValue()\\nsize\\ =\\ n\\\['size'\\].getValue()\\nsample\\ =\\ n.sample(channel,\\ center\\\[0\\],\\ center\\\[1\\],\\ size\\\[0\\],\\ size\\\[1\\])\\nret\\ =\\ sample]"} {"\[python -execlocal channel\\ =\\ \\\"blue\\\"\\nn\\ =\\ nuke.thisNode()\\ncenter\\ =\\ n\\\['center'\\].getValue()\\nsize\\ =\\ n\\\['size'\\].getValue()\\nsample\\ =\\ n.sample(channel,\\ center\\\[0\\],\\ center\\\[1\\],\\ size\\\[0\\],\\ size\\\[1\\])\\nret\\ =\\ sample]"}}
addUserKnob {6 sample_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
}
push $Nbfbfcfd0
Group {
name ColorMatch
tile_color 0x7aa9ffff
xpos -200
ypos -298
addUserKnob {20 ColorMatch}
addUserKnob {18 ic}
ic {{parent.CURVETOOL.intensitydata} {parent.CURVETOOL.intensitydata} {parent.CURVETOOL.intensitydata}}
addUserKnob {6 ic_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
addUserKnob {7 wb}
addUserKnob {6 input_color_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
addUserKnob {18 exposure R -4 4}
exposure {0 0 0}
addUserKnob {6 exposure_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
addUserKnob {26 ""}
addUserKnob {18 src_color l src}
src_color {{"ic*wb + (ic.r+ic.g+ic.b)/3*(1-wb)"} {"ic*wb + (ic.r+ic.g+ic.b)/3*(1-wb)"} {"ic*wb + (ic.r+ic.g+ic.b)/3*(1-wb)"}}
addUserKnob {6 src_color_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
addUserKnob {18 dst_color l dst}
dst_color 0.35
addUserKnob {6 dst_color_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
addUserKnob {18 multiply t result}
multiply {{Multiply.value} {Multiply.value} {Multiply.value}}
addUserKnob {6 multiply_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
addUserKnob {26 ""}
addUserKnob {7 mix}
mix 1
}
Input {
inputs 0
name Input
xpos -40
ypos 62
}
Multiply {
channels rgb
value {{"pow(2, parent.exposure) * parent.dst_color / parent.src_color"} {"pow(2, parent.exposure) * parent.dst_color / parent.src_color"} {"pow(2, parent.exposure) * parent.dst_color / parent.src_color"} 1}
mix {{parent.mix}}
name Multiply
xpos -40
ypos 134
}
Output {
name Output
xpos -40
ypos 206
}
end_group
set Nf19906a0 [stack 0]
Output {
name Output
xpos -200
ypos -190
}
push $Nbfbfcfd0
NoOp {
name ColorSampler
xpos -360
ypos -442
addUserKnob {20 ColorSampler}
addUserKnob {15 area}
area {{center.x-(size.w)/2} {center.y-(size.h/2*input.pixel_aspect)} {center.x+(size.w/2)} {center.y+(size.h/2*input.pixel_aspect)}}
addUserKnob {12 center}
center {{width/2} {height/2}}
addUserKnob {14 size R 0 100}
size {{width*percentage} {height*percentage}}
addUserKnob {7 percentage}
percentage 0.5
addUserKnob {18 sample}
sample {{"\[sample this.input r center.x center.y size.w size.h]"} {"\[sample this.input g center.x center.y size.w size.h]"} {"\[sample this.input b center.x center.y size.w size.h]"}}
addUserKnob {6 sample_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
}
push $Nbfbfcfd0
CurveTool {
ROI {{parent.ColorSampler.area} {parent.ColorSampler.area} {parent.ColorSampler.area} {parent.ColorSampler.area}}
autocropdata {512 389 1536 1167}
intensitydata {{curve x9 0.7911825557} {curve x9 0.7540757797} {curve x9 0.6213526972} 1}
name CURVETOOL
xpos -360
ypos -298
}
push $Nf19906a0
Viewer {
frame_range 1-100
colour_sample_bbox {-0.2019627392 -0.1319999993 0.202000007 0.1309068277}
viewerProcess "RRT (ACES)"
name Viewer1
xpos -367
ypos 33
addUserKnob {20 Lock}
addUserKnob {6 lock_all_buffers l "lock all buffers" -STARTLINE}
addUserKnob {6 lock_buffer_1 l "lock buffer 1" +STARTLINE}
addUserKnob {6 lock_buffer_2 l "lock buffer 2" +STARTLINE}
addUserKnob {6 lock_buffer_3 l "lock buffer 3" +STARTLINE}
addUserKnob {6 lock_buffer_4 l "lock buffer 4" +STARTLINE}
addUserKnob {6 lock_buffer_5 l "lock buffer 5" +STARTLINE}
addUserKnob {6 lock_buffer_6 l "lock buffer 6" +STARTLINE}
addUserKnob {6 lock_buffer_7 l "lock buffer 7" +STARTLINE}
addUserKnob {6 lock_buffer_8 l "lock buffer 8" +STARTLINE}
addUserKnob {6 lock_buffer_9 l "lock buffer 9" +STARTLINE}
addUserKnob {6 lock_buffer_0 l "lock buffer 0" +STARTLINE}
}
end_group
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment