Forums > Jitter

minimum/maximum of all planes

November 30, 2013 | 7:09 pm

Forgive the baseness of my inquiry.. but how do I output a matrix of max or min plane values? I’m new to jit.expr and there is no equivalent of a max/min operator in expr/vexpr so I don’t really have much to go on. I assumed it was like passing a list to [maximum] or [minimum] in Max. But it seems that I need two args – no more, no less. So in order to output a 4 plane matrix with maximum cell values I need to do something like:

@expr max(max(in[0].p[0],in[0].p[1]),max(in[0].p[2],in[0].p[3]))

Really?

It’s gotta be easier that that. What if I have a lot more planes? Or matrices with dynamically changing planecounts? Is there something like a .p[-1] to make this simple…?


December 1, 2013 | 5:52 am

don’t wanna use jit.3m?

<code>

– Pasted Max Patch, click to expand. –

</code>


December 1, 2013 | 2:30 pm

Hey thanks Tobias.. but I don’t think I was very clear in my initial post.

I want to grab the min or max for each plane of each cell… the channels of each pixel.

Here is an example using video but I’m primarily interested in how to take an input matrix with a plane count of n and output a matrix of the same dimension with the min or max values for each cell of the input matrix. The way it is now, I am using an expression that limits the input planecount to 4.

What I am looking for doesn’t appear to exist.. which is a kinda surprising. Is there is a generic way to apply a function to each cell that operates on the planes and outputs a matrix of the same dimension? I’m new to all of this so my question may be very basic. Thanks..

– Pasted Max Patch, click to expand. –

December 2, 2013 | 1:35 am

jit.planeop:

<code>

– Pasted Max Patch, click to expand. –

</code>


December 2, 2013 | 2:00 am

Yes! Thank you…


Viewing 5 posts - 1 through 5 (of 5 total)