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

fill color customization #6

Merged
merged 2 commits into from
Apr 11, 2024
Merged

fill color customization #6

merged 2 commits into from
Apr 11, 2024

Conversation

bipinkrish
Copy link
Contributor

No description provided.

Copy link
Contributor

@AmitMY AmitMY left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting work! some changes requested

line_color=(144, 70, 180, 255), embedded_color=True)
fsw = "M530x518S19a30500x482S19a38465x481S22f04509x506S22f14467x504"
image = signwriting_to_image(fsw, line_color=(
10, 23, 122, 255), fill_color=(255, 255, 255, 0))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't like where the line breaks - either new line before line_color or same line with the color

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stupid formatter

line_color: tuple[int, int , int, int]=(0, 0, 0, 255), embedded_color=False) -> Image:
# pylint: disable=too-many-locals, too-many-arguments
def signwriting_to_image(fsw: str, antialiasing=True, trust_box=True, embedded_color=False,
line_color: Tuple[int, int, int, int] = (0, 0, 0, 255),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps it is worth, for readability:

type RGBA = Tuple[int, int, int, int]

@@ -53,7 +55,7 @@ def signwriting_to_image(fsw: str, antialiasing=True, trust_box=True,
x, y = symbol["position"]
x, y = x - min_x, y - min_y
symbol_id = key2id(symbol["symbol"])
draw.text((x, y), symbol_fill(symbol_id), (255, 255, 255, 255), fill_font)
draw.text((x, y), symbol_fill(symbol_id), fill_color, fill_font, embedded_color=embedded_color)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we name these variables? fill=fill_color, font=fill_font

@@ -55,10 +54,9 @@ def test_image_small_box_is_corrected(self):
assert_array_equal(np.array(image), np.array(reference_image))

def test_image_with_line_and_embedded_color(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test is now problematic as it tests too many things at once: line color, and transparent fill.
the name suggests it tests embedded_color but it doesn't

needs at least three tests:

  1. embedded_color
  2. line_color
  3. fill_color
  4. ideally, line and fill
  5. ideally, line and embedded

@bipinkrish
Copy link
Contributor Author

Its done.

@AmitMY AmitMY merged commit 75b6e3d into sign-language-processing:main Apr 11, 2024
2 checks passed
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