I actually ended up writing a plugin to do this, though it currently operates 
in-line on RGB only. Chances are it could be made more efficient somehow, but 
it works. If there aren’t any other elegant solutions out there, I can see 
about getting the go-ahead to release it and post it on Nukepedia (and maybe 
spruce it up a bit first). And as fair warning, I can only build for Linux and 
Windows.

Side note: I was pretty surprised Nuke didn’t have a good built-in solution for 
this.

-Nathan



From: Jordan Olson 
Sent: Wednesday, August 31, 2011 5:06 PM
To: Nuke Python discussion 
Subject: [Nuke-python] quickly average non-zero pixels?

hi fellow TDs! 

I'm working on a gizmo atm- and am trying to figure out the best way for this.
I'd like to find the average non-zero value of a channel on the current frame. 
(working with depth and motion blur)

The slowest way I can imagine doing it is to run nuke.sample() on every pixel 
with an if statement, to eventually average the non-zero (or alpha) pixel 
values together. Surely there's a better way to do it? Ideally this should 
happen on every frame transparent to the comper.

Cheers,
Jordan


--------------------------------------------------------------------------------
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to