private IT createInitialTransform() { float scale = 0.8f; if( fitModel instanceof Affine2D_F64 ) { Affine2D_F64 H = new Affine2D_F64(scale,0,0,scale, stitchWidth /4, stitchHeight /4); return (IT)H.invert(null); } else if( fitModel instanceof Homography2D_F64 ) { Homography2D_F64 H = new Homography2D_F64(scale,0,stitchWidth /4,0,scale,stitchHeight /4,0,0,1 ); return (IT)H.invert(null); } else { throw new RuntimeException("Need to support this model type: "+fitModel.getClass().getSimpleName()); } }
gui.setAllTracks(null); Homography2D_F64 H = alg.getWorldToCurr(null).invert(null); gui.setCurrToWorld(H);
@Override public void process(GrayU8 gray) { if( !resetRequested && alg.process(gray) ) { convertToBitmapDisplay(alg.getStitchedImage()); synchronized ( lockGui ) { alg.getImageCorners(gray.width,gray.height,corners); ImageMotion2D<?,?> motion = alg.getMotion(); if( showFeatures && (motion instanceof AccessPointTracks) ) { AccessPointTracks access = (AccessPointTracks)motion; alg.getWorldToCurr(imageToDistorted); imageToDistorted.invert(distortedToImage); inliersGui.reset();outliersGui.reset(); List<Point2D_F64> points = access.getAllTracks(); for( int i = 0; i < points.size(); i++ ) { HomographyPointOps_F64.transform(distortedToImage,points.get(i),distPt); if( access.isInlier(i) ) { inliersGui.grow().set(distPt.x,distPt.y); } else { outliersGui.grow().set(distPt.x,distPt.y); } } } } } else { resetRequested = false; alg.reset(); } }
imageToDistorted.invert(distortedToImage); inliersGui.reset();outliersGui.reset(); List<Point2D_F64> points = access.getAllTracks();