Skip to content
Snippets Groups Projects
Commit 08a63918 authored by Yonatan's avatar Yonatan
Browse files

Added comments

parent b4bc3fe2
Branches
No related tags found
1 merge request!1Final merge
......@@ -13,7 +13,5 @@ public interface IUnitGrouper<In extends Unit, Out extends UnitGroup> {
int DEFAULT_VERTICAL_TOLERANCE = -5;
int AUTO_CELL_COUNT = -1;
@NotNull List<Out> group(@NotNull Collection<In> units, int width, int height, int horizontalCellCount, int verticalCellCount);
@NotNull List<Out> group(@NotNull Collection<In> units, int width, int height, int horizontalCellCount, int verticalCellCount, int horizontalTolerance, int verticalTolerance);
}
......@@ -14,11 +14,6 @@ public class SimpleUnitGrouper implements IUnitGrouper<Unit, UnitGroup> {
public SimpleUnitGrouper() {
}
@Override
public @NotNull List<UnitGroup> group(@NotNull Collection<Unit> units, int width, int height, int horizontalCellCount, int verticalCellCount) {
return group(units, width, height, horizontalCellCount, verticalCellCount, 0, 0);
}
@Override
public @NotNull List<UnitGroup> group(@NotNull Collection<Unit> units, int width, int height, int horizontalCellCount, int verticalCellCount, int horizontalTolerance, int verticalTolerance) {
int hCells = horizontalCellCount;
......
......@@ -10,7 +10,23 @@ import java.util.List;
public interface IImagePostProcessor {
/**
* Processes the image with the following steps:
* - removes the text
* - draws the translated text over the original image
*
* @param image the image to process
* @param groups the groups to draw
* @return the processed image
*/
@Nullable BufferedImage processImage(@NotNull BufferedImage image, @NotNull Collection<? extends UnitGroup> groups);
/**
* Returns a list of images that represent the steps of the processImage method
*
* @param image the image to process
* @param groups the groups to draw
* @return the list of images for each step
*/
@NotNull List<BufferedImage> getDebugImages(@NotNull BufferedImage image, @NotNull Collection<? extends UnitGroup> groups);
}
......@@ -12,15 +12,16 @@ public interface IImagePreProcessor {
* Processes the image with the following steps:
* - convert to grayscale
* - convert to binary
*
* @param image the image to be processed
* @return the processed image
*/
@Nullable BufferedImage processImage(@NotNull BufferedImage image);
/**
*
* @param image
* @return
* Returns a list of images that represent the steps of the processImage method
* @param image the image to be processed
* @return the list of steps as images
*/
@NotNull List<BufferedImage> getDebugImages(@NotNull BufferedImage image);
}
......@@ -27,6 +27,15 @@ public class PostProcessor implements IImagePostProcessor {
nu.pattern.OpenCV.loadLocally();
}
/**
* Processes the image with the following steps:
* - removes the text
* - draws the translated text over the original image
*
* @param image the image to process
* @param groups the groups to draw
* @return the processed image
*/
@Override
public @Nullable BufferedImage processImage(@NotNull BufferedImage image, @NotNull Collection<? extends UnitGroup> groups) {
var img = bufferedImageToMat(image);
......@@ -47,9 +56,11 @@ public class PostProcessor implements IImagePostProcessor {
}
/**
* @param image
* @param groups
* @return
* Returns a list of images that represent the steps of the processImage method
*
* @param image the image to process
* @param groups the groups to draw
* @return the list of images for each step
*/
@Override
public @NotNull List<BufferedImage> getDebugImages(@NotNull BufferedImage image, @NotNull Collection<? extends UnitGroup> groups) {
......
......@@ -8,9 +8,11 @@ import java.util.List;
public class PreProcessor implements IImagePreProcessor {
/**
* @param image the image to be processed with the following steps:
* Processes the image with the following steps:
* - convert to grayscale
* - convert to binary
*
* @param image the image to be processed
* @return the processed image
*/
@Override
......@@ -22,8 +24,10 @@ public class PreProcessor implements IImagePreProcessor {
}
/**
* @param image
* @return
* Returns a list of images that represent the steps of the processImage method
*
* @param image the image to be processed
* @return the list of steps as images
*/
@Override
public @NotNull List<BufferedImage> getDebugImages(@NotNull BufferedImage image) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment