Class SvpTools

java.lang.Object
  |
  +--SvpTools

public class SvpTools
extends java.lang.Object


Constructor Summary
SvpTools()
           
 
Method Summary
static double angleBetween(DPoint v0, DPoint v1)
          returns the angle, in the range 0 -> PI between the two unit vectors
static double angleBetweenShifted(DPoint v0, DPoint v1)
          returns the angle, in the range 0 - PI/2 between the two unit vectors.
static double distanceBetween(DPoint p1, DPoint p2)
          returns the distance between the two DPoints
static double getMeanIntensity(int[][] pixels, DPoint start, DPoint vector, double length, double width)
          Returns the mean pixel density in the specified region.
static RegionPixelStats getPixelStats(int[][] pixels, DPoint start, DPoint vector, double length, double width, double slice_size)
          Breaks the specified region into "slices" based on the slice_size parameter.
static DPoint unitize(DPoint v)
          returns unit vector version of the passed vector
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SvpTools

public SvpTools()
Method Detail

getPixelStats

public static RegionPixelStats getPixelStats(int[][] pixels,
                                             DPoint start,
                                             DPoint vector,
                                             double length,
                                             double width,
                                             double slice_size)
Breaks the specified region into "slices" based on the slice_size parameter. Pixel density is computed for each slice, and the mean and standard deviation of those densities is returned in a RegionPixelStats structure.
 
           length
   ________________________    
  |    |    |    |    |    |   ^
  |start     vector        |   |
  *----------------------> | width
  |    |    |    |    |    |   |
  |____|____|____|____|____|   V
            !    !
          slice_size 
 

Parameters:
pixels - the image, passed as a parameter so this method can be static
start - the starting point of the region
vector - a vector in the length-wise direction of the region
length - the length of the rectangular region
width - the width of the rectangular region
slice_size - the width of the slices that the region will be divided into when computing stats (ideally should be 1?)

getMeanIntensity

public static double getMeanIntensity(int[][] pixels,
                                      DPoint start,
                                      DPoint vector,
                                      double length,
                                      double width)
Returns the mean pixel density in the specified region.

           length
   ________________________    
  |                        |   ^
  |start     vector        |   |
  *----------------------> | width
  |                        |   |
  |________________________|   V

 


angleBetween

public static double angleBetween(DPoint v0,
                                  DPoint v1)
returns the angle, in the range 0 -> PI between the two unit vectors


angleBetweenShifted

public static double angleBetweenShifted(DPoint v0,
                                         DPoint v1)
returns the angle, in the range 0 - PI/2 between the two unit vectors. used to determine angle between lines, since the furthest two lines angles can be from each other is PI/2 (perpendicular)


distanceBetween

public static double distanceBetween(DPoint p1,
                                     DPoint p2)
returns the distance between the two DPoints


unitize

public static DPoint unitize(DPoint v)
returns unit vector version of the passed vector