Skip to content

Commit

Permalink
Add morphology operation
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchdukeTim committed Dec 28, 2017
1 parent 978b4a9 commit c78b49c
Showing 1 changed file with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,28 @@ public class CVOperations {
}
)),

new OperationMetaData(CVOperation.defaults("CV rectangle",
new OperationMetaData(CVOperation.defaults("CV morphologyEx",
"Performs advanced morphological transformations."),
templateFactory.create(
SocketHints.Inputs.createMatSocketHint("src", false),
SocketHints.Inputs.createMatSocketHint("kernel", true),
SocketHints.createEnumSocketHint("op", CVMorphologyTypesEnum.MORPH_OPEN),
new SocketHint.Builder<>(Point.class).identifier("anchor").initialValueSupplier(
() -> new Point(-1, -1)).build(),
SocketHints.Inputs.createNumberSpinnerSocketHint("iterations", 1),
SocketHints.createEnumSocketHint("borderType", BorderTypesEnum.BORDER_CONSTANT),
new SocketHint.Builder<>(Scalar.class).identifier("borderValue")
.initialValueSupplier(opencv_imgproc::morphologyDefaultBorderValue).build(),
SocketHints.Outputs.createMatSocketHint("dst"),
(src, kernel, op, anchor, iterations, borderType, borderValue, dst) -> {
opencv_imgproc.morphologyEx(src, dst, op.value, kernel, anchor,
iterations.intValue(), borderType.value, borderValue);
}
)),



new OperationMetaData(CVOperation.defaults("CV rectangle",
"Draw a rectangle (outline or filled) on an image."),
templateFactory.create(
SocketHints.Inputs.createMatSocketHint("src", false),
Expand Down Expand Up @@ -426,6 +447,21 @@ public enum CVBorderTypesEnum {
}
}

public enum CVMorphologyTypesEnum {
MORPH_OPEN(2),
MORPH_CLOSE(3),
MORPH_GRADIENT(4),
MORPH_TOPHAT(5),
MORPH_BLACKHAT(6),
MORPH_HITMISS(7);

public final int value;

CVMorphologyTypesEnum(int value) {
this.value = value;
}
}


/**
* All of the operations that this list supplies.
Expand Down

0 comments on commit c78b49c

Please sign in to comment.