Welcome back.
Now we need to draw this bounding box as I said to you.
This returns a y minimum, x minimum, y maximum and x maximum.
We need to convert it to a rect f.
We need to display this on our canvas.
So for that.
Val rect f we need to pass four parameters.
The bounding box dot result view size with the width.
This is for x minimum.
This is for y minimum.
This is the width is for x maximum and this is for the y maximum.
Okay let me make the labels here.
If you notice we started from one bounding box one which is the left x minimum.
This is the standard.
Then we need to pass the top which is y minimum.
The right is three bounding box three index three which is x maximum, and bounding box two which is
the button y maximum.
Okay.
This is what we we need to do in order to display the rectangle.
Now only add if the rectangle is valid.
What we need to do if rect dot width if rect dot width greater than zero and rect height greater than
zero and rect left greater than zero and rect top greater than zero.
What we need to do.
We need to set the results, the detection results or the detection object.
Dot add detection object rect.
Replace it with a score because the first parameter is the score, the second parameter is the label.
The third parameter is the bounding box, which is the rectangle that we created just before okay,
only if valid.
Go and add this rectangle.
Now we need to return result and the detected results.
Detected objects Dot sort by descending.
Descending according to its score.
Okay.
Dot.
Take default.
Maximum results.
This is for the.
And this is for.
Okay.
We need to change it to sorted by and not sort by.
It's sorted by and take.
This is not a lambda expression.
It takes the default maximum results.
Okay.
This is our parse detection results.
Here we are drawing the rectangle.
It's a very important to understand the sequence the left top right and bottom.
The left is the x minimum which is the the second element in the bounding box.
The top is the first element in the bounding box.
The right is bounding box.
Fourth element and the bounding box.
Third element is the bottom.