title: Colour Difference in The Foundry NUKE
body: <p>So I am trying to make a painterly node group with Python code straight so I can use it for future projects but I can't seem to get the power part of the formula in nuke to work from this colour difference formula( I'm also new to Nuke so if there is a better way of writing this please let me know it would be awesome thank you, or if I'm doing this wrong completely also let me know)</p>
  <blockquote>
  <p>The following formula for color difference is used to create the
  difference image: |(r1,g1,b1) – (r2,g2,b2)| = ((r1 – r2)^2 + (g1
  –g2)^2 + (b1 – b2)^2)^1/2.</p>
  </blockquote>
  <pre><code>nRedShuffle = nuke.nodes.Shuffle()
  nRedShuffle['red'].setValue('red')
  nRedShuffle['green'].setValue('red')
  nRedShuffle['blue'].setValue('red')
  nRedShuffle['alpha'].setValue('red')
  
  nGreenShuffle = nuke.nodes.Shuffle()
  nGreenShuffle['red'].setValue('green')
  nGreenShuffle['green'].setValue('green')
  nGreenShuffle['blue'].setValue('green')
  nGreenShuffle['alpha'].setValue('green')
  
  #...(so on for the rest of rgba1 and rgba2)
  
  nGreenShuffle2 = nuke.nodes.Shuffle()
  nGreenShuffle2['red'].setValue('green')
  nGreenShuffle2['green'].setValue('green')
  nGreenShuffle2['blue'].setValue('green')
  nGreenShuffle2['alpha'].setValue('green')
  
  nBlueShuffle2 = nuke.nodes.Shuffle()
  nBlueShuffle2['red'].setValue('blue')
  nBlueShuffle2['green'].setValue('blue')
  nBlueShuffle2['blue'].setValue('blue')
  nBlueShuffle2['alpha'].setValue('blue')
  
  #I am having troubles with the powers below
  
  redDiff = nuke.nodes.Merge2(operation='minus', inputs=[nRedShuffle2, nRedShuffle])
  redDiffMuli = nuke.nodes.Merge2(operation='multiply', inputs=[redDiff, redDiff])
  
  greenDiff = nuke.nodes.Merge2(operation='minus', inputs=[nGreenShuffle2, nGreenShuffle])
  greenDiffMuli = nuke.nodes.Merge2(operation='multiply', inputs=[greenDiff, greenDiff])
  
  blueDiff = nuke.nodes.Merge2(operation='minus', inputs=[nBlueShuffle2, nBlueShuffle])
  blueDiffMuli = nuke.nodes.Merge2(operation='multiply', inputs=[blueDiff, blueDiff])
  
  redGreenAdd = nuke.nodes.Merge2(operation='plus', inputs=[redDiffMuli, greenDiffMuli]) 
  redGreenBlueAdd =  nuke.nodes.Merge2(operation='plus', inputs=[redGreenAdd, blueDiffMuli]) 
  </code></pre>