@Override public double getOrientation(int featureIndex) { if( orientation == null ) return detector.getOrientation(featureIndex); Point2D_F64 p = detector.getLocation(featureIndex); orientation.setObjectRadius(getRadius(featureIndex)); return orientation.compute(p.x,p.y); }
public static <TD extends TupleDesc> FastQueue<TD> describeImage( GrayF32 input , InterestPointDetector<GrayF32> detector , DescribeRegionPoint<GrayF32,TD> describe , List<Point2D_F64> location ) { FastQueue<TD> list = new FastQueue<>(100, describe.getDescriptionType(), false); System.out.println("Detecting"); detector.detect(input); System.out.println("Describing"); describe.setImage(input); for( int i = 0; i < detector.getNumberOfFeatures(); i++ ) { Point2D_F64 p = detector.getLocation(i); double radius = detector.getRadius(i); double ori = detector.getOrientation(i); TD d = describe.createDescription(); if( describe.process(p.x,p.y,ori,radius,d) ) { list.add( d ); location.add( p.copy() ); } } return list; }
@Override public void detect(T input) { descs.reset(); featureRadiuses.reset(); featureAngles.reset(); location.reset(); if( orientation != null ) { orientation.setImage(input); } describe.setImage(input); detector.detect(input); int N = detector.getNumberOfFeatures(); for( int i = 0; i < N; i++ ) { Point2D_F64 p = detector.getLocation(i); double radius = detector.getRadius(i); double yaw = detector.getOrientation(i); if( orientation != null ) { orientation.setObjectRadius(radius); yaw = orientation.compute(p.x,p.y); } if( describe.process(p.x,p.y,yaw,radius,descs.grow()) ) { featureRadiuses.push(radius); featureAngles.push(yaw); location.add(p); } else { descs.removeTail(); } } }