GreycLab / gmic

GREYC's Magic for Image Computing: A Full-Featured Open-Source Framework for Image Processing
Other
70 stars 12 forks source link

Feature Request: offset for sort() #64

Open Reptorian1125 opened 4 days ago

Reptorian1125 commented 4 days ago

Recently I had to do this:

ref_vector=shift(ref_vector,-1,2);
ref_vector=sort(ref_vector,1,whds,2);

Currently, sort always use the first indice of element to sort. I would like to use n-th indice of element to sort instead.

Now, we have this:

sort(X,_is_increasing,_nb_elts,_size_elt) (sorted values)

With offset as a optional argument next to size_elt, the new code becomes:

ref_vector=sort(ref_vector,1,whds,2,1);

So, it's using every second indice of element for sorting.

dtschump commented 1 day ago

That's a good idea. https://github.com/GreycLab/CImg/commit/f20e9dd20102ab9db6a0fe8e9273b06a5fc431e3 implements this feature.