本文整理汇总了Java中com.github.sarxos.webcam.WebcamPanel类的典型用法代码示例。如果您正苦于以下问题:Java WebcamPanel类的具体用法?Java WebcamPanel怎么用?Java WebcamPanel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WebcamPanel类属于com.github.sarxos.webcam包,在下文中一共展示了WebcamPanel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: VideoLlamada
import com.github.sarxos.webcam.WebcamPanel; //导入依赖的package包/类
public void VideoLlamada() {
Webcam webcam = Webcam.getDefault();
WebcamPanel panel = new WebcamPanel(webcam);
panel.setFPSDisplayed(true);
JFrame window = new JFrame("VIDEO CALL");
window.setTitle("Haciendo videollamada con " + jt_Name_Contacts.getText());
window.setExtendedState(MAXIMIZED_BOTH);
panel.setFillArea(true);
window.add(panel);
window.pack();
window.setVisible(true);
}
示例2: main
import com.github.sarxos.webcam.WebcamPanel; //导入依赖的package包/类
public static void main(String[] args) throws InterruptedException {
Webcam webcam = Webcam.getDefault();
webcam.setViewSize(WebcamResolution.VGA.getSize());
WebcamPanel panel = new WebcamPanel(webcam);
panel.setFPSDisplayed(true);
// panel.setDisplayDebugInfo(true);
panel.setImageSizeDisplayed(true);
panel.setMirrored(true);
JFrame window = new JFrame("Test webcam panel");
window.add(panel);
window.setResizable(true);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.pack();
window.setVisible(true);
}
示例3: WebCamReceiptSchedulePanel
import com.github.sarxos.webcam.WebcamPanel; //导入依赖的package包/类
public WebCamReceiptSchedulePanel(final WebCamReceiptScheduleModel model)
{
super();
this.model = model;
final ITerminalContext terminalContext = model.getTerminalContext();
factory = terminalContext.getTerminalFactory();
// init components
{
panel = factory.createContainer();
webCamPanel = new WebcamPanel(model.getWebcam());
webCamPanel.setFillArea(true);
webCamPanel.setFPS(model.getFPS());
}
initLayout();
terminalContext.addToDisposableComponents(this);
}
示例4: tbtSwitchCameraActionPerformed
import com.github.sarxos.webcam.WebcamPanel; //导入依赖的package包/类
private void tbtSwitchCameraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbtSwitchCameraActionPerformed
// TODO add your handling code here:
if(tbtSwitchCamera.isSelected())
{
webcam.open();
tbtSwitchCamera.setText("Fechar webcam");
habilitarBotoesCamera(true);
}else
{
webcam.close();
painelWebcam = new WebcamPanel(webcam, false);
painelWebcam.repaint();
this.pack();
tbtSwitchCamera.setText("Abrir webcam");
habilitarBotoesCamera(false);
}
}
示例5: createUIComponents
import com.github.sarxos.webcam.WebcamPanel; //导入依赖的package包/类
private void createUIComponents() {
Dimension size = WebcamResolution.QVGA.getSize();
java.util.List<Webcam> webcams = Webcam.getWebcams();
if (webcams.size() > 0) {
webcam = webcams.get(0);
webcam.setViewSize(size);
panel = new WebcamPanel(webcam);
panel.setPreferredSize(size);
scanPanel.add(panel);
} else {
onCancel();
new MessageDialog(LocaliserUtils.getString("camer_is_not_available")).showMsg();
}
}
示例6: ma2in
import com.github.sarxos.webcam.WebcamPanel; //导入依赖的package包/类
public static void ma2in(String[] args) throws InterruptedException
{
try {
IpCamAuth auth = new IpCamAuth("rovguest", "rov");
IpCamDevice olga = IpCamDeviceRegistry.register("Olga", "http://172.16.65.196:6969/videostream.cgi?loginuse=rovguest&loginpas=rov", IpCamMode.PUSH, auth);
IpCamDevice alexei = IpCamDeviceRegistry.register("Alexei", "http://172.16.65.197:6969/videostream.cgi?loginuse=rovguest&loginpas=rov", IpCamMode.PUSH, auth);
olga.setResolution(WebcamResolution.VGA.getSize());
alexei.setResolution(WebcamResolution.VGA.getSize());
WebcamPanel panel0 = new WebcamPanel(Webcam.getWebcams().get(0));
WebcamPanel panel1 = new WebcamPanel(Webcam.getWebcams().get(1));
panel0.setFPSDisplayed(true);
panel0.setDisplayDebugInfo(true);
panel0.setImageSizeDisplayed(true);
panel1.setFPSDisplayed(true);
panel1.setDisplayDebugInfo(true);
panel1.setImageSizeDisplayed(true);
JFrame window = new JFrame("Test webcam panel");
window.setLayout(new GridBagLayout());
window.add(panel0);
window.add(panel1);
window.setResizable(true);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.pack();
window.setVisible(true);
} catch(MalformedURLException ex) {
Logger.getLogger(Learning.class.getName()).log(Level.SEVERE, null, ex);
}
}
示例7: main
import com.github.sarxos.webcam.WebcamPanel; //导入依赖的package包/类
public static void main(String[] args) {
JFrame window = new JFrame("Painel de Teste");
window.add(new WebcamPanel(Webcam.getDefault()));
window.pack();
window.setVisible(true);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
示例8: ScanDialog
import com.github.sarxos.webcam.WebcamPanel; //导入依赖的package包/类
/**
* Create the dialog
*
* @param parent Parent frame
* @param webcam Web camera
*/
public ScanDialog(JDialog parent, Webcam webcam) {
super(parent, "Scan QR Code", Dialog.ModalityType.DOCUMENT_MODAL);
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
//
// Create the webcam panel (this will display the webcam stream to the user)
//
this.webcam = webcam;
webcam.setViewSize(WebcamResolution.VGA.getSize());
webcamPanel = new WebcamPanel(webcam);
webcamPanel.setMirrored(true);
//
// Create the buttons (Cancel)
//
JPanel buttonPane = new ButtonPane(this, 10, new String[] {"Cancel", "cancel"});
//
// Set up the content pane
//
JPanel contentPane = new JPanel();
contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
contentPane.setOpaque(true);
contentPane.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));
contentPane.add(webcamPanel);
contentPane.add(Box.createVerticalStrut(15));
contentPane.add(buttonPane);
setContentPane(contentPane);
//
// Set up the barcode reader to look for just QR codes
//
barcodeReader = new MultiFormatReader();
Map<DecodeHintType, Object> hints = new HashMap<>();
List<BarcodeFormat> formats = new ArrayList<>();
formats.add(BarcodeFormat.QR_CODE);
hints.put(DecodeHintType.POSSIBLE_FORMATS, formats);
barcodeReader.setHints(hints);
//
// Listen for webcam events (we will scan webcam images looking for a QR code)
//
webcam.addWebcamListener(this);
}
示例9: startQRScan
import com.github.sarxos.webcam.WebcamPanel; //导入依赖的package包/类
@FXML protected void startQRScan(ActionEvent event){
btnStartWebCamQRScan.setText("Starting...");
new Thread(){
@Override
public void run() {
camFrame = new JFrame();
Dimension size = WebcamResolution.QVGA.getSize();
webcam = Webcam.getDefault();
webcam.setViewSize(size);
WebcamPanel panel = new WebcamPanel(webcam);
Platform.runLater(new Runnable() {
@Override
public void run() {
camFrame.add(panel);
camFrame.pack();
camFrame.setVisible(true);
camFrame.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent windowEvent) {
webcam.close();
}
});
btnStartWebCamQRScan.setText("");
}
});
tryAndReadQR(webcam);
}
}.start();
}
示例10: runQRCamera
import com.github.sarxos.webcam.WebcamPanel; //导入依赖的package包/类
private void runQRCamera() {
new Thread(){
@Override
public void run() {
camFrame = new JFrame();
Dimension size = WebcamResolution.QVGA.getSize();
webcam = Webcam.getDefault();
webcam.setViewSize(size);
WebcamPanel panel = new WebcamPanel(webcam);
Platform.runLater(new Runnable() {
@Override
public void run() {
camFrame.add(panel);
camFrame.pack();
camFrame.setVisible(true);
camFrame.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent windowEvent) {
webcam.close();
}
});
}
});
tryAndReadQR(webcam);
}
}.start();
}
示例11: beginToWatch
import com.github.sarxos.webcam.WebcamPanel; //导入依赖的package包/类
private void beginToWatch()
{
webcam = Webcam.getDefault();
//webcam.setViewSize(new Dimension(640,480));
WebcamPanel panel = new WebcamPanel(webcam);
panel.setFillArea(rootPaneCheckingEnabled);
mf.panelCentral.removeAll();
mf.panelCentral.add(panel, BorderLayout.CENTER);
mf.panelCentral.updateUI();
}
示例12: run
import com.github.sarxos.webcam.WebcamPanel; //导入依赖的package包/类
@Override
public void run() {
Webcam.addDiscoveryListener(this);
setTitle("Java Webcam Capture POC");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new BorderLayout());
addWindowListener(this);
picker = new WebcamPicker();
picker.addItemListener(this);
webcam = picker.getSelectedWebcam();
if (webcam == null) {
System.out.println("No webcams found...");
System.exit(1);
}
webcam.setViewSize(WebcamResolution.VGA.getSize());
webcam.addWebcamListener(camara.this);
panel = new WebcamPanel(webcam, false);
panel.setFPSDisplayed(true);
add(picker, BorderLayout.NORTH);
add(panel, BorderLayout.CENTER);
add(boton, BorderLayout.SOUTH);
boton.addActionListener(this);
pack();
setVisible(true);
Thread t = new Thread() {
@Override
public void run() {
panel.start();
}
};
t.setName("example-starter");
t.setDaemon(true);
t.setUncaughtExceptionHandler(this);
t.start();
}
示例13: run
import com.github.sarxos.webcam.WebcamPanel; //导入依赖的package包/类
@Override
public void run() {
Webcam.addDiscoveryListener(this);
setTitle("Java Webcam Capture POC");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new BorderLayout());
addWindowListener(this);
picker = new WebcamPicker();
picker.addItemListener(this);
webcam = picker.getSelectedWebcam();
if (webcam == null) {
System.out.println("No webcams found...");
System.exit(1);
}
webcam.setViewSize(WebcamResolution.VGA.getSize());
webcam.addWebcamListener(camara.this);
panel = new WebcamPanel(webcam, false);
panel.setFPSDisplayed(true);
add(picker, BorderLayout.NORTH);
add(panel, BorderLayout.CENTER);
add(boton, BorderLayout.SOUTH);
add(boton1, BorderLayout.NORTH);
boton.addActionListener(this);
boton1.addActionListener(this);
pack();
setVisible(true);
Thread t = new Thread() {
@Override
public void run() {
panel.start();
}
};
t.setName("example-starter");
t.setDaemon(true);
t.setUncaughtExceptionHandler(this);
t.start();
}
示例14: getPanel
import com.github.sarxos.webcam.WebcamPanel; //导入依赖的package包/类
public WebcamPanel getPanel(){
return new WebcamPanel(webcam);
}
示例15: connectCam
import com.github.sarxos.webcam.WebcamPanel; //导入依赖的package包/类
private void connectCam() {
olga = Webcam.getWebcams().get(0);
olga.setImageTransformer((BufferedImage image) -> {
int w = image.getWidth();
int h = image.getHeight();
BufferedImage modified = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = modified.createGraphics();
g2.drawImage(image, w, h, -w, -h, null);
g2.dispose();
modified.flush();
return modified;
});
WebcamPanel subOlga = new WebcamPanel(olga);
subOlga.setFPSDisplayed(true);
subOlga.setDisplayDebugInfo(true);
subOlga.setFPSLimit(60);
olgaPanel.removeAll();
olgaPanel.add(subOlga);
olgaPanel.revalidate();
olgaPanel.repaint();
alexei = Webcam.getWebcams().get(1);
WebcamPanel subAlexei = new WebcamPanel(alexei);
subAlexei.setFPSDisplayed(true);
subAlexei.setDisplayDebugInfo(true);
subAlexei.setFPSLimit(60);
alexeiPanel.removeAll();
alexeiPanel.add(subAlexei);
alexeiPanel.revalidate();
alexeiPanel.repaint();
maria = Webcam.getWebcams().get(2);
WebcamPanel subMaria = new WebcamPanel(maria);
subMaria.setFPSDisplayed(true);
subMaria.setDisplayDebugInfo(true);
subMaria.setFPSLimit(60);
mariaPanel.removeAll();
mariaPanel.add(subMaria);
mariaPanel.revalidate();
mariaPanel.repaint();
pack();
}