Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
deepdraw
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
medai
software
deepdraw
Commits
ab2f960a
Commit
ab2f960a
authored
3 years ago
by
Driss KHALIL
Browse files
Options
Downloads
Patches
Plain Diff
[transforms.py] Add documentation to function _expand2square
parent
32ab5c65
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!31
[Rebase] rebase merged request
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/ip/binseg/data/transforms.py
+11
-0
11 additions, 0 deletions
bob/ip/binseg/data/transforms.py
with
11 additions
and
0 deletions
bob/ip/binseg/data/transforms.py
+
11
−
0
View file @
ab2f960a
...
...
@@ -273,6 +273,17 @@ class ColorJitter(torchvision.transforms.ColorJitter):
def
_expand2square
(
pil_img
,
background_color
):
"""
Function that pad the minimum between the height and the width to fit a square
Parameters
----------
pil_img : PIL.Image.Image
A PIL image that represents the image for analysis.
background_color: py:class:`tuple`, Optional
A tuple to represent the color of the background of the image in order to pad with the same color.
If the image is an RGB image background_color should be a tuple of size 3 , if it
'
s a grayscale image the variable can be represented with an integer.
"""
width
,
height
=
pil_img
.
size
if
width
==
height
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment