Greetings! The Problem I am trying to write a tool to distort tracking data through a distortion map output by a LensDistortion node. I have everything working, except there seems to be inaccuracy in my method of calculating the distorted pixel position from the sampled values of the uv distortion map, when compared to a visual check.
My Method Say there is a pixel value at 1792,476 in a 1080p frame. I have a standard UV Map, modified with a grade node through a mask, creating a localized distortion when this map is plugged into an STMap node. The distorted pixel value is 1821,484. The sampled uv map pixel values at the source pixel location is 0.916767, 0.432918 (for width, and height offset, respectively). I am going on the assumption that the uvmap pixel values represent the distorted location of that pixel, with the location being a floating point percentage of the frame width and height. So a value of 0.916767, 0.432918 would basically be telling the STMap node to set the output pixel location for this pixel to a value of the difference between the 'unity' uvmap value that would result in no transformation and the sampled uv value, multiplied by the frame width. For horizontal distortion offset, this would be: (pixel_coordinate_x / frame_width - uvmap_red) * frame_width, or (1792 / 1920 - 0.916767) * 1920 = 31.807 This would result in a distorted horizontal value of 1792+31.807 = 1823.807. This value is close, but almost 3 pixels off. Help! Can anyone here provide some insight into how exactly the math for the STMap works to determine the output location of a pixel from the incoming pixel values? I have attached a small nuke script demonstrating what I am talking about. See the "Test_STMAP_Distortion_Calculations" node to see the output results of the above algorithm. And if anyone is curious to check out the "DistortTracks" gizmo as it exists so far, it lives here (https://gist.github.com/jedypod/6302723). Thanks very much!
uvmap_offset_calculation.nk
Description: Binary data
_______________________________________________ Nuke-users mailing list [email protected], http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
