Skip to content

taKana671/MaskImageGenerator

Repository files navigation

MaskImageGenerator

This is a repository for creating mask images. The mask images can be used when processing noise.

Requirements

  • numpy 2.2.4
  • opencv-contrib-python 4.11.0.86
  • opencv-python 4.11.0.86

Environment

  • Python 3.12
  • Windows11

Radial Gradient

demo1

from radial_gradient_generator import RadialGradientMask, TransparentRadialGradientMask

RadialGradientMask.output_image()
TransparentRadialGradientMask.output_image()

# if you want only numpy.ndarray of the image
# generator = RadialGradientMask()
# arr = generator.get_gradient_array()

parameters

  • height: int

    • The height of an image; default is 256.
  • width: int

    • The width of an image; default is 256.
  • center_h: int

    • y-axis center; must be positive; heght // 2, if not specified.
  • center_w: int

    • x-axis center; must be positive; width // 2, if not specified.
  • gradient_size: float

    • The larger the gradient_size, the smaller the circle of the gradient become; default is 2.0.
  • inner_to_outer: bool

    • If True, from the center to edges of an image, gradient changes color from black to white; if False, from the edges to center, it does; default is True.

Horizontal Gradient

demo2

from linear_gradient_generator import HorizontalGradientMask, TransparentHorizontalGradientMask

HorizontalGradientMask.output_image()
TransparentHorizontalGradientMask.output_image()

# if you want only numpy.ndarray of the image
# generator = HorizontalGradientMask()
# arr = generator.get_gradient_3d()

parameters

  • height: int

    • The height of an image; default is 256.
  • width: int

    • The width of an image; default is 256.
  • left_to_right: bool

    • If True, from the left to right of an image, gradient changes color from black to white; if False, from the right to left, it does; default is True.

Vertical Gradient

demo3

from linear_gradient_generator import VerticalGradientMask, TransparentVerticalGradientMask

VerticalGradientMask.output_image()
TransparentVerticalGradientMask.output_image()

# if you want only numpy.ndarray of the image
# generator = VerticalGradientMask()
# arr = generator.get_gradient_3d()

parameters

height (int): The height of an image. width (int): The width of an image. left_to_right (bool): If True, from the left to right of an image, gradient changes color from black to white; if False, from the right to left, it does.

  • height: int

    • The height of an image; default is 256.
  • width: int

    • The width of an image; default is 256.
  • top_to_bottom: bool

    • If True, from the top to bottom of an image, gradient changes color from black to white; if False, from the bottom to top, it does; default is True.

About

A repository for creating mask images

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages