I wanted to track my footage and add CG elements to it as part of my nuke project. For that purpose, I undistorted the footage & wrote it down to disk for faster processing. However, when I tried to re-distort the written footage (as shown in attached pic), its not giving me original footage. I found that the Reformat5
and Reformat7
are not giving me the same bounding box dimensions even though both the nodes are the same.
My original footage size is 1920*1080. After undistorting, it becomes 1928*1085.
Hence I put a Reformat4
node with the dimensions 1928*1085 and wrote it down to disk. On the left side, I again put reformat node to resize the undistorted footage back to 1920*1080 with bounding box of size 1928*1085 preserved so as to perform lens distortion to get back my original footage.
Its working fine on left side but if I do the same thing on my written footage, the bounding box dimensions are not same.
Reformat7
gives bounding box of size 1924*1083 instead of 1928*1085. What am I missing here ? I searched the web but I cant find any solution. Please throw some light on this issue.
my nuke script is as follows :
set cut_paste_input [stack 0]
version 10.0 v3
push $cut_paste_input
LensDistortion {
serializeKnob ""
serialiseKnob "22 serialization::archive 9 0 0 0 0 0 0 0 0 0 0 0 0"
distortion1 -0.007498324849
distortion2 0.0008674863493
distortionCenter {-0.002916968195 -0.001372990897}
invertDistortion true
cardScale {1.006676197 1.006676197 1}
a 0.001508030226
b -0.006750627421
c -0.002457624534
analysisStart 1
analysisStop 329
name LensDistortion2
selected true
xpos -451
ypos 651
}
Reformat {
format "1928 1085 0 0 1928 1085 1 undistortedFormat2"
resize none
name Reformat4
selected true
xpos -451
ypos 684
}
set N6eafc00 [stack 0]
Reformat {
resize none
pbb true
name Reformat5
selected true
xpos -451
ypos 745
}
LensDistortion {
serializeKnob ""
serialiseKnob "22 serialization::archive 9 0 0 0 0 0 0 0 0 0 0 0 0"
distortion1 -0.007498324849
distortion2 0.0008674863493
distortionCenter {-0.002916968195 -0.001372990897}
cardScale {0.9934444427 0.9934444427 1}
a -0.0004114751064
b 0.004895505495
c 0.002436506096
analysisStart 1
analysisStop 329
name LensDistortion3
selected true
xpos -451
ypos 782
}
push $N6eafc00
Write {
file F:/Assignments/Nuke/CGComp/footages/undistortedFootage1080p/undistortedFootage1080p.####.exr
file_type exr
name Write7
selected true
xpos -269
ypos 684
}
Reformat {
resize none
pbb true
name Reformat7
selected true
xpos -269
ypos 747
}
LensDistortion {
serializeKnob ""
serialiseKnob "22 serialization::archive 9 0 0 0 0 0 0 0 0 0 0 0 0"
distortion1 -0.007498324849
distortion2 0.0008674863493
distortionCenter {-0.002916968195 -0.001372990897}
cardScale {0.9934444427 0.9934444427 1}
a -0.0004114751064
b 0.004895505495
c 0.002436506096
analysisStart 1
analysisStop 329
name LensDistortion5
selected true
xpos -269
ypos 783
}
You need to use
CopyBBox
node for solving your issue. This Python command creates connectedCopyBBox
node:or you can create a disconnected one from other nodes with this command:
CopyBBox
copies the bounding box from the A input onto the B stream. The bounding box defines the area of the frame that Nuke sees as having valid image data. The larger the bounding box is, the longer it takes Nuke to process and render the images.Some NUKE operations, such as a
Merge
,Blur
, orLensDistortion
can cause an expansion or decrease of the bounding box area because NUKE does not know that the extra area is going to be black or another constant color. Often, you can fix this by copying the bounding box from one of the inputs to the resulting image, thus cutting off the extra area.And if you have a "Stretched pixels effect" at right margin, use
scale=1.005
parameter inTransform
node (right after yourLensDistortion5
node). Also, don't forget to use filtering algorithm.