- java.lang.Object
-
- com.uddernetworks.newocr.utils.SegmentationUtils
-
public class SegmentationUtils extends java.lang.Object
A utility class for methods to create segments separating character images for training and scanning.- Since:
- April 25, 2019
-
-
Field Summary
Fields Modifier and Type Field Description static IntPair
ZERO_PLACEHOLDER
-
Constructor Summary
Constructors Constructor Description SegmentationUtils()
-
Method Summary
Modifier and Type Method Description static java.util.List<IntPair>
getDiagonal(boolean[][] values, boolean increasing)
Splits a grid of values in half diagonally.static java.util.stream.Stream<boolean[][]>
getHorizontalHalf(boolean[][] values)
Splits a grid of values in half horizontallystatic java.util.stream.Stream<boolean[][]>
getHorizontalThird(boolean[][] values)
Splits a grid of values in thirds horizontallystatic java.util.stream.Stream<boolean[][]>
getVerticalHalf(boolean[][] values)
Splits a grid of values in half verticallystatic java.util.stream.Stream<IntPair>
getVerticalThird(boolean[][] values)
Splits a grid of values in thirds vertically
-
-
-
Field Detail
-
ZERO_PLACEHOLDER
public static final IntPair ZERO_PLACEHOLDER
-
-
Method Detail
-
getHorizontalHalf
public static java.util.stream.Stream<boolean[][]> getHorizontalHalf(boolean[][] values)
Splits a grid of values in half horizontally- Parameters:
values
- The grid to split- Returns:
- A stream of 2 halves, top and bottom
-
getHorizontalThird
public static java.util.stream.Stream<boolean[][]> getHorizontalThird(boolean[][] values)
Splits a grid of values in thirds horizontally- Parameters:
values
- The grid to split- Returns:
- A stream of 3 thirds: top, middle, and bottom
-
getVerticalHalf
public static java.util.stream.Stream<boolean[][]> getVerticalHalf(boolean[][] values)
Splits a grid of values in half vertically- Parameters:
values
- The grid to split- Returns:
- A stream of 2 halves, left and right
-
getVerticalThird
public static java.util.stream.Stream<IntPair> getVerticalThird(boolean[][] values)
Splits a grid of values in thirds vertically- Parameters:
values
- The grid to split- Returns:
- A stream of 3 thirds: left, middle, and right
-
getDiagonal
public static java.util.List<IntPair> getDiagonal(boolean[][] values, boolean increasing)
Splits a grid of values in half diagonally. The diagonal line will be going from the top left to bottom right if `increasing` is `true`, and top left to bottom right if it is `false`.- Parameters:
values
- The grid to split into halves diagonallyincreasing
- The line's slope will be positive when `true`, and negative when `false`.- Returns:
- A List of 2 halves
-
-