Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add util to create image tiles #1028

Merged
merged 12 commits into from
Apr 5, 2024
Merged

Conversation

PawelPeczek-Roboflow
Copy link
Contributor

@PawelPeczek-Roboflow PawelPeczek-Roboflow commented Mar 20, 2024

Description

In this PR I am adding a feature to create image tiles based on list of images provided.

Easy example:

import supervision as sv

result = sv.create_tiles(images=[<list_of_images_goes_here>])

and that's enough to get visualisation like that - the util adjust grid to the number of images (point out that size of the tiles and alignment of grid adjusts as we go with # of images):

Just one image:
single_image_tile

Two images (still in the row by default)
two_images_tile

Three images (still in the row by default)
three_images_tile
Four images (forming 2x2)
four_images_tile
Five images (forming 3x2, as 3x3 would have last row empty)
all_images_tile
... and so on

People may adjust a lot of things - like set up a custom size of grid (including specification of only single dimension - and letting the other adjust):

import supervision as sv

result = sv.create_tiles(images=[<list_of_images_goes_here>], grid_size=(None, 3))

single_image_tile_enforced_grid

One may play out with colors:

import supervision as sv

result = sv.create_tiles(
  images=[<list_of_images_goes_here>], 
  tile_margin_color=(127, 127, 127),
  tile_padding_color=(224, 224, 224),
)

all_images_tile_and_custom_colors

On may also add titles for some or all of the images (and adjust text rendering process)

import supervision as sv

result = sv.create_tiles(
  images=[<list_of_images_goes_here>], 
  titles=["Image 1", None, "Image 3", "Image 4"],
)

image

This is not everything - rest is described in docs.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How has this change been tested, please provide a testcase or example of how you tested the change?

  • old tests still green
  • new tests added

Any specific deployment considerations

For example, documentation changes, usability, usage/costs, secrets, etc.

Docs

  • Docs updated? What were the changes:
  • docstrings provided

@PawelPeczek-Roboflow PawelPeczek-Roboflow marked this pull request as ready for review March 25, 2024 19:05
@SkalskiP
Copy link
Collaborator

SkalskiP commented Apr 5, 2024

I'm merging this PR into develop, but on Monday, I plan to work on exposing some of those utils in docs, adding examples, and renaming functions, and arguments.

@SkalskiP SkalskiP merged commit 372e703 into develop Apr 5, 2024
9 checks passed
@SkalskiP SkalskiP mentioned this pull request Apr 8, 2024
2 tasks
SkalskiP added a commit that referenced this pull request Apr 9, 2024
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