## SORT PIXEL BY GRAYSCALE IN A COLL OBJ

May 16, 2009 at 11:59pm

# SORT PIXEL BY GRAYSCALE IN A COLL OBJ

Hi everybody,

I want to sort the pixels (coordinates) of a frame by luminosity (grayscale) in a coll obj. First time i used this object, maybe its not the right one for what i want to do.
Here is where i am…

Pierre-Yves

– Pasted Max Patch, click to expand. –
#43957
May 18, 2009 at 12:21am

Because i need to sort all this pixels (x,y) according to their grayscale value.

In concrete terms, i have two frames as two matrix. And i want to use the pixels of one matrix for recompose the other one, and vice versa.

So i need first, to make a list of the pixels of the first matrix and sort them, for been able to used them after from the brighter to the darker. Does that make sens?

Pierre-Yves

#157893
May 18, 2009 at 6:46am
 p_yves wrote on Sun, 17 May 2009 19:21 Because i need to sort all this pixels (x,y) according to their grayscale value.

In concrete terms, i have two frames as two matrix. And i want to use the pixels of one matrix for recompose the other one, and vice versa.

So i need first, to make a list of the pixels of the first matrix and sort them, for been able to used them after from the brighter to the darker. Does that make sens?

No need for [coll], use a jit.spill on the one you want grayscale-sorted, then [zl sort]. You can put this into [zl reg], then when you want a value, bang out the list into [zl mth]. You could also use a table or multislider for your list if you want visual representations.

#157894
May 18, 2009 at 9:48am

hi seejayjames thanks for your help

Here is what a made with a first patch. The result is good, this is exactly what i’m looking for my project. But i used some obj like “coll”, “getcell”, too many matrix, and at the end the patch need 20minutes for render the two new frames! (and its for a video of fex minutes)

So i tried to optimize by using several Zl obj but i still can’t find the way to keep the coordinates and the values together.

p_yves

#157895
May 18, 2009 at 10:15pm

did you try jit.bsort to arrange the matrix ?

#157896

You must be logged in to reply to this topic.