Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Nuke corner pin to matrix
# and here is the script in case anyone is interested :)
import nuke
def getTheCornerpinAsMatrix():
projectionMatrixTo = nuke.math.Matrix4()
projectionMatrixFrom = nuke.math.Matrix4()
#dir(projectionMatrix)
theCornerpinNode = nuke.selectedNode()
imageWidth = float(theCornerpinNode.width())
imageHeight = float(theCornerpinNode.height())
to1x, to1y = theCornerpinNode['to1'].value()
to2x, to2y = theCornerpinNode['to2'].value()
to3x, to3y = theCornerpinNode['to3'].value()
to4x, to4y = theCornerpinNode['to4'].value()
from1x, from1y = theCornerpinNode['from1'].value()
from2x, from2y = theCornerpinNode['from2'].value()
from3x, from3y = theCornerpinNode['from3'].value()
from4x, from4y = theCornerpinNode['from4'].value()
projectionMatrixTo.mapUnitSquareToQuad(to1x,to1y,to2x,to2y,to3x,to3y,to4x,to4y)
projectionMatrixFrom.mapUnitSquareToQuad(from1x,from1y,from2x,from2y,from3x,from3y,from4x,from4y)
theCornerpinAsMatrix = projectionMatrixTo*projectionMatrixFrom.inverse()
theCornerpinAsMatrix.transpose()
return theCornerpinAsMatrix
@ghost

This comment has been minimized.

Copy link

ghost commented Oct 5, 2015

Hi dude... this is gonna be very very useful to me ... Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.