Add label_colors
argument to draw_bounding_boxes
#8578
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Initial discussion and rational for this feature is in issue #8317 . As mentioned on that issue, this first PR addresses only the issue of label colour.
On issue #8317, I proposed to implement this by having a
draw_label_kwargs
argument which could then be passed todraw.text
. This would exposes all the flexibility provided by PIL (font stroke width, separate font fill and stroke colours, etc). However, after doing that, I think that this "simpler", albeit more limited, approach is better because my original proposal:messy when there are multiple boxes - we can pass a list of colours for the boxes and the same should be supported for the label colour. If we require a dict of kwargs then we would need a list of kwargs, many of them duplicated. It's just messy.
would bind us to PIL - if in the future this is done with something other than PIL then it would be difficult to keep BC
user needs to reference PIL documentation - not only the documentation is now elsewhere, different PIL versions support different arguments so it can be tricky for the user to know what arguments are supported