I trying to sort a tuple as below
input: ROI:
[[191 60 23 18]
[143 60 23 19]
[ 95 52 24 21]
[237 51 24 21]
[ 47 38 27 22]
[281 35 25 22]
[ 4 17 26 24]
[324 13 22 21]]
Expected Output = S_ROI:
[[4 17 26 24]
[47 38 27 22]
[ 95 52 24 21]
[143 60 23 19]
[ 191 60 23 18]
[237 51 24 21]
[281 35 25 22]
[324 13 22 21]]
I have got intermediate array
column=[191 143 95 237 47 281 4 324]
I have tried this - But ROI is getting updated inside loop
sort_index = np.argsort(column)
column.sort()
sorted_led_ROI=ROI;
index=0
for y in sort_index:
sorted_led_ROI[index]=ROI[y]
index =index+1
print('sorted_led_ROI:', sorted_led_ROI)
Result:
sorted_led_ROI:
[[ 4 17 26 24]
[ 47 38 27 22]
[ 95 52 24 21]
[ 47 38 27 22]
[ 4 17 26 24]
[ 47 38 27 22]
[ 47 38 27 22]
[324 13 22 21]]
help me out to sort this in python using np or cv