![JAR search and dependency download from the Maven repository](/logo.png)
boofcv.gui.calibration.MonoPlanarPanel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of visualize Show documentation
Show all versions of visualize Show documentation
BoofCV is an open source Java library for real-time computer vision and robotics applications.
The newest version!
/*
* Copyright (c) 2011-2016, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package boofcv.gui.calibration;
import boofcv.abst.geo.calibration.ImageResults;
import boofcv.alg.geo.calibration.CalibrationObservation;
import boofcv.alg.geo.calibration.Zhang99ParamAll;
import boofcv.gui.StandardAlgConfigPanel;
import boofcv.struct.calib.CameraPinholeRadial;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
/**
* GUI interface for CalibrateMonoPlanarGuiApp. Displays results for each calibration
* image in a window.
*
* @author Peter Abeles
*/
public class MonoPlanarPanel extends JPanel implements ItemListener ,
ListSelectionListener, ChangeListener
{
CalibratedImageGridPanel mainView = new CalibratedImageGridPanel();
JCheckBox checkPoints;
JCheckBox checkErrors;
JCheckBox checkUndistorted;
JCheckBox checkAll;
JCheckBox checkNumbers;
JCheckBox checkOrder;
JSpinner selectErrorScale;
JList imageList;
JTextArea meanError;
JTextArea maxError;
JTextArea paramCenterX;
JTextArea paramCenterY;
JTextArea paramA;
JTextArea paramB;
JTextArea paramC;
boolean showPoints = false;
boolean showErrors = true;
boolean showUndistorted = false;
boolean showAll = false;
boolean showNumbers = false;
boolean showOrder = true;
int selectedImage = 0;
List names = new ArrayList<>();
List images = new ArrayList<>();
List features = new ArrayList<>();
List results = new ArrayList<>();
int errorScale = 20;
public MonoPlanarPanel() {
super(new BorderLayout());
JToolBar toolBar = createToolBar();
imageList = new JList();
imageList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
imageList.addListSelectionListener(this);
meanError = createErrorComponent();
maxError = createErrorComponent();
paramCenterX = createErrorComponent();
paramCenterY = createErrorComponent();
paramA = createErrorComponent();
paramB = createErrorComponent();
paramC = createErrorComponent();
mainView.setImages(images);
mainView.setResults(features,results);
mainView.setDisplay(showPoints,showErrors,showUndistorted,showAll,showNumbers,showOrder,errorScale);
add(toolBar, BorderLayout.PAGE_START);
add(mainView, BorderLayout.CENTER);
add(new SideBar(), BorderLayout.WEST);
}
private JToolBar createToolBar() {
JToolBar toolBar = new JToolBar("Controls");
checkPoints = new JCheckBox("Show Points");
checkPoints.setSelected(showPoints);
checkPoints.addItemListener(this);
checkErrors = new JCheckBox("Show Errors");
checkErrors.setSelected(showErrors);
checkErrors.addItemListener(this);
checkAll = new JCheckBox("All Points");
checkAll.setSelected(showAll);
checkAll.addItemListener(this);
checkUndistorted = new JCheckBox("Undistort");
checkUndistorted.setSelected(showUndistorted);
checkUndistorted.addItemListener(this);
checkUndistorted.setEnabled(false);
checkNumbers = new JCheckBox("Numbers");
checkNumbers.setSelected(showNumbers);
checkNumbers.addItemListener(this);
checkOrder = new JCheckBox("Order");
checkOrder.setSelected(showOrder);
checkOrder.addItemListener(this);
selectErrorScale = new JSpinner(new SpinnerNumberModel(errorScale, 1, 100, 5));
selectErrorScale.addChangeListener(this);
selectErrorScale.setMaximumSize(selectErrorScale.getPreferredSize());
toolBar.add(checkPoints);
toolBar.add(checkErrors);
toolBar.add(checkAll);
toolBar.add(checkUndistorted);
toolBar.add(checkNumbers);
toolBar.add(checkOrder);
toolBar.add(new JLabel("| Error Scale"));
toolBar.add(selectErrorScale);
return toolBar;
}
private JTextArea createErrorComponent() {
JTextArea comp = new JTextArea(1,6);
comp.setMaximumSize(comp.getPreferredSize());
comp.setEditable(false);
return comp;
}
public void addImage( String name , BufferedImage image )
{
names.add(name);
images.add(image);
imageList.removeListSelectionListener(this);
imageList.setListData(new Vector
© 2015 - 2025 Weber Informatics LLC | Privacy Policy