Phython keyer

Does anybody know what python commands I need to be able to read in an image and perform an operation on each pixel. say I have an image then want this script to go through each pixel and if it has a r (or g or b) value greater than 0.5 (for example) then it would assign that pixel as having an alpha value of 1 or 0

I’m experimenting with creating a basic python based keyer but am not fluent enough in python just yet to figure out how to do this…

any help would be super helpful 😀

Read Nodes: Auto name & Filename

I’m trying to make an "autoread node" or something like that…, which:

1.-Autoset its name sequentially: TAKE_000, TAKE_001 (3 or variable digits padding)
2.-Autoset the knob ‘file’ setValue to a constant and variables folders, for example:

Z:/PROJECT/Material/SCENE_002/TAKE_014/CHARACTERS/char/%vCam/Sce02_Take14_%03d.exr’)

The red characters should be taken from the node name, and increase with this. So, it shol look like this:

for Read named TAKE_011

Z:/PROJECT/Material/SCENE_002/TAKE_011/CHARACTERS/char/%vCam/Sce02_Take11_%03d.exr’)

I’m reading the nuke PDF…, but I think it’s not enough..

r=nuke.createNode(‘Read’)
r.setXYpos(0,0)
r.setName(‘TAKE_000’,uncollide=True)
nuke.toNode(‘TAKE_000’).knob(‘file’).setValue(‘Z:/PROJECT/Material/SCENE_002/TAKE_014/CHARACTERS/char/%vCam/Sce02_Take14_%03d.exr’)

because when I create the next node, the number change to one digit…

In few words, what I need is a number sequencer python command… and a character catcher like:

[lindex [split [lindex [split [metadata input/filename] /] 8] ._] 1]

Or something like that…

Is it possible? or just need sleep much? 😀

Thank you in advance…

I don’t want you resolve my life, i’m not a coder…, but i’m interested in learn python. Just show me the way, please!:p

Python lists help

Hello,

I am trying to solve a seemingly simple python problem:

I am having two lists.

L1 = ["b","a","b","a"]
L2 = ["1","2"]

now I want to connect the two lists in a way that L1[0] = L2[0] and L1[1] = L2[1]

so in the end i get for every item in L1 the proper value out of L2.

b = 1 and a = 2

the best would be a dict where the values are connected.

dict = {"b" : "1" , "a" :"2" ,"b" : "1" , "a" : "2"}

but i am open to any way to get this done…

jaden

Nuke Python / TCL Question

I am trying to make a value remapping expression – basically emulating the After Effects linear() function-

linear(val,inMin,inMax,outMin,outMax)

I found a python methodology:

def remap(val,inmin,inmax,outmin,outmax):
diffin=inmax-inmin
diffout=outmax-outmin
diffval=val-inmin
newval=outmin+((diffout/diffin)*diffval)
return newval

I can then use the remap() function within an expression on a value to use this. The only issue is that I have to define the remap() function every time the script opens. I know I can add it to my menu.py or some other file – but what if I want to make the script totally portable and render-farm friendly?

Is there a way to embed the "def remap()" code into the script so that it is auto-executed every time the script is opened?

thanks in advance!

Nuke 6.2 Roto shape control point access

Hi guys, is there any way to set position for shape control points at the current frame from python? I would like to manually redefine the screen position bypassing the internal nuke interpolation.
The nuke.rotopaint.AnimControlPoint.setPosition(…) seems to have the appropriate semantics, but it does nothing.
Or maybe it is possible to define an expression for each control point position that could calculate its value at every frame?
Thanks

Nuke pulldown menu on custom write tab issue

Hi,

Having some trouble creating a pulldown menu on a custom write node that I have created. The code that I have come up with so far is:

Code:

shots = ['010100', '010500', '010340', '010200']
    shots.sort()
   
    shotKnob = nuke.Pulldown_Knob("shotSelector","Load Shot")
    shotList = []
    for shot in shots:
      shotOp = "%s" % (shot)
      shotList.append((shot, shotOp))
    shotKnob.setValues(shotList)
    os.environ['ELEM'] = shotOp


The problem that I have, is that the menu comes up, but it doesn’t display the option that has been selected, and then when working with the output, it displays all of the options rather than just the one that was selected.

I’ve used ‘addEnumerationPulldown’ for other project panels, but this seems to be the best code for this so far.

Thanks for any help in advance.

nuke 6.2 python issue

hi there
we are looking at updating from 5.2v3 to 6.2v1.
to test if it will work it would work we installed it on on one of our machines to see how it would work.

when we launched it we gave us an issue with python25.dll

would I be correct in assuming that all our scripts need to be recompiled in a higher version of python?

DD::Image::Iop example problems

Hi !

I looked into the Iop example codes /blocky.c ;checkerboard2/ and i managed to build them ,but it seems that they don’t work correctly.
I tried some logging in the validate function, it’s ok , but logging to console in the engine part is not working ..it seems that the plugin does not enter this part.The node itself updates in viewport but for the example the checkerboard2 stays black, the blocky plugin didn’t change the image also.
Also noticed that these plugins are included in Nuke and they/the built-in ones/ works fine as expected, / i built the examples with other names also ,removing the built-in plugs/.

I tried some other plugins also with pixelIop with pixel_engine and they works well not as Iop./the logging in pixel_engine also works/.
I’m on win7x64 Nuke 6.1v2x64 2 core machine.
Are they for older Api or does anything changed ?Or am i missed something?
thanks in advance,

Asi

python: read file size

Hi there
Im trying to write a script that looks at the sizes of the files in a sequence so I can filter out a certain size.

the bit Im a bit stuck on is getting python to read the sizes of the files on the server.
im not sure how to go about doing this

Set matte in nuke

hi all,

any body can u plz help me how to create a set matte using NUke software

thanks in advance….