Search in sources :

Example 1 with PathLabel

use of boofcv.io.PathLabel in project BoofCV by lessthanoptimal.

the class VisualizeStereoDisparity method main.

public static void main(String[] args) {
    VisualizeStereoDisparity app = new VisualizeStereoDisparity();
    // app.setBaseDirectory(UtilIO.pathExample(""));
    // app.loadInputData(UtilIO.pathExample("disparity.txt"));
    String dirCalib = UtilIO.pathExample("calibration/stereo/Bumblebee2_Chess/");
    String dirImgs = UtilIO.pathExample("stereo/");
    List<PathLabel> inputs = new ArrayList<>();
    inputs.add(new PathLabel("Chair 1", dirCalib + "stereo.yaml", dirImgs + "chair01_left.jpg", dirImgs + "chair01_right.jpg"));
    // inputs.add(new PathLabel("Chair 2",  dirCalib+"stereo.yaml",dirImgs+"chair02_left.jpg",dirImgs+"chair02_right.jpg"));
    inputs.add(new PathLabel("Stones 1", dirCalib + "stereo.yaml", dirImgs + "stones01_left.jpg", dirImgs + "stones01_right.jpg"));
    inputs.add(new PathLabel("Lantern 1", dirCalib + "stereo.yaml", dirImgs + "lantern01_left.jpg", dirImgs + "lantern01_right.jpg"));
    inputs.add(new PathLabel("Wall 1", dirCalib + "stereo.yaml", dirImgs + "wall01_left.jpg", dirImgs + "wall01_right.jpg"));
    // inputs.add(new PathLabel("Garden 1", dirCalib+"stereo.yaml",dirImgs+"garden01_left.jpg",dirImgs+"garden01_right.jpg"));
    inputs.add(new PathLabel("Garden 2", dirCalib + "stereo.yaml", dirImgs + "garden02_left.jpg", dirImgs + "garden02_right.jpg"));
    inputs.add(new PathLabel("Sundial 1", dirCalib + "stereo.yaml", dirImgs + "sundial01_left.jpg", dirImgs + "sundial01_right.jpg"));
    app.setInputList(inputs);
    // wait for it to process one image so that the size isn't all screwed up
    while (!app.getHasProcessedImage()) {
        Thread.yield();
    }
    ShowImages.showWindow(app, "Stereo Disparity", true);
}
Also used : PathLabel(boofcv.io.PathLabel) ArrayList(java.util.ArrayList)

Example 2 with PathLabel

use of boofcv.io.PathLabel in project BoofCV by lessthanoptimal.

the class DenseFlowApp method main.

public static void main(String[] args) {
    DenseFlowApp app = new DenseFlowApp();
    // app.setBaseDirectory(UtilIO.pathExample("denseflow/");
    // app.loadInputData(UtilIO.pathExample("denseflow/denseflow.txt");
    java.util.List<PathLabel> inputs = new ArrayList<>();
    inputs.add(new PathLabel("urban", UtilIO.pathExample("denseflow/Urban2_07.png"), UtilIO.pathExample("denseflow/Urban2_08.png")));
    inputs.add(new PathLabel("dog", UtilIO.pathExample("denseflow/dogdance07.png"), UtilIO.pathExample("denseflow/dogdance08.png")));
    inputs.add(new PathLabel("grove", UtilIO.pathExample("denseflow/Grove2_07.png"), UtilIO.pathExample("denseflow/Grove2_08.png")));
    app.setInputList(inputs);
    // wait for it to process one image so that the size isn't all screwed up
    while (!app.getHasProcessedImage()) {
        Thread.yield();
    }
    ShowImages.showWindow(app, "Dense Optical Flow", true);
}
Also used : PathLabel(boofcv.io.PathLabel) ArrayList(java.util.ArrayList)

Example 3 with PathLabel

use of boofcv.io.PathLabel in project BoofCV by lessthanoptimal.

the class IntensityFeaturePyramidApp method main.

public static void main(String[] args) {
    IntensityFeaturePyramidApp<GrayF32, GrayF32> app = new IntensityFeaturePyramidApp<>(GrayF32.class, GrayF32.class);
    // IntensityFeaturePyramidApp<GrayU8, GrayS16> app =
    // new IntensityFeaturePyramidApp<GrayU8,GrayS16>(GrayU8.class,GrayS16.class);
    java.util.List<PathLabel> inputs = new ArrayList<>();
    inputs.add(new PathLabel("shapes", UtilIO.pathExample("shapes/shapes01.png")));
    inputs.add(new PathLabel("amoeba", UtilIO.pathExample("amoeba_shapes.jpg")));
    inputs.add(new PathLabel("sunflowers", UtilIO.pathExample("sunflowers.jpg")));
    inputs.add(new PathLabel("beach", UtilIO.pathExample("scale/beach02.jpg")));
    app.setInputList(inputs);
    // wait for it to process one image so that the size isn't all screwed up
    while (!app.getHasProcessedImage()) {
        Thread.yield();
    }
    ShowImages.showWindow(app, "Feature Scale Space Pyramid Intensity", true);
}
Also used : GrayF32(boofcv.struct.image.GrayF32) PathLabel(boofcv.io.PathLabel) ArrayList(java.util.ArrayList)

Example 4 with PathLabel

use of boofcv.io.PathLabel in project BoofCV by lessthanoptimal.

the class FiducialTrackerDemoApp method openExample.

@Override
public void openExample(Object o) {
    // stop everything because all the data structures about about to be changed
    stopAllInputProcessing();
    PathLabel example = (PathLabel) o;
    String name = example.label;
    String videoName = example.getPath();
    String seperator = System.getProperty("file.separator");
    String path = videoName.substring(0, videoName.lastIndexOf(seperator.charAt(0)));
    ConfigThreshold configThreshold = ConfigThreshold.local(ThresholdType.LOCAL_MEAN, 21);
    boolean stability = true;
    if (name.compareTo(SQUARE_NUMBER) == 0) {
        detector = FactoryFiducial.squareBinary(new ConfigFiducialBinary(0.1), configThreshold, imageClass);
    } else if (name.compareTo(SQUARE_PICTURE) == 0) {
        double length = 0.1;
        detector = FactoryFiducial.squareImage(new ConfigFiducialImage(), configThreshold, imageClass);
        SquareImage_to_FiducialDetector<I> d = (SquareImage_to_FiducialDetector<I>) detector;
        String pathImg = new File(path, "../patterns").getPath();
        List<String> names = new ArrayList<>();
        names.add("chicken.png");
        names.add("yinyang.png");
        for (String foo : names) {
            BufferedImage img = media.openImage(new File(pathImg, foo).getPath());
            if (img == null)
                throw new RuntimeException("Can't find file " + new File(pathImg, foo).getPath());
            d.addPatternImage(ConvertBufferedImage.convertFromSingle(img, null, imageClass), 125, length);
        }
    } else if (name.compareTo(CALIB_CHESS) == 0) {
        detector = FactoryFiducial.calibChessboard(new ConfigChessboard(7, 5, 0.03), imageClass);
    } else if (name.compareTo(CALIB_SQUARE_GRID) == 0) {
        detector = FactoryFiducial.calibSquareGrid(new ConfigSquareGrid(4, 3, 0.03, 0.03), imageClass);
    } else if (name.compareTo(CALIB_SQUARE_BINARY_GRID) == 0) {
        File configFile = new File(path, "description_4x3_3x3_4cm_2cm.txt");
        try {
            ConfigSquareGridBinary config = ConfigSquareGridBinary.parseSimple(new BufferedReader(new FileReader(configFile)));
            detector = FactoryFiducial.calibSquareGridBinary(config, imageClass);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    } else if (name.compareTo(CALIB_CIRCLE_HEXAGONAL_GRID) == 0) {
        stability = false;
        detector = FactoryFiducial.calibCircleHexagonalGrid(new ConfigCircleHexagonalGrid(24, 28, 1, 1.2), imageClass);
    } else if (name.compareTo(CALIB_CIRCLE_REGULAR_GRID) == 0) {
        stability = false;
        detector = FactoryFiducial.calibCircleRegularGrid(new ConfigCircleRegularGrid(10, 8, 1.5, 2.5), imageClass);
    } else {
        throw new RuntimeException("Unknown selection");
    }
    controls.setShowStability(stability);
    intrinsic = CalibrationIO.load(media.openFile(path + "/intrinsic.yaml"));
    detector.setLensDistortion(new LensDistortionRadialTangential(intrinsic), intrinsic.width, intrinsic.height);
    fiducialInfo.clear();
    // give it some initial values so that it doesn't look like there is huge errors right off the bat
    stabilityMax.location = 0.01;
    stabilityMax.orientation = 0.02;
    openVideo(false, videoName);
}
Also used : ConfigFiducialBinary(boofcv.factory.fiducial.ConfigFiducialBinary) IOException(java.io.IOException) ConfigFiducialImage(boofcv.factory.fiducial.ConfigFiducialImage) BufferedImage(java.awt.image.BufferedImage) ConvertBufferedImage(boofcv.io.image.ConvertBufferedImage) ConfigThreshold(boofcv.factory.filter.binary.ConfigThreshold) LensDistortionRadialTangential(boofcv.alg.distort.radtan.LensDistortionRadialTangential) SquareImage_to_FiducialDetector(boofcv.abst.fiducial.SquareImage_to_FiducialDetector) PathLabel(boofcv.io.PathLabel) BufferedReader(java.io.BufferedReader) ArrayList(java.util.ArrayList) List(java.util.List) FileReader(java.io.FileReader) File(java.io.File)

Example 5 with PathLabel

use of boofcv.io.PathLabel in project BoofCV by lessthanoptimal.

the class FiducialTrackerDemoApp method main.

public static void main(String[] args) {
    // Class type = GrayF32.class;
    Class type = GrayU8.class;
    java.util.List<PathLabel> inputs = new ArrayList<>();
    inputs.add(new PathLabel(SQUARE_NUMBER, UtilIO.pathExample("fiducial/binary/movie.mjpeg")));
    inputs.add(new PathLabel(SQUARE_PICTURE, UtilIO.pathExample("fiducial/image/video/movie.mjpeg")));
    inputs.add(new PathLabel(CALIB_CHESS, UtilIO.pathExample("fiducial/chessboard/movie.mjpeg")));
    inputs.add(new PathLabel(CALIB_SQUARE_GRID, UtilIO.pathExample("fiducial/square_grid/movie.mp4")));
    // inputs.add(new PathLabel(CALIB_SQUARE_BINARY_GRID, UtilIO.pathExample("fiducial/binary_grid/movie.mp4")));
    inputs.add(new PathLabel(CALIB_CIRCLE_HEXAGONAL_GRID, UtilIO.pathExample("fiducial/circle_hexagonal/movie.mp4")));
    inputs.add(new PathLabel(CALIB_CIRCLE_REGULAR_GRID, UtilIO.pathExample("fiducial/circle_regular/movie.mp4")));
    FiducialTrackerDemoApp app = new FiducialTrackerDemoApp(inputs, type);
    app.openExample(inputs.get(0));
    app.display("Fiducial Demonstrations");
}
Also used : PathLabel(boofcv.io.PathLabel) ArrayList(java.util.ArrayList) GrayU8(boofcv.struct.image.GrayU8)

Aggregations

PathLabel (boofcv.io.PathLabel)51 ArrayList (java.util.ArrayList)48 GrayF32 (boofcv.struct.image.GrayF32)14 File (java.io.File)10 ImageType (boofcv.struct.image.ImageType)7 GrayU8 (boofcv.struct.image.GrayU8)4 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)3 BufferedImage (java.awt.image.BufferedImage)3 BufferedReader (java.io.BufferedReader)2 IOException (java.io.IOException)2 SquareImage_to_FiducialDetector (boofcv.abst.fiducial.SquareImage_to_FiducialDetector)1 LensDistortionRadialTangential (boofcv.alg.distort.radtan.LensDistortionRadialTangential)1 ConfigFiducialBinary (boofcv.factory.fiducial.ConfigFiducialBinary)1 ConfigFiducialImage (boofcv.factory.fiducial.ConfigFiducialImage)1 ConfigThreshold (boofcv.factory.filter.binary.ConfigThreshold)1 StereoParameters (boofcv.struct.calib.StereoParameters)1 ActionListener (java.awt.event.ActionListener)1 FileReader (java.io.FileReader)1 Reader (java.io.Reader)1 List (java.util.List)1