当前位置: 首页>>代码示例>>Java>>正文


Java DisplayUtilities.ImageComponent方法代码示例

本文整理汇总了Java中org.openimaj.image.DisplayUtilities.ImageComponent方法的典型用法代码示例。如果您正苦于以下问题:Java DisplayUtilities.ImageComponent方法的具体用法?Java DisplayUtilities.ImageComponent怎么用?Java DisplayUtilities.ImageComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openimaj.image.DisplayUtilities的用法示例。


在下文中一共展示了DisplayUtilities.ImageComponent方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createUI

import org.openimaj.image.DisplayUtilities; //导入方法依赖的package包/类
private void createUI() {
	final JFrame frame = new JFrame("PDM Builder");

	final JPanel panel = new JPanel();
	frame.getContentPane().add(panel);

	ic = new DisplayUtilities.ImageComponent(true, false);
	ic.setAllowPanning(false);
	ic.setAllowZoom(false);
	ic.setImage(ImageUtilities.createBufferedImage(images.get(0)));
	ic.setPreferredSize(ic.getSize());
	ic.addMouseListener(new MouseAdapter() {
		@Override
		public void mouseClicked(MouseEvent e) {
			registerClick(e.getX(), e.getY());
		}
	});
	panel.add(ic);

	final SpinnerModel model = new SpinnerNumberModel(0, 0, images.size(), 1);
	imageSpinner = new JSpinner(model);
	new JSpinner.NumberEditor(imageSpinner);
	imageSpinner.addChangeListener(this);
	panel.add(imageSpinner);

	labelsList = new JComboBox<String>(pointLabels);
	labelsList.addActionListener(this);
	panel.add(labelsList);

	frame.pack();
	frame.setVisible(true);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:33,代码来源:PDMBuilder.java

示例2: getComponent

import org.openimaj.image.DisplayUtilities; //导入方法依赖的package包/类
@Override
public Component getComponent(int width, int height) throws IOException {
	points = new ArrayList<double[]>();
	classes = new ArrayList<Integer>();
	classifier = new SimplePerceptron();

	vc = new VideoCaptureComponent(VIDEO_WIDTH, VIDEO_HEIGHT);
	vc.getDisplay().addVideoListener(this);

	// the main panel
	final JPanel base = new JPanel();
	base.setOpaque(false);
	base.setPreferredSize(new Dimension(width, height));
	base.setLayout(new GridBagLayout());

	// left hand side (video, features)
	final Box videoCtrls = Box.createVerticalBox();
	videoCtrls.setOpaque(false);
	videoCtrls.add(vc);
	videoCtrls.add(Box.createVerticalStrut(10));
	final JPanel colourspacesPanel = createColourSpaceButtons();
	videoCtrls.add(colourspacesPanel);
	createFeatureField();
	videoCtrls.add(Box.createVerticalStrut(10));
	videoCtrls.add(featureField);
	base.add(videoCtrls);

	// right hand box
	final Box rightPanel = Box.createVerticalBox();
	rightPanel.setOpaque(false);
	image = new MBFImage(GRAPH_WIDTH, GRAPH_HEIGHT, ColourSpace.RGB);
	image.fill(RGBColour.WHITE);
	imageComp = new DisplayUtilities.ImageComponent(true, false);
	imageComp.setShowPixelColours(false);
	imageComp.setShowXYPosition(false);
	imageComp.setAllowZoom(false);
	imageComp.setAllowPanning(false);
	rightPanel.add(imageComp);
	final JPanel classCtrlsCnt = new JPanel(new GridLayout(1, 2));

	// learning controls
	final JPanel learnCtrls = new JPanel(new GridLayout(0, 1));
	classType = new JComboBox<String>();
	for (final String c : CLASSES)
		classType.addItem(c);
	learnCtrls.add(classType);
	final JButton learnButton = new JButton("Learn");
	learnButton.setActionCommand("button.learn");
	learnButton.addActionListener(this);
	learnCtrls.add(learnButton);
	classCtrlsCnt.add(learnCtrls);

	// classification controls
	final JPanel classCtrls = new JPanel(new GridLayout(0, 1));
	classCtrls.setOpaque(false);
	guess = new JTextField(8);
	guess.setOpaque(false);
	guess.setFont(Font.decode("Monaco-24"));
	guess.setHorizontalAlignment(JTextField.CENTER);
	guess.setEditable(false);
	classCtrls.add(guess);
	classCtrlsCnt.add(classCtrls);

	rightPanel.add(classCtrlsCnt);

	base.add(rightPanel);

	redraw();
	return base;
}
 
开发者ID:jonhare,项目名称:ecs-summer-school-vision-lecture,代码行数:71,代码来源:LinearClassifierDemo.java

示例3: getComponent

import org.openimaj.image.DisplayUtilities; //导入方法依赖的package包/类
@Override
public Component getComponent(int width, int height) throws IOException {
	final JPanel base = new JPanel();
	base.setOpaque(false);
	base.setPreferredSize(new Dimension(width, height));
	base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS));

	image = new MBFImage(width, height - 50, ColourSpace.RGB);
	renderer = image.createRenderer(RenderHints.ANTI_ALIASED);
	resetImage();

	ic = new DisplayUtilities.ImageComponent(true, false);
	ic.setShowPixelColours(false);
	ic.setShowXYPosition(false);
	ic.setAllowPanning(false);
	ic.setAllowZoom(false);
	ic.addMouseListener(this);
	ic.addMouseMotionListener(this);
	base.add(ic);

	final JPanel controls = new JPanel();
	controls.setPreferredSize(new Dimension(width, 50));
	controls.setMaximumSize(new Dimension(width, 50));
	controls.setSize(new Dimension(width, 50));

	clearBtn = new JButton("Clear");
	clearBtn.setActionCommand("button.clear");
	clearBtn.addActionListener(this);
	controls.add(clearBtn);

	controls.add(new JSeparator(SwingConstants.VERTICAL));
	controls.add(new JLabel("K:"));

	kSpn = new JSpinner(new SpinnerNumberModel(1, 1, 10, 1));
	controls.add(kSpn);

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	runBtn = new JButton("Run KMeans");
	runBtn.setActionCommand("button.run");
	runBtn.addActionListener(this);
	controls.add(runBtn);

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	cnclBtn = new JButton("Cancel");
	cnclBtn.setEnabled(false);
	cnclBtn.setActionCommand("button.cancel");
	cnclBtn.addActionListener(this);
	controls.add(cnclBtn);

	base.add(controls);

	updateImage();

	return base;
}
 
开发者ID:jonhare,项目名称:COMP6208,代码行数:58,代码来源:KMeansDemo.java

示例4: getComponent

import org.openimaj.image.DisplayUtilities; //导入方法依赖的package包/类
@Override
public Component getComponent(int width, int height) throws IOException {
	final JPanel base = new JPanel();
	base.setOpaque(false);
	base.setPreferredSize(new Dimension(width, height));
	base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS));

	image = new MBFImage(width, height - 56, ColourSpace.RGB);
	som = new float[(height - 56) / somfactor][width / somfactor][rawdata.getTerms().size()];
	renderer = image.createRenderer(RenderHints.ANTI_ALIASED);
	resetImage();

	ic = new DisplayUtilities.ImageComponent(true, false);
	ic.setShowPixelColours(false);
	ic.setShowXYPosition(false);
	ic.setAllowPanning(false);
	ic.setAllowZoom(false);
	base.add(ic);

	final JPanel controls = new JPanel();
	controls.setPreferredSize(new Dimension(width, 56));
	controls.setMaximumSize(new Dimension(width, 56));
	controls.setSize(new Dimension(width, 56));

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	runBtn = new JButton("Run SOM");
	runBtn.setActionCommand("button.run");
	runBtn.addActionListener(this);
	controls.add(runBtn);

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	cnclBtn = new JButton("Cancel");
	cnclBtn.setEnabled(false);
	cnclBtn.setActionCommand("button.cancel");
	cnclBtn.addActionListener(this);
	controls.add(cnclBtn);

	base.add(controls);

	updateImage();

	return base;
}
 
开发者ID:jonhare,项目名称:COMP6237,代码行数:46,代码来源:SOMDemo.java

示例5: getComponent

import org.openimaj.image.DisplayUtilities; //导入方法依赖的package包/类
@Override
public Component getComponent(int width, int height) throws IOException {
	final JPanel base = new JPanel();
	base.setOpaque(false);
	base.setPreferredSize(new Dimension(width, height));
	base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS));

	image = new MBFImage(width, height - 50, ColourSpace.RGB);
	renderer = image.createRenderer(RenderHints.ANTI_ALIASED);
	resetImage();

	ic = new DisplayUtilities.ImageComponent(true, false);
	ic.setShowPixelColours(false);
	ic.setShowXYPosition(false);
	ic.setAllowPanning(false);
	ic.setAllowZoom(false);
	ic.addMouseListener(this);
	ic.addMouseMotionListener(this);
	base.add(ic);

	final JPanel controls = new JPanel();
	controls.setPreferredSize(new Dimension(width, 50));
	controls.setMaximumSize(new Dimension(width, 50));
	controls.setSize(new Dimension(width, 50));

	clearBtn = new JButton("Clear");
	clearBtn.setActionCommand("button.clear");
	clearBtn.addActionListener(this);
	controls.add(clearBtn);

	controls.add(new JSeparator(SwingConstants.VERTICAL));
	controls.add(new JLabel("K:"));

	kSpn = new JSpinner(new SpinnerNumberModel(1, 1, 10, 1));
	controls.add(kSpn);

	controls.add(new JSeparator(SwingConstants.VERTICAL));
	controls.add(new JLabel("Distance:"));

	distCombo = new JComboBox<String>();
	distCombo.addItem("Euclidean");
	distCombo.addItem("Manhatten");
	distCombo.addItem("Cosine Distance");
	controls.add(distCombo);

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	runBtn = new JButton("Run KMeans");
	runBtn.setActionCommand("button.run");
	runBtn.addActionListener(this);
	controls.add(runBtn);

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	cnclBtn = new JButton("Cancel");
	cnclBtn.setEnabled(false);
	cnclBtn.setActionCommand("button.cancel");
	cnclBtn.addActionListener(this);
	controls.add(cnclBtn);

	base.add(controls);

	updateImage();

	return base;
}
 
开发者ID:jonhare,项目名称:COMP6237,代码行数:67,代码来源:KMeansDemo.java

示例6: getComponent

import org.openimaj.image.DisplayUtilities; //导入方法依赖的package包/类
@Override
public Component getComponent(int width, int height) throws IOException {
	final JPanel base = new JPanel();
	base.setOpaque(false);
	base.setPreferredSize(new Dimension(width, height));
	base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS));

	image = new MBFImage(width, height - 50, ColourSpace.RGB);
	renderer = image.createRenderer(RenderHints.ANTI_ALIASED);
	resetImage();

	ic = new DisplayUtilities.ImageComponent(true, false);
	ic.setShowPixelColours(false);
	ic.setShowXYPosition(false);
	ic.setAllowPanning(false);
	ic.setAllowZoom(false);
	ic.addMouseListener(this);
	ic.addMouseMotionListener(this);
	base.add(ic);

	final JPanel controls = new JPanel();
	controls.setPreferredSize(new Dimension(width, 50));
	controls.setMaximumSize(new Dimension(width, 50));
	controls.setSize(new Dimension(width, 50));

	clearBtn = new JButton("Clear");
	clearBtn.setActionCommand("button.clear");
	clearBtn.addActionListener(this);
	controls.add(clearBtn);

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	controls.add(new JLabel("H:"));
	hSpn = new JSpinner(new SpinnerNumberModel(30, 1, 100, 5));
	controls.add(hSpn);

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	runBtn = new JButton("Run Mean Shift");
	runBtn.setActionCommand("button.run");
	runBtn.addActionListener(this);
	controls.add(runBtn);

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	cnclBtn = new JButton("Cancel");
	cnclBtn.setEnabled(false);
	cnclBtn.setActionCommand("button.cancel");
	cnclBtn.addActionListener(this);
	controls.add(cnclBtn);

	base.add(controls);

	updateImage();

	return base;
}
 
开发者ID:jonhare,项目名称:COMP6237,代码行数:58,代码来源:MeanShiftDemo.java

示例7: getComponent

import org.openimaj.image.DisplayUtilities; //导入方法依赖的package包/类
@Override
public Component getComponent(int width, int height) throws IOException {
	final JPanel base = new JPanel();
	base.setOpaque(false);
	base.setPreferredSize(new Dimension(width, height));
	base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS));

	image = new MBFImage(width, height - 50, ColourSpace.RGB);
	renderer = image.createRenderer(RenderHints.ANTI_ALIASED);
	resetImage();

	ic = new DisplayUtilities.ImageComponent(true, false);
	ic.setShowPixelColours(false);
	ic.setShowXYPosition(false);
	ic.setAllowPanning(false);
	ic.setAllowZoom(false);
	ic.addMouseListener(this);
	ic.addMouseMotionListener(this);
	base.add(ic);

	final JPanel controls = new JPanel();
	controls.setPreferredSize(new Dimension(width, 50));
	controls.setMaximumSize(new Dimension(width, 50));
	controls.setSize(new Dimension(width, 50));

	clearBtn = new JButton("Clear");
	clearBtn.setActionCommand("button.clear");
	clearBtn.addActionListener(this);
	controls.add(clearBtn);

	controls.add(new JSeparator(SwingConstants.VERTICAL));
	controls.add(new JLabel("Distance:"));

	distCombo = new JComboBox<String>();
	distCombo.addItem("Euclidean");
	distCombo.addItem("Manhatten");
	distCombo.addItem("Cosine Distance");
	controls.add(distCombo);

	controls.add(new JSeparator(SwingConstants.VERTICAL));
	controls.add(new JLabel("Linkage:"));

	linkCombo = new JComboBox<String>();
	for (final Linkage s : Linkage.values())
		linkCombo.addItem(s.name());
	controls.add(linkCombo);

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	runBtn = new JButton("Run HAC");
	runBtn.setActionCommand("button.run");
	runBtn.addActionListener(this);
	controls.add(runBtn);

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	cnclBtn = new JButton("Cancel");
	cnclBtn.setEnabled(false);
	cnclBtn.setActionCommand("button.cancel");
	cnclBtn.addActionListener(this);
	controls.add(cnclBtn);

	base.add(controls);

	updateImage();

	return base;
}
 
开发者ID:jonhare,项目名称:COMP6237,代码行数:69,代码来源:HClusterDemo.java


注:本文中的org.openimaj.image.DisplayUtilities.ImageComponent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。