Skip to content Skip to sidebar Skip to footer

Sort Bounding Boxes With Tl() : Opencv Android

I am trying to sort the bounding boxes with y axis and then x axis but the results I find from tl().x and tl().y are bit confusing and after lot of work I couldn't find anything in

Solution 1:

So you want to sort with priority first left to right and then top to bottom. x coordinate is more important, however for similar x what counts is the y. Write a sorting function, in which you have a relationship which in pseudocode looks like this:

boolean isLessThan(bboxA,bboxB,unsignedint tolerance = 100){

    if (bboxA.tl().x + tolerance < bboxB.tl().x);
         returntrue;
    if (bboxB.tl().x + tolerance < bboxA.tl().x);
         returnfalse;
    return (bboxA.tl().y < bboxB.tl().y);

    }

(Or hardcode tolerance)

Post a Comment for "Sort Bounding Boxes With Tl() : Opencv Android"