类 ComponentPool
- java.lang.Object
-
- cc.chungkwong.mathocr.offline.ComponentPool
-
public class ComponentPool extends Object
A data structure that store connected components
-
-
构造器概要
构造器 构造器 说明 ComponentPool(byte[] pixels, int width, int height)Construct a ComponentPool by connected component analysisComponentPool(BufferedImage image)Construct a ComponentPool by connected component analysis
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidcleanPageEdges(int width, int height)Remove all connected components that touch bound of the image(they are likely to be noise)intcountConnectedComponent(int left, int right, int top, int bottom)Count number of components intersect with a given areavoidfilterNoise()voidfilterNoise(int width, int height)Filter out small componentsintgetAverageHeight()Get average height of the connected componentsintgetAverageWidth()Get average width of the connected componentsBoundBoxgetBoundBox()ArrayList<ConnectedComponent>getComponents()Get all the connected components
-
-
-
构造器详细资料
-
ComponentPool
public ComponentPool(byte[] pixels, int width, int height)Construct a ComponentPool by connected component analysis- 参数:
pixels- the input imagewidth- the width of the imageheight- the height of the image
-
ComponentPool
public ComponentPool(BufferedImage image)
Construct a ComponentPool by connected component analysis- 参数:
image- the input image
-
-
方法详细资料
-
countConnectedComponent
public int countConnectedComponent(int left, int right, int top, int bottom)Count number of components intersect with a given area- 参数:
left- left boundright- right boundtop- upper boundbottom- lower bound- 返回:
- the number
-
getComponents
public ArrayList<ConnectedComponent> getComponents()
Get all the connected components- 返回:
- a set of connected components
-
getAverageHeight
public int getAverageHeight()
Get average height of the connected components- 返回:
- the average height
-
getAverageWidth
public int getAverageWidth()
Get average width of the connected components- 返回:
- the average width
-
filterNoise
public void filterNoise()
-
filterNoise
public void filterNoise(int width, int height)Filter out small components- 参数:
width- the width of the imageheight- the width of the image
-
cleanPageEdges
public void cleanPageEdges(int width, int height)Remove all connected components that touch bound of the image(they are likely to be noise)- 参数:
width-height-
-
getBoundBox
public BoundBox getBoundBox()
-
-