org.bytedeco.javacv.MarkerDetector Java Examples

The following examples show how to use org.bytedeco.javacv.MarkerDetector. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainFrame.java    From procamcalib with GNU General Public License v2.0 5 votes vote down vote up
void loadSettings(File file) throws IOException, IntrospectionException, PropertyVetoException {
    if (file == null) {
        cameraSettings = null;
        projectorSettings = null;
        markerSettings = null;
        markerDetectorSettings = null;
        geometricCalibratorSettings = null;
        colorCalibratorSettings = null;
        calibrationFile = null;
        calibrationWorker = null;
    } else {
        XMLDecoder decoder = new XMLDecoder(new BufferedInputStream(new FileInputStream(file)));
        cameraSettings = (CameraSettings)decoder.readObject();
        projectorSettings = (ProjectorSettings)decoder.readObject();
        markerSettings = (Marker.ArraySettings)decoder.readObject();
        markerDetectorSettings = (MarkerDetector.Settings)decoder.readObject();
        geometricCalibratorSettings = (CalibrationWorker.GeometricSettings)decoder.readObject();
        colorCalibratorSettings = (CalibrationWorker.ColorSettings)decoder.readObject();
        try {
            String s = (String)decoder.readObject();
            calibrationFile = s == null ? null : new File(s);
        } catch (java.lang.ArrayIndexOutOfBoundsException ex) { }
        decoder.close();
    }

    settingsFile = file;
    if (settingsFile == null) {
        setTitle(PRO_CAM_CALIB);
    } else {
        setTitle(settingsFile.getName() + " - ProCamCalib");
    }

    buildSettingsView();
    updatePatterns(null);

    if (calibrationWorker == null) {
        statusLabel.setText("No calibration data.");
    }
}
 
Example #2
Source File: MainFrame.java    From procamtracker with GNU General Public License v2.0 5 votes vote down vote up
void loadSettings(File file) throws IOException, IntrospectionException, PropertyVetoException {
    if (file == null) {
        cameraSettings = null;
        projectorSettings = null;
        objectFinderSettings = null;
        markerDetectorSettings = null;
        alignerSettings = null;
        handMouseSettings = null;
        virtualBallSettings = null;
        realityAugmentorSettings = null;
        trackingSettings = null;

        trackingWorker = null;
    } else {
        XMLDecoder decoder = new XMLDecoder(new BufferedInputStream(new FileInputStream(file)));
        cameraSettings = (CameraDevice.Settings)decoder.readObject();
        projectorSettings = (ProjectorDevice.Settings)decoder.readObject();
        objectFinderSettings = (ObjectFinder.Settings)decoder.readObject();
        markerDetectorSettings = (MarkerDetector.Settings)decoder.readObject();
        alignerSettings = (GNImageAligner.Settings)decoder.readObject();
        handMouseSettings = (HandMouse.Settings)decoder.readObject();
        virtualBallSettings = (VirtualBall.Settings)decoder.readObject();
        realityAugmentorSettings = (RealityAugmentor.Settings)decoder.readObject();
        trackingSettings = (TrackingWorker.Settings)decoder.readObject();
        decoder.close();
    }

    settingsFile = file;
    if (settingsFile == null) {
        setTitle("ProCamTracker");
    } else {
        setTitle(settingsFile.getName() + " - ProCamTracker");
    }

    buildSettingsView();

    if (trackingWorker == null) {
        statusLabel.setText("Idling.");
    }
}
 
Example #3
Source File: RealityAugmentor.java    From procamtracker with GNU General Public License v2.0 5 votes vote down vote up
public RealityAugmentor(Settings settings,
         ObjectFinder  .Settings objectFinderSettings,
         MarkerDetector.Settings markerDetectorSettings,
         VirtualBall   .Settings virtualBallSettings,
         ProjectiveDevice camera, ProjectiveDevice projector,
         int channels) throws Exception {
    setSettings(settings);
    this.objectFinderSettings   = objectFinderSettings;
    this.markerDetectorSettings = markerDetectorSettings;
    this.virtualBallSettings    = virtualBallSettings;
    this.camera    = camera;
    this.projector = projector;
    this.channels  = channels;
}
 
Example #4
Source File: GeometricCalibratorP.java    From PapARt with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Create a calibrator with default settings.
 *
 * @param projectiveDevice
 */
public GeometricCalibratorP(ProjectiveDevice projectiveDevice) {

    // MarkerDetector.settings is not used
    super(new GeometricCalibrator.Settings(), new MarkerDetector.Settings(), null, projectiveDevice);
}
 
Example #5
Source File: MainFrame.java    From procamcalib with GNU General Public License v2.0 4 votes vote down vote up
void buildSettingsView() throws IntrospectionException, PropertyVetoException {
        HashMap<String, Class<? extends PropertyEditor>> editors =
                new HashMap<String, Class<? extends PropertyEditor>>();
        editors.put("frameGrabber", FrameGrabber.PropertyEditor.class);

        // hide settings we do not need from the user...
        editors.put("triggerMode", null);
        editors.put("imageMode", null);
        editors.put("timeout", null);
        editors.put("deviceFilename", null);
        editors.put("useOpenGL", null);
//        editors.put("nominalDistance", null);

        if (cameraSettings == null) {
            cameraSettings = new CameraSettings();
            cameraSettings.setFrameGrabber(FrameGrabber.getDefault());
            cameraSettings.setQuantity(1);
        }
        cameraSettings.addPropertyChangeListener(this);
        BeanNode cameraNode = new CleanBeanNode<CameraSettings>
                (cameraSettings, editors, "Cameras");

        if (projectorSettings == null) {
            projectorSettings = new ProjectorSettings();
            projectorSettings.setQuantity(1);
        }
        projectorSettings.addPropertyChangeListener(this);
        BeanNode projectorNode = new CleanBeanNode<ProjectorSettings>
                (projectorSettings, editors, "Projectors");

        if (markerSettings == null) {
            markerSettings = new Marker.ArraySettings();
        }
        markerSettings.addPropertyChangeListener(this);
        BeanNode markerNode = new CleanBeanNode<Marker.ArraySettings>
                (markerSettings, null, "MarkerPatterns");

        if (markerDetectorSettings == null) {
            markerDetectorSettings = new MarkerDetector.Settings();
        }
        BeanNode detectorNode = new CleanBeanNode<MarkerDetector.Settings>
                (markerDetectorSettings, null, "MarkerDetector");

        if (geometricCalibratorSettings == null) {
            geometricCalibratorSettings = new CalibrationWorker.GeometricSettings();
        }
        BeanNode geometricCalibratorNode = new CleanBeanNode<CalibrationWorker.GeometricSettings>
                (geometricCalibratorSettings, null, "GeometricCalibrator");

        if (colorCalibratorSettings == null) {
            colorCalibratorSettings = new CalibrationWorker.ColorSettings();
        }
        colorCalibratorSettings.addPropertyChangeListener(this);
        BeanNode colorCalibratorNode = new CleanBeanNode<CalibrationWorker.ColorSettings>
                (colorCalibratorSettings, null, "ColorCalibrator");

        Children children = new Children.Array();
        children.add(new Node[] { cameraNode, projectorNode, markerNode, detectorNode, 
                geometricCalibratorNode, colorCalibratorNode });

        Node root = new AbstractNode(children);
        root.setName("Settings");
        manager.setRootContext(root);
    }
 
Example #6
Source File: MainFrame.java    From procamtracker with GNU General Public License v2.0 4 votes vote down vote up
void buildSettingsView() throws IntrospectionException, PropertyVetoException {
    HashMap<String, Class<? extends PropertyEditor>> editors =
            new HashMap<String, Class<? extends PropertyEditor>>();
    editors.put("frameGrabber", FrameGrabber.PropertyEditor.class);

    // hide settings we do not need from the user...
    editors.put("triggerMode", null);
    editors.put("imageMode", null);
    editors.put("timeout", null);
    editors.put("parametersFilename", null);
    editors.put("deviceFilename", null);
    editors.put("useOpenGL", null);
    editors.put("objectImage", null);
    editors.put("gammaTgamma", null);
    editors.put("outputVideoFilename", null);
    editors.put("textureImageFilename", null);
    editors.put("projectorImageFilename", null);
    editors.put("projectorVideoFilename", null);
    editors.put("initialRoiPts", null);
    editors.put("initialPosition", null);

    if (cameraSettings == null) {
        cameraSettings = new CameraDevice.CalibratedSettings();
        cameraSettings.setFrameGrabber(FrameGrabber.getDefault());
    }
    cameraSettings.addPropertyChangeListener(this);
    BeanNode cameraNode = new CleanBeanNode<CameraDevice.Settings>
            (cameraSettings, editors, "Camera");

    if (projectorSettings == null) {
        projectorSettings = new ProjectorDevice.CalibratedSettings();
    }
    projectorSettings.addPropertyChangeListener(this);
    BeanNode projectorNode = new CleanBeanNode<ProjectorDevice.Settings>
            (projectorSettings, editors, "Projector");

    if (objectFinderSettings == null) {
        objectFinderSettings = new ObjectFinder.Settings();
    }
    objectFinderSettings.addPropertyChangeListener(this);
    BeanNode objectFinderNode = new CleanBeanNode<ObjectFinder.Settings>
            (objectFinderSettings, editors, "ObjectFinder");

    if (markerDetectorSettings == null) {
        markerDetectorSettings = new MarkerDetector.Settings();
    }
    markerDetectorSettings.addPropertyChangeListener(this);
    BeanNode markerDetectorNode = new CleanBeanNode<MarkerDetector.Settings>
            (markerDetectorSettings, editors, "MarkerDetector");

    if (alignerSettings == null) {
        alignerSettings = new GNImageAligner.Settings();
    }
    BeanNode alignerNode = new CleanBeanNode<GNImageAligner.Settings>
            (alignerSettings, editors, "GNImageAligner");

    if (handMouseSettings == null) {
        handMouseSettings = new HandMouse.Settings();
    }
    BeanNode handMouseNode = new CleanBeanNode<HandMouse.Settings>
            (handMouseSettings, editors, "HandMouse");

    if (virtualBallSettings == null) {
        virtualBallSettings = new VirtualBall.Settings();
    }
    BeanNode virtualBallNode = new CleanBeanNode<VirtualBall.Settings>
            (virtualBallSettings, editors, "VirtualBall");

    if (realityAugmentorSettings == null) {
        realityAugmentorSettings = new RealityAugmentor.Settings();
        RealityAugmentor.ObjectSettings os = new RealityAugmentor.ObjectSettings();
        RealityAugmentor.VirtualSettings vs = new RealityAugmentor.VirtualSettings();
        os.add(vs);
        realityAugmentorSettings.add(os);
    }
    BeanNode realityAugmentorNode = new CleanBeanNode<RealityAugmentor.Settings>
            (realityAugmentorSettings, editors, "RealityAugmentor");

    if (trackingSettings == null) {
        trackingSettings = new TrackingWorker.Settings();
    }
    BeanNode trackingNode = new CleanBeanNode<TrackingWorker.Settings>
            (trackingSettings, editors, "TrackingWorker");

    Children children = new Children.Array();
    children.add(new Node[] { cameraNode, projectorNode, objectFinderNode,
            markerDetectorNode, alignerNode, handMouseNode, virtualBallNode,
            realityAugmentorNode, trackingNode });

    Node root = new AbstractNode(children);
    root.setName("Settings");
    manager.setRootContext(root);
}