ID 461878 - Node.sample() returns the incorrect results when picking/sampling an area

Follow

Problem summary
Node.sample() returns the incorrect results when picking/sampling an area

 

Customer reported version
nuke.12.2v3

 

Customer reported platform
centos7

 

Steps to reproduce

1) Create a ColorWheel and view it

2) CTRL click the viewer to sample 1 pixel

3) Run the following code, the RGBA numbers line up with the values in the Viewer:

import mathviewer = nuke.activeViewer().node()bbox = viewer.knob("colour_sample_bbox").value()node = viewer.input(nuke.activeViewer().activeInput())w = node.width()h = node.height()corner_x = round((bbox[0] + 1) * w / 2,1)corner_y = round((bbox[1] * w + h) / 2,1)size_x = int(round((bbox[2] + 1) * w / 2 - corner_x))size_y = int(round((bbox[3] * w + h) / 2 - corner_y))center_x = math.trunc(corner_x + size_x/2)center_y = math.trunc(corner_y + size_y/2)for channel in ['Red','Green','Blue','Alpha']:print (channel +": "+ str(round(node.sample(channel,center_x+0.5,center_y+0.5, size_x, size_y), 5)))

4) CTRL+SHIFT+Click and drag the viewer to sample and area

5) Run the same code again, the RGBA values don't match the Viewer's

 

 

Expected behaviour
For the node.sample() values to match the Viewer values

 

Actual behaviour
They don't match

 

 

Reproduced by support
This bug has been reproduced in:

Nuke 12.2v3 - Windows 10 - macOS 10.14 - CentOS 7.8

Nuke 12.2v1 - Windows 10

Nuke 12.0v1 - Windows 10

Nuke 11.0v1 - Windows 10

Nuke 10.0v1 - Windows 10

Nuke 9.0v1 - Windows 10

Nuke 8.0v1 - Windows 10 - macOS 10.14

 

Earliest version tested
Nuke 8.0v1 - This issue appears to be in all versions of the product
 

 

    We're sorry to hear that

    Please tell us why