Filter

Applying Filters to Captured Images #

Applying filters to captured images can sometimes lead to more accurate judgment processing.

How to Use #

Enter the desired filter in the “Filter” column of the table.

How to Enter #

Connect the filter and parameters with “,” and enclose each filter with “{}”.
Note: Filters marked with ★ require grayscale conversion. Add {Grayscale}.
Example: {Grayscale}{Canny,50,110}

{Grayscale} #

Convert the image to grayscale.

{CvtColor,n1} #

Change the color space of the image.

  • n1: ColorConversionCodes (40: toHSV 44: toLab 50: toLuv 52: toHLS 54: HSVtoBGR 56:LabtoBGR 58: LuvtoBGR 60: HLStoBGR)

★{Canny,n1,n2} #

{Canny,50,110}
Perform edge detection on the image.

★{Laplacian,n1,n2,n3} #

{Laplacian,3,2,0}
Perform edge detection on the image.

  • n1: KernelSize (1 ~ 31)
    Filter width ※odd number
  • n2: Scale (1 ~ )
    Scale factor for the calculated Laplacian
  • n3: Delta (0 ~ )
    Optional value added to the result
    Reference:http://nobotta.dazoo.ne.jp/blog/?p=488

★{Threshold,n1,n2,n3} #

{Threshold,127,255,0}
Binarize the image.

  • n1: Thresh (0 ~ 255)
    Threshold value.
  • n2: Maxval (0 ~ 255)
    Brightness value after binarization.
  • n3: ThresholdTypes (0: Binary 1: BinaryInv 2: Trunc 4: ToZeroInv 8: Otsu 16: Triangle)
    *If ThresholdTypes is set to 8, setting Thresh to 0 will automatically calculate the threshold value.

★{AdaptiveThreshold,n1,n2,n3,n4,n5} #

{AdaptiveThreshold,255,1,0,9,12}
Perform adaptive binarization on the image.

  • n1: Maxval (0 ~ 255)
    Brightness value after binarization.
  • n2: AdaptiveThresholdTypes (0: MeanC 1: GaussianC)
    Algorithm used for adaptive thresholding.
  • n3: ThresholdTypes (0: Binary 1: BinaryInv 2: Trunc 4: ToZeroInv 8: Otsu 16: Triangle)
    Algorithm used for thresholding.
  • n4: BlockSize (1 ~ )
    Neighborhood size. *odd number
  • n5: c (0 ~ )
    Constant subtracted from the calculation result
    Reference:https://schima.hatenablog.com/entry/2013/10/19/085019

★{Sauvola,n1,n2,n3} #

{Sauvola,7,0.15,32} Binarize the image using the Sauvola method (a type of adaptive binarization).

  • n1: KernelSize (1 ~ ) Filter width *odd number
  • n2: k (x.x ~ )
  • n3: r ( ~ )

★{Nick,n1,n2} #

{Nick,7,-0.1} Binarize the image using the Nick method (a type of adaptive binarization).

  • n1: KernelSize (1 ~ ) Filter width ※odd number
  • n2: k (-0.2 ~ -0.1)

{BitwiseNot} #

Invert the image (negative ↔ positive).

{Separation,n1} #

Separate R/G/B from the image. ※Will be grayscaled.

  • n1: Color (0: B 1: G 2: R)

{InRange,n1,n2,n3,n4,n5,n6} Color #

{InRange,n1,n2} Grayscale #

Extract colors within the specified range and create a binary image. [Color]

  • n1,n2,n3: lowerb (0 ~ 255) Lower limits for B, G, R respectively
  • n4,n5,n6: upperb (0 ~ 255) Upper limits for B, G, R respectively [Grayscale]
  • n1: lowerb (0 ~ 255) Lower limit of brightness value
  • n2: upperb (0 ~ 255) Upper limit of brightness value

{Blur,n1,n2} #

{Blur,5,5} Smooth the image. Average blur.

{GaussianBlur,n1,n2,n3} #

{GaussianBlur,5,5,0} Smooth the image.

  • n1: Kernel size (1 ~ ) Kernel size in x direction *odd number
  • n2: Kernel size (1 ~ ) Kernel size in y direction *odd number
  • n3: SigmaX (0 ~ ) Standard deviation of Kernel
    *SigmaY = SigmaX
    *If 0 is specified, it’s automatically calculated from Kernel size.

{MedianBlur,n1} #

{MedianBlur,5}
Smooth the image. Median blur.

  • n1: Kernel size (1 ~ )
    Filter width *odd number

{BilateralFilter,n1,n2,n3} #

{BilateralFilter,5,50,20}
Smooth the image while preserving edges.

  • n1: d (0 ~ )
    Diameter of each pixel neighborhood (auto-calculated if 0). Larger values increase blur.
  • n2: sigmaColor (0 ~ )
    Standard deviation in color space
  • n3: sigmaSpace (0 ~ )
    Standard deviation in coordinate space.
    Reference:https://negizoku.hatenablog.jp/entry/2020/09/20/225354

{Erode,n1} #

Erosion filter

  • n1: Iterations (1 ~ )
    Number of times to apply the filter

{Dilate,n1} #

Dilation filter

  • n1: Iterations (1 ~ )
    Number of times to apply the filter

{MorphologyEx,n1,n2} #

Various morphological operations (processing based on shape and contour)