Class ObjectMaskMerger
Object
ObjectMaskMerger
Merges one or more
ObjectMask
s into a single object.-
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectMask
merge
(ObjectCollection objects) Merges all the objects together that are found in a collection.static ObjectMask
merge
(ObjectMask first, ObjectMask second) Merges two objects together.static BoundingBox
mergeBoundingBoxes
(Stream<ObjectMask> objects) Merges all the bounding boxes of a stream of objects.static BoundingBox
mergeBoundingBoxes
(ObjectCollection objects) Merges all the bounding boxes of a collection of objects.
-
Method Details
-
merge
Merges two objects together.This is an immutable operation.
The merged box has a minimal bounding-box to fit both objects.
Even if the two existing objects do not intersect or touch, a single merged object is nevertheless created.
It assumes that the binary-values of the merges are always 255 and 0, or 0 and 255.
- Parameters:
first
- first-object to merge.second
- second-object to merge.- Returns:
- first and second merged together.
- Throws:
AnchorFriendlyRuntimeException
- if incompatible binary-values exist in the objects for merging.
-
merge
Merges all the objects together that are found in a collection.- Parameters:
objects
- objects to be merged.- Returns:
- a newly created merged version of all the objects, with a bounding-box just big enough to include all the existing objects' bounding-boxes.
- Throws:
OperationFailedException
- if any two objects with different binary-values are merged.
-
mergeBoundingBoxes
public static BoundingBox mergeBoundingBoxes(ObjectCollection objects) throws OperationFailedException Merges all the bounding boxes of a collection of objects.- Parameters:
objects
- a stream of objects whose bounding-boxes are to be merged.- Returns:
- a bounding-box just large enough to include all the bounding-boxes of the objects.
- Throws:
OperationFailedException
- if the object-collection is empty.
-
mergeBoundingBoxes
Merges all the bounding boxes of a stream of objects.- Parameters:
objects
- a stream of objects whose bounding-boxes are to be merged- Returns:
- a bounding-box just large enough to include all the bounding-boxes of the objects
-