Jump to content
Sign in to follow this  
konstantin magnus

Selfmade image blur filter

Recommended Posts

Could anyone please give me some advice on how to program a simple box filter in COPs using python or VEX? Basically calculating the average of every pixel and its immediate surrounding pixels over and over again?

 
I created one in a VOPCOP2filter, but due to the lack of a foreach-node in COPs I cant repeat it multiple times without copying nodes over and over again (see attachment).

boxblur.hipnc

Edited by konstantin magnus

Share this post


Link to post
Share on other sites

I guess you have a good reason not to use the blur node set to box filter?

Share this post


Link to post
Share on other sites

You have to loop through samples. Fortunately a lot of COP nodes are written in VEX (I assume by our legendary Mark?) that you can check out to learn how to write your own box blur. I think Radial Blur should be the closest to what you need.

Share this post


Link to post
Share on other sites

@yader: i solved other tasks with vops and wanted to replace 'premade' nodes by custom ones (mainly for learning reasons, the feeling to know whats happening and for having it done by myself : )

@eetu: afaik for-loops dont loop over the latest result but just over the same input again and again?

@magneto: great hint!

 

thank you for the answers!

Share this post


Link to post
Share on other sites

Ah yeah, sorry, I read too fast. I thought you wanted a loop for taking many samples/taps for the blur.

 

For a special case you could set up a feedback loop with file write/read, but it doesn't really suit a general purpose node ;)

Or, you could make it an HDA with a few of those VOP nodes inside, but that would of course mean a fixed number of passes..

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×