|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.shapelogic.imageprocessing.BaseVectorizer
public abstract class BaseVectorizer
Input image needs to be binary, that is gray scale with inverted LUT. That the background is white, 0, and the foreground is black, 255. When it handles a point it will mark a point as used and what type it has. I put the result in a polygon. How do I know where to start? I will start taking the pixels until I meet the first black pixel, and I will work out from there. Cycle starting at (1,0) to (1,1) to (0,1) so in what would normally be counter clockwise, but since the coordinate system is turned upside down it is clockwise Terminology: Current: the short line that is currently handled Short line: there are 2 pieces, a short line at the end and everything before that
Field Summary | |
---|---|
protected byte |
_currentDirection
|
protected int |
_currentPixelIndex
this is the index into the _pixels where the current point is |
protected CPointInt |
_currentPoint
last point where you are |
protected int[] |
_cyclePoints
What you need to add to the the index in the pixels array to get to the indexed point |
protected java.util.List<java.util.Set<IPoint2D>> |
_endPointsClusters
|
protected java.lang.String |
_errorMessage
|
protected int |
_firstPointInLineIndex
|
protected CPointInt |
_firstPointInMultiLine
|
protected java.lang.Object |
_matchingOH
|
protected int |
_maxX
|
protected int |
_maxY
|
protected int |
_minX
|
protected int |
_minY
|
protected int |
_numberOfPointsInAllLines
|
protected byte[] |
_pixels
|
protected PixelTypeCalculator |
_pixelTypeCalculator
|
protected IPixelTypeFinder |
_pixelTypeFinder
|
protected NumericRule[] |
_rulesArrayForLetterMatching
|
protected java.util.ArrayList<CPointInt> |
_unfinishedPoints
|
static int |
MAX_DISTANCE_BETWEEN_CLUSTER_POINTS
|
static java.lang.String |
POLYGON
|
static java.lang.String |
RAW_POLYGON
|
static byte |
STRAIGHT_LINE_COLOR
|
Fields inherited from interface ij.plugin.filter.PlugInFilter |
---|
CONVERT_TO_FLOAT, DOES_16, DOES_32, DOES_8C, DOES_8G, DOES_ALL, DOES_RGB, DOES_STACKS, DONE, FINAL_PROCESSING, NO_CHANGES, NO_IMAGE_REQUIRED, NO_UNDO, PARALLELIZE_STACKS, ROI_REQUIRED, SNAPSHOT, STACK_REQUIRED, SUPPORTS_MASKING |
Constructor Summary | |
---|---|
BaseVectorizer()
|
Method Summary | |
---|---|
protected void |
addToUnfinishedPoints(CPointInt newPoint)
|
int |
countRegionCrossingsAroundPoint(int pixelIndex)
A normal line has a crossing index of 4. |
protected void |
drawLine(CLine line)
|
protected void |
drawLines()
Draws the vectorized lines on the original image for visual inspection. |
protected void |
findAllLines()
|
protected boolean |
findFirstLinePoint()
|
protected abstract void |
findMultiLine()
|
protected void |
findMultiLinePostProcess()
To be overridden. |
protected boolean |
findMultiLinePreProcess()
|
PixelTypeCalculator |
findPointType(int pixelIndex,
PixelTypeCalculator reusedPixelTypeCalculator)
|
Polygon |
getCleanedupPolygon()
|
int[] |
getCyclePoints()
What you need to add to the the index in the pixels array to get to the indexed point. |
java.lang.String |
getErrorMessage()
|
java.lang.Object |
getMatchingOH()
|
int |
getMaxX()
|
int |
getMaxY()
|
int |
getMinX()
|
int |
getMinY()
|
byte[] |
getPixels()
|
java.util.Collection<IPoint2D> |
getPoints()
|
Polygon |
getPolygon()
|
protected abstract byte |
handleProblematicPoints()
|
protected void |
init(ij.process.ImageProcessor ip)
Cannot handle the last pixel at the edge, so for now just ignore it. |
protected abstract void |
internalFactory()
All the objects that needs special version should be created here. |
boolean |
isGuiEnabled()
To be overridden. |
boolean |
isPixelUsed(int pixelIndex)
Not background and the used bit set to 0 |
protected abstract boolean |
lastPixelOk(byte newDirection)
|
protected void |
matchLines()
This does really not belong in a vectorizer. |
protected void |
moveCurrentPointForwards(byte newDirection)
|
static byte |
oppesiteDirection(byte direction)
|
CPointInt |
pixelIndexToPoint(int pixelIndex)
|
int |
pointToPixelIndex(int x,
int y)
|
int |
pointToPixelIndex(IPoint2D point)
|
protected Polygon |
polygonFactory()
|
void |
run(ij.process.ImageProcessor ip)
|
int |
setup(java.lang.String arg,
ij.ImagePlus imp)
|
void |
showMessage(java.lang.String text)
|
void |
showMessage(java.lang.String title,
java.lang.String text)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String POLYGON
public static final java.lang.String RAW_POLYGON
public static final int MAX_DISTANCE_BETWEEN_CLUSTER_POINTS
public static final byte STRAIGHT_LINE_COLOR
protected byte[] _pixels
protected int _minX
protected int _maxX
protected int _minY
protected int _maxY
protected int[] _cyclePoints
protected CPointInt _currentPoint
protected CPointInt _firstPointInMultiLine
protected PixelTypeCalculator _pixelTypeCalculator
protected java.util.ArrayList<CPointInt> _unfinishedPoints
protected int _currentPixelIndex
protected byte _currentDirection
protected int _numberOfPointsInAllLines
protected java.lang.Object _matchingOH
protected java.lang.String _errorMessage
protected java.util.List<java.util.Set<IPoint2D>> _endPointsClusters
protected int _firstPointInLineIndex
protected IPixelTypeFinder _pixelTypeFinder
protected NumericRule[] _rulesArrayForLetterMatching
Constructor Detail |
---|
public BaseVectorizer()
Method Detail |
---|
public boolean isGuiEnabled()
public void run(ij.process.ImageProcessor ip)
run
in interface ij.plugin.filter.PlugInFilter
protected void matchLines()
protected void findAllLines()
protected abstract void findMultiLine()
protected abstract byte handleProblematicPoints()
public boolean isPixelUsed(int pixelIndex)
public PixelTypeCalculator findPointType(int pixelIndex, PixelTypeCalculator reusedPixelTypeCalculator)
findPointType
in interface IPixelTypeFinder
public static byte oppesiteDirection(byte direction)
protected void moveCurrentPointForwards(byte newDirection)
protected abstract boolean lastPixelOk(byte newDirection)
protected void init(ij.process.ImageProcessor ip)
protected abstract void internalFactory()
public int setup(java.lang.String arg, ij.ImagePlus imp)
setup
in interface ij.plugin.filter.PlugInFilter
public int pointToPixelIndex(int x, int y)
public int pointToPixelIndex(IPoint2D point)
public CPointInt pixelIndexToPoint(int pixelIndex)
protected boolean findFirstLinePoint()
public int countRegionCrossingsAroundPoint(int pixelIndex)
protected void findMultiLinePostProcess()
protected boolean findMultiLinePreProcess()
protected void addToUnfinishedPoints(CPointInt newPoint)
protected void drawLines()
public void showMessage(java.lang.String text)
public void showMessage(java.lang.String title, java.lang.String text)
public java.util.Collection<IPoint2D> getPoints()
protected void drawLine(CLine line)
protected Polygon polygonFactory()
public Polygon getPolygon()
public java.lang.Object getMatchingOH()
public java.lang.String getErrorMessage()
public Polygon getCleanedupPolygon()
public int[] getCyclePoints()
PixelJumperByte
getCyclePoints
in interface PixelJumperByte
public int getMaxX()
getMaxX
in interface PixelJumperByte
public int getMaxY()
getMaxY
in interface PixelJumperByte
public int getMinX()
getMinX
in interface PixelJumperByte
public int getMinY()
getMinY
in interface PixelJumperByte
public byte[] getPixels()
getPixels
in interface PixelJumperByte
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |