public class EdgeMap extends Object
T-Plan Robot Enterprise, (C) 2009-2022 T-Plan Limited. All rights reserved.
Modifier and Type | Field and Description |
---|---|
static int |
DIRECTION_BOTH
Mask indicating a map based on a combination of both horizontal and
vertical gradients.
|
static int |
DIRECTION_HORIZONTAL
Mask indicating a map based on horizontal gradients.
|
static int |
DIRECTION_VERTICAL
Mask indicating a map based on vertical gradients.
|
static int |
EDGE_TYPE_FULL |
static int |
EDGE_TYPE_THIN |
static int |
TYPE_BLUE
Type mask of indicating a map created of the blue channel gradients.
|
static int |
TYPE_GREEN
Type mask of indicating a map created of the green channel gradients.
|
static int |
TYPE_RED
Type mask of indicating a map created of the red channel gradients.
|
static int |
TYPE_RGB
Type mask indicating that the map is created of a combination of red,
green and blue channel gradients.
|
Constructor and Description |
---|
EdgeMap(BufferedImage image,
int type,
int edgeType,
int threshold,
int direction)
Construct a new edge map.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
Match this object against another intensity map or a 2-dimensional byte
array.
|
byte[][] |
getEdgeMap()
Get the edge map.
|
int |
getHeight()
Get the map height.
|
int |
getThreshold()
Get the intensity gradient threshold the map was created with.
|
int |
getType()
Get the map type.
|
int |
getWidth()
Get the map width.
|
String |
toString() |
static String |
toString(byte[][] array,
boolean condensed,
Rectangle r)
Convert the byte array to a string suitable for printing.
|
public static final int TYPE_RED
public static final int TYPE_GREEN
public static final int TYPE_BLUE
public static final int TYPE_RGB
TYPE_RED
, TYPE_GREEN
and TYPE_BLUE
components.public static final int DIRECTION_HORIZONTAL
public static final int DIRECTION_VERTICAL
public static final int DIRECTION_BOTH
public static final int EDGE_TYPE_FULL
public static final int EDGE_TYPE_THIN
public EdgeMap(BufferedImage image, int type, int edgeType, int threshold, int direction)
image
- an image to retrieve the edges from.type
- the map type. It can be a single RGB channel represented by
one of the TYPE_RED
, TYPE_GREEN
and TYPE_BLUE
masks or a combination (logical OR) of them. For example, to create a map
which detects edges based on the changes in the blue and green channel
use the type of "TYPE_GREEN
} | TYPE_BLUE
".edgeType
- the edge type, either EDGE_TYPE_FULL
or
EDGE_TYPE_THIN
.threshold
- the threshold.direction
- the edge detection direction, one of
DIRECTION_VERTICAL
, DIRECTION_HORIZONTAL
or
DIRECTION_BOTH
.public boolean equals(Object o)
public int getType()
TYPE_RED
,
TYPE_GREEN
and TYPE_BLUE
masks or any logical OR of
these constants.public int getWidth()
public int getHeight()
public int getThreshold()
public byte[][] getEdgeMap()
public static String toString(byte[][] array, boolean condensed, Rectangle r)
array
- a byte array.condensed
- true will omit spaces among numbers (suitable for bit
maps).r
- optional rectangle to limit the output to.