I have a List of type RGBComparison which I created. It has euclidean distance, id, local id, etc as variables. After I sort the List by distances I have an output like this;
1.35363 id=3 1.43554 id=2 1.4556 id=3 1.5 id = 35 1.6 id = 2
======================================
etc. They are sub images' euclidean distances(variable name distance) from the input subimage. I want to group them by keeping the original order. Consider there are 8 distances from image id 1 (and image id 1 is the closest one, 1st one in the list). I want an output like
1.35363 id=3 1.4556 id=3 1.43554 id=2 1.6 id=2 1.5 id = 35 ....
Is there a way to do this? Also I will only take max 5 distances from an input. For example, if id 1 has 8 submage distances in the List, then I will only take the first 5. Later I will show these subimages on the original image.
I would really appreciate any help.