int mt = (int)(minTheta / (360d/getNumberOfSegments())); int xt = (int)(maxTheta / (360d/getNumberOfSegments())); FImage f = accum.extractROI( mt, 0, xt-mt, accum.getHeight() ); return calculatePrevailingAngle( f, mt, (xt-mt)*(360d/getNumberOfSegments()) ); int mt = (int)(minTheta / (360d/getNumberOfSegments())); int xt = (int)(maxTheta / (360d/getNumberOfSegments())); FImage a = accum.shiftRight( -mt ).extractROI(0,0,(xt-mt),accum.getHeight()); return calculatePrevailingAngle( a, mt, (xt-mt)*(360d/getNumberOfSegments()) );
int mt = (int)(minTheta / (360d/getNumberOfSegments())); int xt = (int)(maxTheta / (360d/getNumberOfSegments())); FImage f = accum.extractROI( mt, 0, xt-mt, accum.getHeight() ); return calculatePrevailingAngle( f, mt, (xt-mt)*(360d/getNumberOfSegments()) ); int mt = (int)(minTheta / (360d/getNumberOfSegments())); int xt = (int)(maxTheta / (360d/getNumberOfSegments())); FImage a = accum.shiftRight( -mt ).extractROI(0,0,(xt-mt),accum.getHeight()); return calculatePrevailingAngle( a, mt, (xt-mt)*(360d/getNumberOfSegments()) );
accum.width != getNumberOfSegments() ) accum = new FImage( getNumberOfSegments(), amax ); else accum.zero(); for( int m = 0; m < getNumberOfSegments(); m++ ) double mm = ((double)m / (double)getNumberOfSegments()) * (2 * PI); int a = (int) round( x * cos(mm) + y * sin(mm) ); if( a < amax && a >= 0)
accum.width != getNumberOfSegments() ) accum = new FImage( getNumberOfSegments(), amax ); else accum.zero(); for( int m = 0; m < getNumberOfSegments(); m++ ) double mm = ((double)m / (double)getNumberOfSegments()) * (2 * PI); int a = (int) round( x * cos(mm) + y * sin(mm) ); if( a < amax && a >= 0)
int mt = (int)(minTheta / (360d/getNumberOfSegments())); int xt = (int)(maxTheta / (360d/getNumberOfSegments())); FImage f = accum.extractROI( mt, 0, xt-mt, accum.getHeight() ); return getBestLine( f, mt ); int mt = (int)(minTheta / (360d/getNumberOfSegments())); int xt = (int)(maxTheta / (360d/getNumberOfSegments())); FImage a = accum.shiftRight( -mt ).extractROI(0,0,(xt-mt),accum.getHeight()); return getBestLine( a, mt );
int mt = (int)(minTheta / (360d/getNumberOfSegments())); int xt = (int)(maxTheta / (360d/getNumberOfSegments())); FImage f = accum.extractROI( mt, 0, xt-mt, accum.getHeight() ); return getBestLines( n, f, mt ); int mt = (int)(minTheta / (360d/getNumberOfSegments())); int xt = (int)(maxTheta / (360d/getNumberOfSegments())); FImage a = accum.shiftRight( -mt ).extractROI(0,0,(xt-mt),accum.getHeight()); return getBestLines( n, a, mt );
int mt = (int)(minTheta / (360d/getNumberOfSegments())); int xt = (int)(maxTheta / (360d/getNumberOfSegments())); FImage f = accum.extractROI( mt, 0, xt-mt, accum.getHeight() ); return getBestLine( f, mt ); int mt = (int)(minTheta / (360d/getNumberOfSegments())); int xt = (int)(maxTheta / (360d/getNumberOfSegments())); FImage a = accum.shiftRight( -mt ).extractROI(0,0,(xt-mt),accum.getHeight()); return getBestLine( a, mt );
int mt = (int)(minTheta / (360d/getNumberOfSegments())); int xt = (int)(maxTheta / (360d/getNumberOfSegments())); FImage f = accum.extractROI( mt, 0, xt-mt, accum.getHeight() ); return getBestLines( n, f, mt ); int mt = (int)(minTheta / (360d/getNumberOfSegments())); int xt = (int)(maxTheta / (360d/getNumberOfSegments())); FImage a = accum.shiftRight( -mt ).extractROI(0,0,(xt-mt),accum.getHeight()); return getBestLines( n, a, mt );
/** * From a r,theta parameterisation of a line, this returns a {@link Line2d} * with endpoints at the given x coordinates. If theta is 0 this will return * a vertical line between -2000 and 2000 with the x-coordinate the appopriate * distance from the origin. * * @param theta The angle bin in which the line lies (x in the accumulator space) * @param dist The distance bin in which the line lies (y in the accumulator space) * @param x1 The x-coordinate of the start of the line * @param x2 The x-coordinate of the end of the line * @return A {@link Line2d} */ public Line2d getLineFromParams( int theta, int dist, int x1, int x2 ) { if( theta == 0 ) { return new Line2d( new Point2dImpl( dist, -2000 ), new Point2dImpl( dist, 2000 ) ); } double t = theta * (360d/getNumberOfSegments()) * Math.PI/180d; return new Line2d( new Point2dImpl( x1, (float)(x1*(-Math.cos(t)/Math.sin(t)) + (dist/Math.sin(t)) ) ), new Point2dImpl( x2, (float)(x2*(-Math.cos(t)/Math.sin(t)) + (dist/Math.sin(t)) ) ) ); }
/** * From a r,theta parameterisation of a line, this returns a {@link Line2d} * with endpoints at the given x coordinates. If theta is 0 this will return * a vertical line between -2000 and 2000 with the x-coordinate the appopriate * distance from the origin. * * @param theta The angle bin in which the line lies (x in the accumulator space) * @param dist The distance bin in which the line lies (y in the accumulator space) * @param x1 The x-coordinate of the start of the line * @param x2 The x-coordinate of the end of the line * @return A {@link Line2d} */ public Line2d getLineFromParams( int theta, int dist, int x1, int x2 ) { if( theta == 0 ) { return new Line2d( new Point2dImpl( dist, -2000 ), new Point2dImpl( dist, 2000 ) ); } double t = theta * (360d/getNumberOfSegments()) * Math.PI/180d; return new Line2d( new Point2dImpl( x1, (float)(x1*(-Math.cos(t)/Math.sin(t)) + (dist/Math.sin(t)) ) ), new Point2dImpl( x2, (float)(x2*(-Math.cos(t)/Math.sin(t)) + (dist/Math.sin(t)) ) ) ); }