Sorting a list of tuple according to integer value of on of the tuple members

160 Views Asked by At

I have Halide func which is iterating over a gray image and finding highest gray value in 3x3 patch. I am using RDOM to search for largest gray value in 3x3 patch, which returns a Tuple of the X,Y position and they largest gray value in the 3x3 region.

MaxValue(x,y) = (rdom, Value( rdom.x.extent() * x + rdom.x, rdom.y.extent() * y + rdom.y), “maxValue3x3”)

Further, I want to order the MaxValue, according to the ascending order of the maximum value (MaxValue(x,y)[2]. When I try to use merge sort algorithm, similar to how it is implemented in sort.cpp, i cannot find a way to keep the other two outputs of the Tuple(i.e., X, Y) in the same order. Is this approach in correct direction, or I am doing it incorrectly.

Thanks

0

There are 0 best solutions below