Package cz.vutbr.fit.layout.cormier.impl
Class CormierSegmentation
- java.lang.Object
-
- cz.vutbr.fit.layout.cormier.impl.CormierSegmentation
-
public class CormierSegmentation extends Object
Implementation of the Cormier web segmentation method.
-
-
Constructor Summary
Constructors Constructor Description CormierSegmentation(EdgeDetector edgeDetector, LineDetector lineDetector, int minSegmentLength, float signLineProbThreshold)CormierSegmentation(EdgeDetector edgeDetector, LineDetector lineDetector, int minSegmentLength, float signLineProbThreshold, boolean parallelEnabled)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EdgeDetectorgetEdgeDetector()LineDetectorgetLineDetector()intgetMinSegmentLength()floatgetSignLineProbThreshold()AreaTreerun(byte[] imageData, org.eclipse.rdf4j.model.IRI iri)AreaTreerun(Page page)voidsetEdgeDetector(EdgeDetector edgeDetector)voidsetLineDetector(LineDetector lineDetector)voidsetMinSegmentLength(int minSegmentLength)voidsetSignLineProbThreshold(float signLineProbThreshold)
-
-
-
Constructor Detail
-
CormierSegmentation
public CormierSegmentation(EdgeDetector edgeDetector, LineDetector lineDetector, int minSegmentLength, float signLineProbThreshold)
- Parameters:
edgeDetector- Edge detector instance used for getting probabilities of locally significant edges.lineDetector- Line detector instance used for gettine probabilities of semantically significant lines.minSegmentLength- Minimum length of any side of each segment.signLineProbThreshold- Minimum probability that line is significant for it to be used for segmentation.
-
CormierSegmentation
public CormierSegmentation(EdgeDetector edgeDetector, LineDetector lineDetector, int minSegmentLength, float signLineProbThreshold, boolean parallelEnabled)
- Parameters:
parallelEnabled- If thesegment(Area, Pair, Pair)parallelization will be enabled. Disabling this will cause significant slow down on multithreaded systems.- See Also:
CormierSegmentation(EdgeDetector, LineDetector, int, float)
-
-
Method Detail
-
getEdgeDetector
public EdgeDetector getEdgeDetector()
- Returns:
- Edge detector instance used for getting probabilities of locally significant edges.
-
setEdgeDetector
public void setEdgeDetector(EdgeDetector edgeDetector)
- Parameters:
edgeDetector- Edge detector instance used for getting probabilities of locally significant edges.
-
getLineDetector
public LineDetector getLineDetector()
- Returns:
- Line detector instance used for gettine probabilities of semantically significant lines.
-
setLineDetector
public void setLineDetector(LineDetector lineDetector)
- Parameters:
lineDetector- Line detector instance used for gettine probabilities of semantically significant lines.
-
getMinSegmentLength
public int getMinSegmentLength()
- Returns:
- Minimum length of any side of each segment.
-
setMinSegmentLength
public void setMinSegmentLength(int minSegmentLength)
- Parameters:
minSegmentLength- Minimum length of any side of each segment.
-
getSignLineProbThreshold
public float getSignLineProbThreshold()
- Returns:
- Minimum probability that line is significant for it to be used for segmentation.
-
setSignLineProbThreshold
public void setSignLineProbThreshold(float signLineProbThreshold)
- Parameters:
signLineProbThreshold- Minimum probability that line is significant for it to be used for segmentation.
-
run
public AreaTree run(Page page) throws IOException
- Parameters:
page- Target page which will be segmented. Make sure it's possible to get a screenshot of it usingPage.getPngImage().- Returns:
- X-Y tree of rectangular, non-overlapping segments, where each node's children fully cover the parent segment's area, with root node covering the whole image and leaf nodes being the most granular segments.
- Throws:
IOException- If failed to process the screenshot of the given page.
-
run
public AreaTree run(byte[] imageData, org.eclipse.rdf4j.model.IRI iri) throws IOException
- Parameters:
imageData- Screenshot of the page which will be segmented.iri- IRI which will be assigned to the resultingAreaTree.- Returns:
- X-Y tree of rectangular, non-overlapping segments, where each node's children fully cover the parent segment's area, with root node covering the whole image and leaf nodes being the most granular segments.
- Throws:
IOException- If failed to process the provided image data.
-
-