Package com.googlecode.javacv

Examples of com.googlecode.javacv.GeometricCalibrator$Settings


  private String packFileName;
  private File root;
  ArrayList<File> ignoreDirs = new ArrayList();

  public TexturePackerFileProcessor () {
    this(new Settings(), "pack.atlas");
  }
View Full Code Here


        return file1.toString().length() - file2.toString().length();
      }
    });
    for (File settingsFile : settingsFiles) {
      // Find first parent with settings, or use defaults.
      Settings settings = null;
      File parent = settingsFile.getParentFile();
      while (true) {
        if (parent.equals(root)) break;
        parent = parent.getParentFile();
        settings = dirToSettings.get(parent);
        if (settings != null) {
          settings = new Settings(settings);
          break;
        }
      }
      if (settings == null) settings = new Settings(defaultSettings);
      // Merge settings from current directory.
      try {
        json.readFields(settings, new JsonReader().parse(new FileReader(settingsFile)));
      } catch (SerializationException ex) {
        throw new GdxRuntimeException("Error reading settings file: " + settingsFile, ex);
View Full Code Here

  protected void processDir (Entry inputDir, ArrayList<Entry> files) throws Exception {
    if (ignoreDirs.contains(inputDir.inputFile)) return;

    // Find first parent with settings, or use defaults.
    Settings settings = null;
    File parent = inputDir.inputFile;
    while (true) {
      settings = dirToSettings.get(parent);
      if (settings != null) break;
      if (parent.equals(root)) break;
View Full Code Here

  }

  public void render () {
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    Settings settings = new Settings();
    settings.fast = false;
    settings.pot = false;
    settings.maxWidth = 1024;
    settings.maxHeight = 1024;
    settings.rotation = false;
View Full Code Here

    public void regenerateGenericAtlas() {

        String imageFolder = pathToGenericImages;
        String packedFolder = pathToPackedGenericImages;

        Settings settings = new Settings();
        settings.maxWidth = Detonator.INSTANCE.maxAtlasSizeX;
        settings.maxHeight = Detonator.INSTANCE.maxAtlasSizeY;

        new File(packedFolder).mkdirs();
View Full Code Here

    }

    public void loadingGDX() {

        Settings settings = new Settings();
        settings.maxWidth = Detonator.INSTANCE.maxAtlasSizeX;
        settings.maxHeight = Detonator.INSTANCE.maxAtlasSizeY;

        if (regenerateAtlases) {
View Full Code Here

    private void calibrateGeometry(final FrameGrabber.Array frameGrabberArray) throws Exception {
        // create camera calibrators...
        geometricCalibrators = new GeometricCalibrator[cameraDevices.length];
        proCamGeometricCalibrators = new ProCamGeometricCalibrator[projectorDevices.length];
        for (int i = 0; i < geometricCalibrators.length; i++) {
            geometricCalibrators[i] = new GeometricCalibrator(geometricCalibratorSettings,
                    markerDetectorSettings, boardPlane, cameraDevices[i]);
        }
        // create projector calibrators...
        for (int i = 0; i < proCamGeometricCalibrators.length; i++) {
            GeometricCalibrator g = new GeometricCalibrator(geometricCalibratorSettings,
                    markerDetectorSettings, projectorPlanes[i], projectorDevices[i]);
            proCamGeometricCalibrators[i] = new ProCamGeometricCalibrator(
                    geometricCalibratorSettings, markerDetectorSettings,
                    boardPlane, projectorPlanes[i], geometricCalibrators, g);
        }
        // define the device at origin to be the first camera...
        final int cameraAtOrigin = 0;

        int currentProjector = 0;
        final boolean[] hasDetectedMarkers = new boolean[frameGrabberArray.size()];
        final IplImage[] colorImages = new IplImage[frameGrabberArray.size()];

        boolean done = false;
        long lastAddedTime = -1;
        while (!done && !isCancelled()) {
            // display projector pattern
            if (currentProjector < projectorCanvasFrames.length) {
                projectorCanvasFrames[currentProjector].showImage(
                        proCamGeometricCalibrators[currentProjector].getProjectorImage());
                projectorCanvasFrames[currentProjector].waitLatency();
            }

            // capture images from cameras
            frameGrabberArray.trigger();
            final IplImage[] grabbedImages = frameGrabberArray.grab();
            assert (grabbedImages.length == cameraDevices.length);
            final int curProj = currentProjector;

            for (int i = 0; i < grabbedImages.length; i++) {
                if (grabbedImages[i] == null) {
                    throw new Exception("Image grabbed from " + cameraDevices[i].getSettings().getName() + " is null, unexcepted end of stream?");
                }
            }

//            for (int i = 0; i < grabbedImages.length && !isCancelled(); i++) {
            Parallel.loop(0, grabbedImages.length, new Looper() {
            public void loop(int from, int to, int looperID) {
            for (int i = from; i < to && !isCancelled(); i++) {
                // gamma "uncorrection", linearization
                double gamma = frameGrabberArray.getFrameGrabbers()[i].getGamma();
                if (gamma != 1.0) {
                    grabbedImages[i].applyGamma(gamma);
                }

                // convert camera image to color so we can draw in color
                if (colorImages[i] == null) {
                    colorImages[i] = IplImage.create(grabbedImages[i].width(), grabbedImages[i].height(), IPL_DEPTH_8U, 3);
                }
                switch (grabbedImages[i].depth()&~IPL_DEPTH_SIGN) {
                    case 8:
                        cvCvtColor(grabbedImages[i], colorImages[i], CV_GRAY2RGB);
                        break;
                    case 16:
                        ByteBuffer colorBuf = colorImages[i].getByteBuffer();
                        ShortBuffer shortBuf = grabbedImages[i].getByteBuffer().asShortBuffer();
                        for (int j = 0; j < colorBuf.limit()/3; j++) {
                            byte msb = (byte)((int)(shortBuf.get()>>8) & 0xFF);
                            colorBuf.put(msb);
                            colorBuf.put(msb);
                            colorBuf.put(msb);
                        }
                        break;
                    default: assert(false);
                }
                // process camera images.. detect markers..
                if (curProj < projectorCanvasFrames.length) {
                    hasDetectedMarkers[i] = proCamGeometricCalibrators[curProj].processCameraImage(grabbedImages[i], i) != null;
                    proCamGeometricCalibrators[curProj].drawMarkers(colorImages[i], i);
                } else {
                    hasDetectedMarkers[i] = geometricCalibrators[i].processImage(grabbedImages[i]) != null;
                    geometricCalibrators[i].drawMarkers(colorImages[i]);
                }
                // show camera images with detected markers drawn
                if (cameraCanvasFrames[i] != null) {
                    cameraCanvasFrames[i].showImage(colorImages[i], cameraSettings.getMonitorWindowsScale());
                    //cameraCanvasFrames[i].showImage(geometricCalibrators[i].getMarkerDetector().getBinarized());
                }
            }}});

            // check if we have any missing markers from all camera images
            boolean missing = false;
            for (int i = 0; i < hasDetectedMarkers.length; i++) {
                if (!hasDetectedMarkers[i]) {
                    missing = true;
                    break;
                }
            }

            // if we have waited long enough, and all calibrators want to add
            // the markers, then add them
            long time = System.currentTimeMillis();
            if (!missing && time-lastAddedTime > geometricCalibratorSettings.timeIntervalMin) {
                lastAddedTime = time;
                for (int i = 0; i < cameraCanvasFrames.length; i++) {
                    // the calibrators have decided to save these markers, make a little flash effect
                    if (cameraCanvasFrames[i] != null) {
                        cameraCanvasFrames[i].showColor(Color.WHITE);
                    }

                    if (currentProjector < projectorCanvasFrames.length) {
                        // the cameras are calibrated through the current projector...
                        proCamGeometricCalibrators[currentProjector].addMarkers(i);
                        if (proCamGeometricCalibrators[currentProjector].getImageCount()
                                >= geometricCalibratorSettings.imagesInTotal) {
                            projectorCanvasFrames[currentProjector].showColor(Color.BLACK);
                            done = true;
                        }
                    } else {
                        geometricCalibrators[i].addMarkers();
                        if (geometricCalibrators[i].getImageCount()
                                >= geometricCalibratorSettings.imagesInTotal) {
                            done = true;
                        }
                    }
                }
                if (done && currentProjector+1 < proCamGeometricCalibrators.length) {
                    currentProjector++;
                    done = false;
                }
                Thread.sleep(200);
            }
        }

        // once we have accumulated enough markers, proceed to calibration
        if (!isCancelled()) {
            GeometricCalibrator calibratorAtOrigin = geometricCalibrators[cameraAtOrigin];
            for (int i = 0; i < geometricCalibrators.length; i++) {
                geometricCalibrators[i].calibrate(geometricCalibratorSettings.useMarkerCenters);
                if (geometricCalibrators[i] != calibratorAtOrigin) {
                    calibratorAtOrigin.calibrateStereo(
                            geometricCalibratorSettings.useMarkerCenters, geometricCalibrators[i]);
                }
            }
            for (int i = 0; i < proCamGeometricCalibrators.length; i++) {
                proCamGeometricCalibrators[i].calibrate(
View Full Code Here

        if(select2Field == null) {
            setRequired(getScalarModel().isRequired());
            select2Field = Select2ChoiceUtil.newSelect2Choice(ID_AUTO_COMPLETE, model, getScalarModel());
            setProviderAndCurrAndPending(select2Field, getScalarModel().getActionArgsHint());
            if(!getScalarModel().hasChoices()) {
                final Settings settings = select2Field.getSettings();
                ScalarModel scalarModel = getScalarModel();
                final int minLength = scalarModel.getAutoCompleteMinLength();
                settings.setMinimumInputLength(minLength);
                settings.setPlaceholder(scalarModel.getName());
            }
            addOrReplace(select2Field);
        } else {
            //
            // the select2Field already exists, so the widget has been rendered before.  If it is
View Full Code Here

            if(select2Field == null) {
                entityLink.setRequired(getModel().isRequired());
                select2Field = Select2ChoiceUtil.newSelect2Choice(ID_AUTO_COMPLETE, model, getModel());
                setProviderAndCurrAndPending(select2Field, getModel().getActionArgsHint());
                if(!getModel().hasChoices()) {
                    final Settings settings = select2Field.getSettings();
                    final int minLength = getModel().getAutoCompleteMinLength();
                    settings.setMinimumInputLength(minLength);
                    settings.setPlaceholder(getModel().getName());
                }
                entityLink.addOrReplace(select2Field);
            } else {
                //
                // the select2Field already exists, so the widget has been rendered before.  If it is
View Full Code Here

                    }
                    setResponsePage(EntityPage.class, selectedModel.getPageParameters());
                }
            });
       
        final Settings settings = breadcrumbChoice.getSettings();
        settings.setMinimumInputLength(0);
        settings.setWidth("100%");
       
        breadcrumbChoice.setProvider(new TextChoiceProvider<EntityModel>() {

            private static final long serialVersionUID = 1L;
View Full Code Here

TOP

Related Classes of com.googlecode.javacv.GeometricCalibrator$Settings

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.