net.sourceforge.javaocr
Interface Image

All Known Implementing Classes:
AbstractLinearImage, ByteImage, PixelImage

public interface Image

Image functionality. Images are opaque objects and hide implementation details (especially storage layout or actual pixel representation). Images provide way to iterate over it (thus, they are statefull and NOT thread safe), and retrieve and set current pixel. Convenience methods to set given pixels are provided, but iterating methods shall be used for high performance bulk operations

Author:
Konstantin Pribluda

Method Summary
 Image chisel(int fromX, int fromY, int width, int height)
          chisel out sub-image out of original one.
 Image column(int x)
          full column out of image
 void copy(Image dst)
          copy image content to another image
 void flip(Image dst)
          copy image swithcing axes in process
 int get()
          retrieve pixekl at current position, does not modify current image pointer
 int get(int x, int y)
          retrieve value of pixel in image specific fashion
 float getAspectRatio()
          aspect ration of this image TODO: do we actually need this?
 int getHeight()
           
 int getOriginX()
           
 int getOriginY()
           
 int getWidth()
           
 boolean hasNext()
          whether next pixel is available
 boolean horizontalSpanEquals(int y, int from, int to, int value)
          Deprecated. use iterator instead
 void iterateH(int y)
          convenience method to initialize iterator over whole image row
 void iterateH(int y, int from, int to)
          initialize iterator over part of row
 void iterateV(int x)
          convenience method to initialize iterator over whole image column
 void iterateV(int x, int from, int to)
          initialize iterator over part of column
 int next()
          advance and retrieve next available pixel
 void next(int pixel)
          store and advance to next pixel
 void put(int value)
          store pixel at current position, does not modify current image pointer
 void put(int x, int y, int value)
          store pixel at specified position
 Image row(int y)
          full row out of image
 boolean verticalSpanEquals(int x, int from, int to, int value)
          Deprecated. use iterators instead
 

Method Detail

get

int get(int x,
        int y)
retrieve value of pixel in image specific fashion

Parameters:
x -
y -
Returns:

put

void put(int x,
         int y,
         int value)
store pixel at specified position

Parameters:
x -
y -
value -

get

int get()
retrieve pixekl at current position, does not modify current image pointer

Returns:

put

void put(int value)
store pixel at current position, does not modify current image pointer

Parameters:
value -

horizontalSpanEquals

boolean horizontalSpanEquals(int y,
                             int from,
                             int to,
                             int value)
Deprecated. use iterator instead

whether horizontal line is empty between specified coordinates in image specific fashion

Parameters:
y - Y value
from - inclusive from
to - inclusive to
value -
Returns:
whether line is empty in image specific fashion

verticalSpanEquals

boolean verticalSpanEquals(int x,
                           int from,
                           int to,
                           int value)
Deprecated. use iterators instead

whether vertical line is empty between specified points

Parameters:
x - X Value
from - inclusive from
to - inclusive to
value -
Returns:
whether line is empty in image specific fashion

getWidth

int getWidth()
Returns:
image width

getHeight

int getHeight()
Returns:
image height

getOriginX

int getOriginX()
Returns:
origin inside bigger image. 0 if this is not subimage

getOriginY

int getOriginY()

iterateH

void iterateH(int y)
convenience method to initialize iterator over whole image row


iterateH

void iterateH(int y,
              int from,
              int to)
initialize iterator over part of row

Parameters:
from - from position
to - to position

iterateV

void iterateV(int x)
convenience method to initialize iterator over whole image column


iterateV

void iterateV(int x,
              int from,
              int to)
initialize iterator over part of column

Parameters:
from -
to -

next

int next()
advance and retrieve next available pixel

Returns:

next

void next(int pixel)
store and advance to next pixel


hasNext

boolean hasNext()
whether next pixel is available

Returns:

copy

void copy(Image dst)
copy image content to another image

Parameters:
dst - destination image

flip

void flip(Image dst)
copy image swithcing axes in process

Parameters:
dst - destination image

chisel

Image chisel(int fromX,
             int fromY,
             int width,
             int height)
chisel out sub-image out of original one. be careful with dimensions - no internal checks are done. Operation works in place and no data is copied.

Parameters:
fromX - subimage origin X
fromY - subimage origin Y
width - subimage width
height - subimage height
Returns:
image region as image

row

Image row(int y)
full row out of image

Parameters:
y - coordinate
Returns:
row image

column

Image column(int x)
full column out of image

Parameters:
x - coordinate
Returns:
column image

getAspectRatio

float getAspectRatio()
aspect ration of this image TODO: do we actually need this?

Returns:


Copyright © -2012. All Rights Reserved.