|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.shapelogic.imageutil.BaseImageOperation org.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 Polygon |
_cleanedupPolygon
|
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 boolean |
_displayInternalInfo
|
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 |
_nextCount
|
protected int |
_numberOfPointsInAllLines
|
protected byte[] |
_pixels
|
protected PixelTypeCalculator |
_pixelTypeCalculator
|
protected IPixelTypeFinder |
_pixelTypeFinder
|
protected NumericRule[] |
_rulesArrayForLetterMatching
|
protected ListStream<Polygon> |
_stream
|
protected java.lang.String |
_streamName
Really stream name but could be changed to _name. |
protected java.util.ArrayList<CPointInt> |
_unfinishedPoints
|
protected int |
_yForUnporcessedPixel
|
static int |
MAX_DISTANCE_BETWEEN_CLUSTER_POINTS
|
static byte |
STRAIGHT_LINE_COLOR
|
Fields inherited from class org.shapelogic.imageutil.BaseImageOperation |
---|
_arg, _guiWrapper, _image, _keyValueParser, _setupReturnValue |
Constructor Summary | |
---|---|
BaseVectorizer()
|
Method Summary | |
---|---|
protected void |
addToUnfinishedPoints(CPointInt newPoint)
|
protected void |
cleanPolygon()
|
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. This is probably not needed in the final version of this class. |
protected void |
findAllLines()
|
protected boolean |
findFirstLinePoint(boolean process)
Find first point that is not a unused foreground point. |
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()
|
ij.process.ImageProcessor |
getImageProcessor()
Get an ImageJ ImageProcessor This introduces dependency of ImageJ in a image processing algorithm, and should ideally be abstracted out. |
java.lang.Object |
getMatchingOH()
|
int |
getMaxX()
|
int |
getMaxY()
|
int |
getMinX()
|
int |
getMinY()
|
byte[] |
getPixels()
|
java.util.Collection<IPoint2D> |
getPoints()
|
Polygon |
getPolygon()
|
ListStream<Polygon> |
getStream()
Used when calling in lazy mode. |
java.lang.String |
getStreamName()
Really stream name but could be changed to _name. |
protected abstract byte |
handleProblematicPoints()
|
boolean |
hasNext()
|
void |
init()
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 |
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)
|
Polygon |
next()
Currently returns the cleaned up polygons. |
static byte |
oppesiteDirection(byte direction)
|
CPointInt |
pixelIndexToPoint(int pixelIndex)
|
int |
pointToPixelIndex(int x,
int y)
|
int |
pointToPixelIndex(IPoint2D point)
|
protected Polygon |
polygonFactory()
|
void |
remove()
|
void |
run()
|
void |
setStreamName(java.lang.String name)
Really stream name but could be changed to _name. |
Methods inherited from class org.shapelogic.imageutil.BaseImageOperation |
---|
getGuiWrapper, getImage, getKeyValueParser, getSetupReturnValue, isImageValid, setArg, setGuiWrapper, setKeyValueParser, setSetupReturnValue, setup, showAbout, showMessage |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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 Polygon _cleanedupPolygon
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
protected ListStream<Polygon> _stream
protected java.lang.String _streamName
protected int _yForUnporcessedPixel
protected int _nextCount
protected boolean _displayInternalInfo
Constructor Detail |
---|
public BaseVectorizer()
Method Detail |
---|
public void run()
run
in interface java.lang.Runnable
protected void cleanPolygon()
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)
public void init()
protected abstract void internalFactory()
public int pointToPixelIndex(int x, int y)
public int pointToPixelIndex(IPoint2D point)
public CPointInt pixelIndexToPoint(int pixelIndex)
protected boolean findFirstLinePoint(boolean process)
public int countRegionCrossingsAroundPoint(int pixelIndex)
protected void findMultiLinePostProcess()
protected boolean findMultiLinePreProcess()
protected void addToUnfinishedPoints(CPointInt newPoint)
protected void drawLines()
public ij.process.ImageProcessor getImageProcessor()
public java.util.Collection<IPoint2D> getPoints()
protected void drawLine(CLine line)
protected Polygon polygonFactory()
public Polygon getPolygon()
public ListStream<Polygon> getStream()
LazyPlugInFilter
getStream
in interface LazyPlugInFilter<Polygon>
public boolean hasNext()
hasNext
in interface java.util.Iterator<Polygon>
public Polygon next()
next
in interface java.util.Iterator<Polygon>
public void remove()
remove
in interface java.util.Iterator<Polygon>
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
public java.lang.String getStreamName()
getStreamName
in interface LazyPlugInFilter<Polygon>
public void setStreamName(java.lang.String name)
setStreamName
in interface LazyPlugInFilter<Polygon>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |