Skip to content

Conversation

@lolipopshock
Copy link
Member

@lolipopshock lolipopshock commented Apr 3, 2022

  1. Not drawing the box outlines when setting box_width=0. For example,

    from PIL import Image
    import layoutparser as lp
    
    image = Image.new('RGB', (50,50), color='white')
    lp.draw_box(image, [lp.Rectangle(10, 10, 40, 40)], box_width=0)

    Previously, it will draw a box image.

  2. Allowing setting box_color in draw_box:

    1. directly setting box_color:

      from PIL import Image
      import layoutparser as lp
      
      image = Image.new('RGB', (50,50), color='white')
      
      lp.draw_box(image, 
                  [lp.TextBlock(lp.Rectangle(10, 10, 20, 20), type='a'), 
                  lp.TextBlock(lp.Rectangle(30, 30, 45, 45), type='b'),] ,
                  box_color=['black', 'red'])

      image

    2. overriding color_map:

      lp.draw_box(image, 
                  [lp.TextBlock(lp.Rectangle(10, 10, 20, 20), type='a'), 
                  lp.TextBlock(lp.Rectangle(30, 30, 45, 45), type='b'),] ,
                  color_map={'a':'black', 'b':'blue'}, box_color=['black', 'red'])

      image

  3. Setting box_color, box_alpha, and box_width for each objects:

    from PIL import Image
    import layoutparser as lp
    
    image = Image.new('RGB', (50,50), color='white')
    lp.draw_box(image, 
                [lp.TextBlock(lp.Rectangle(10, 10, 20, 20), type='a'), 
                lp.TextBlock(lp.Rectangle(30, 30, 45, 45), type='b'),] ,
                box_color=['black', 'red'], 
                box_alpha=[0.1, 0.5], 
                box_width=[2,4])

    image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants