I am trying find nearest RGB value in QMap
(I know it probably should be HSV, but that is not the problem). Here is what I got so far:
it = images_map.find(current_rgb);
if(it != images_map.begin()){
mi = images_map.lowerBound(current_rgb).value();
}
else{
mi = images_map.upperBound(current_rgb).value();
}
My map looks like this has that indexes:
images_map[ 4283914078 ]
images_map[ 4284046165 ]
images_map[ 4284902241 ]
images_map[ 4289239953 ]
images_map[ 4282200377 ]
images_map[ 4289440688 ]
When my current_rgb
is for example 4285046165
it is OK, but if there is some value greater than greatest index, program crashes. What am I doing wrong?
QMap
from QT lib. – Sheetfed