类 ConnectedComponent
- java.lang.Object
-
- cc.chungkwong.mathocr.offline.ConnectedComponent
-
- 所有已实现的接口:
Externalizable,Serializable,Comparable<ConnectedComponent>
public final class ConnectedComponent extends Object implements Externalizable, Comparable<ConnectedComponent>
A data structure represent a connented component- 另请参阅:
- 序列化表格
-
-
字段概要
字段 修饰符和类型 字段 说明 intcordBottomintcordLeftintcordRightintcordTopstatic Comparator<ConnectedComponent>FROM_LEFT
-
构造器概要
构造器 构造器 说明 ConnectedComponent()Construct a empty ConnectedComponentConnectedComponent(int cordLeft, int cordRight, int cordTop, int cordBottom)Construct a empty ConnectedComponent with given boundsConnectedComponent(BoundBox box)Construct a empty ConnectedComponent with given boundsConnectedComponent(RunLength runlength)Construct a ConnectedComponent with a single RunLengthConnectedComponent(BufferedImage image)Construct a empty ConnectedComponent
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 voidaddRunLength(RunLength runlength)Add a RunLengthvoidaddRunLengthToLast(RunLength runlength)Add a RunLength provided that it is greater than all the RunLength already in the ConnectedComponent this method is added to enhance performance of connected component analysisstatic ConnectedComponentcombine(List<ConnectedComponent> c)Form a ConnectedComponent by combining a list of ConnectedComponentvoidcombineWith(ConnectedComponent c)Merge this component with cintcompareTo(ConnectedComponent ele)Compare first runlength of ConnectedComponentvoidfix()intgetBottom()Get the position of the bottom of the component in the imageBoundBoxgetBox()doublegetCenterX()Get the horizontal centerdoublegetCenterY()Get the vertical centerdoublegetCentralMoment(int p, int q)Get the standardized momentdoublegetDensity()Get the densitydoublegetDirection()Get the directionintgetHeight()Get the heightbyte[]getHorizontalCrossing()Compute horizontal crossing numbersintgetLeft()Get the position of the left of the component in the imagedoublegetMoment(int p, int q)Get the momentintgetNumberOfHoles()Get the number of holesintgetRight()Get the position of the right of the component in the imageList<RunLength>getRunLengths()Get the runlengths in the componentintgetTop()Get the position of the top of the component in the imagebyte[]getVerticalCrossing()Compute vertical crossing numbersintgetWeight()Get the WeightintgetWidth()Get the widthvoidreadExternal(ObjectInput in)Load ConnectedComponent from streamConnectedComponentsplitHorizontally(int x)Split this component horizontallyConnectedComponentsplitVertically(int y)Split this component verticallybyte[][]toPixelArray()Get two dimension pixels array representationbyte[]toPixelArray2()Get one dimension pixels array representationStringtoString()Get String that show the shapevoidwriteExternal(ObjectOutput out)Write this object to stream
-
-
-
字段详细资料
-
FROM_LEFT
public static final Comparator<ConnectedComponent> FROM_LEFT
-
cordTop
public int cordTop
-
cordLeft
public int cordLeft
-
cordBottom
public int cordBottom
-
cordRight
public int cordRight
-
-
构造器详细资料
-
ConnectedComponent
public ConnectedComponent()
Construct a empty ConnectedComponent
-
ConnectedComponent
public ConnectedComponent(BufferedImage image)
Construct a empty ConnectedComponent- 参数:
image- Binarized image
-
ConnectedComponent
public ConnectedComponent(BoundBox box)
Construct a empty ConnectedComponent with given bounds- 参数:
box-
-
ConnectedComponent
public ConnectedComponent(int cordLeft, int cordRight, int cordTop, int cordBottom)Construct a empty ConnectedComponent with given bounds- 参数:
cordLeft- left boundcordRight- right boundcordTop- upper boundcordBottom- lower bound
-
ConnectedComponent
public ConnectedComponent(RunLength runlength)
Construct a ConnectedComponent with a single RunLength- 参数:
runlength- the RunLength
-
-
方法详细资料
-
addRunLength
public void addRunLength(RunLength runlength)
Add a RunLength- 参数:
runlength- the RunLength to be added
-
addRunLengthToLast
public void addRunLengthToLast(RunLength runlength)
Add a RunLength provided that it is greater than all the RunLength already in the ConnectedComponent this method is added to enhance performance of connected component analysis- 参数:
runlength- the RunLength to be added
-
getRunLengths
public List<RunLength> getRunLengths()
Get the runlengths in the component- 返回:
- the runlengths
-
combineWith
public void combineWith(ConnectedComponent c)
Merge this component with c- 参数:
c- the component to merge
-
combine
public static ConnectedComponent combine(List<ConnectedComponent> c)
Form a ConnectedComponent by combining a list of ConnectedComponent- 参数:
c- the ConnectedComponent to be combined- 返回:
- combination result
-
splitHorizontally
public ConnectedComponent splitHorizontally(int x)
Split this component horizontally- 参数:
x- the coordinate of the line to be used to split- 返回:
- the right one
-
splitVertically
public ConnectedComponent splitVertically(int y)
Split this component vertically- 参数:
y- the coordinate of the line to be used to split- 返回:
- the lower one
-
getTop
public int getTop()
Get the position of the top of the component in the image- 返回:
- the coordinate
-
getBottom
public int getBottom()
Get the position of the bottom of the component in the image- 返回:
- the coordinate
-
getLeft
public int getLeft()
Get the position of the left of the component in the image- 返回:
- the coordinate
-
getRight
public int getRight()
Get the position of the right of the component in the image- 返回:
- the coordinate
-
getWidth
public int getWidth()
Get the width- 返回:
- width
-
getHeight
public int getHeight()
Get the height- 返回:
- height
-
getHorizontalCrossing
public byte[] getHorizontalCrossing()
Compute horizontal crossing numbers- 返回:
- horizontal crossing numbers
-
getVerticalCrossing
public byte[] getVerticalCrossing()
Compute vertical crossing numbers- 返回:
- vertical crossing numbers
-
getMoment
public double getMoment(int p, int q)Get the moment- 参数:
p- the order of xq- the order of y- 返回:
- the moment
-
getCentralMoment
public double getCentralMoment(int p, int q)Get the standardized moment- 参数:
p- the order of xq- the order of y- 返回:
- the moment
-
getCenterX
public double getCenterX()
Get the horizontal center- 返回:
- the horizontal center
-
getCenterY
public double getCenterY()
Get the vertical center- 返回:
- the vertical center
-
getDirection
public double getDirection()
Get the direction- 返回:
- direction
-
getDensity
public double getDensity()
Get the density- 返回:
- density
-
getWeight
public int getWeight()
Get the Weight- 返回:
- weight
-
getNumberOfHoles
public int getNumberOfHoles()
Get the number of holes- 返回:
- number of holes
-
toPixelArray
public byte[][] toPixelArray()
Get two dimension pixels array representation- 返回:
- pixels array
-
toPixelArray2
public byte[] toPixelArray2()
Get one dimension pixels array representation- 返回:
- pixels array
-
toString
public String toString()
Get String that show the shape
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
Write this object to stream- 指定者:
writeExternal在接口中Externalizable- 参数:
out- output stream- 抛出:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException
Load ConnectedComponent from stream- 指定者:
readExternal在接口中Externalizable- 参数:
in- input stream- 抛出:
IOException
-
compareTo
public int compareTo(ConnectedComponent ele)
Compare first runlength of ConnectedComponent- 指定者:
compareTo在接口中Comparable<ConnectedComponent>- 参数:
ele- to be compared to- 返回:
- a integer
-
getBox
public BoundBox getBox()
-
fix
public void fix()
-
-