/** * Returns the top line in the given accumulator space. * The end points of the line will have x coordinates at -2000 and 2000. * * @param accumulatorSpace The accumulator space to look within * @param offset The number of bins offset from zero degrees * @return The strongest line in the accumulator space */ public Line2d getBestLine( FImage accumulatorSpace, int offset ) { FValuePixel p = accumulatorSpace.maxPixel(); // Remember accumulator space is r,theta int theta = p.x + offset; int dist = p.y; return getLineFromParams( theta, dist, -2000, 2000 ); }
/** * Returns the top line in the given accumulator space. * The end points of the line will have x coordinates at -2000 and 2000. * * @param accumulatorSpace The accumulator space to look within * @param offset The number of bins offset from zero degrees * @return The strongest line in the accumulator space */ public Line2d getBestLine( FImage accumulatorSpace, int offset ) { FValuePixel p = accumulatorSpace.maxPixel(); // Remember accumulator space is r,theta int theta = p.x + offset; int dist = p.y; return getLineFromParams( theta, dist, -2000, 2000 ); }
/** * Returns the top n lines from the given accumulator space. * The end points of the lines will have x coordinates at -2000 and 2000. * * @param n The number of lines to return * @param accumulatorSpace The space to look within * @param offset The offset into the accumulator of 0 in this space * @return A list of lines */ public List<Line2d> getBestLines( int n, FImage accumulatorSpace, int offset ) { FImage accum2 = accumulatorSpace.clone(); List<Line2d> lines = new ArrayList<Line2d>(); for( int i = 0; i < n; i++ ) { FValuePixel p = accum2.maxPixel(); lines.add( getLineFromParams( p.x+offset, p.y, -2000, 2000 ) ); accum2.setPixel( p.x, p.y, 0f ); } return lines; }
/** * Returns the top n lines from the given accumulator space. * The end points of the lines will have x coordinates at -2000 and 2000. * * @param n The number of lines to return * @param accumulatorSpace The space to look within * @param offset The offset into the accumulator of 0 in this space * @return A list of lines */ public List<Line2d> getBestLines( int n, FImage accumulatorSpace, int offset ) { FImage accum2 = accumulatorSpace.clone(); List<Line2d> lines = new ArrayList<Line2d>(); for( int i = 0; i < n; i++ ) { FValuePixel p = accum2.maxPixel(); lines.add( getLineFromParams( p.x+offset, p.y, -2000, 2000 ) ); accum2.setPixel( p.x, p.y, 0f ); } return lines; }