Bounding-Box in Python prozentual vergrößern
English
Deutsch
Bei einer Bounding-Box (xmin, xmax, ymin, ymax) kann der folgende Algorithmus verwendet werden, um die Bounding-Box z.B. auf jeder Seite um 15% zu vergrößern:
resize_bbox.py
xmin -= 0.15 * (xmax - xmin)
xmax += 0.15 * (xmax - xmin)
ymin -= 0.15 * (ymax - ymin)
ymax += 0.15 * (ymax - ymin)Beachten, dass dies die Bounding-Box auf jeder Seite um 15% (=0,15) vergrößert, d.h. die Gesamtbreite der resultierenden Bounding-Box wird um 15% * 2 = 30% größer!
Warum es funktioniert
resize_bbox_snippet.py
xmin -= 0.15 * (xmax - xmin)ist dasselbe wie
resize_bbox_explanation.py
xmin -= 0.15 * [Breite der Bounding-Box]Check out similar posts by category:
Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow