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


Java WebcamResolution类代码示例

本文整理汇总了Java中com.github.sarxos.webcam.WebcamResolution的典型用法代码示例。如果您正苦于以下问题:Java WebcamResolution类的具体用法?Java WebcamResolution怎么用?Java WebcamResolution使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: takePic

import com.github.sarxos.webcam.WebcamResolution; //导入依赖的package包/类
public void takePic() {
	// get default webcam and open it
	Webcam webcam = Webcam.getDefault();

	Dimension[] nonStandardResolutions = new Dimension[] { WebcamResolution.PAL.getSize(),
			WebcamResolution.HD720.getSize(), new Dimension(2000, 1000), new Dimension(1000, 500), };
	webcam.setCustomViewSizes(nonStandardResolutions);
	webcam.setViewSize(WebcamResolution.HD720.getSize());
	webcam.open();

	// get image
	BufferedImage image = webcam.getImage();

	// save image to PNG file
	try {
		ImageIO.write(image, "PNG", new File("src/capture/test.png"));
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	webcam.close();
}
 
开发者ID:badarshahzad,项目名称:SudoTimer,代码行数:23,代码来源:MainViewController.java

示例2: run

import com.github.sarxos.webcam.WebcamResolution; //导入依赖的package包/类
@Override
		public void run() {

			Webcam webcam = Webcam.getDefault();
			webcam.setViewSize(WebcamResolution.VGA.getSize());
			webcam.open();

			JFrame frame=new JFrame();
			frame.setTitle("webcam capture");
//			frame.setLayout(new FlowLayout());
			JLabel lbl = new JLabel();
			frame.add(lbl);
			frame.setVisible(true);
			
			while (true) {
				if (!webcam.isOpen()) break;

				BufferedImage image = webcam.getImage();
				if (image == null) break;

				frame.setSize(image.getWidth(),image.getHeight());
				lbl.setIcon(new ImageIcon(image));
			}
		}
 
开发者ID:cycronix,项目名称:cloudturbine,代码行数:25,代码来源:CTwebcam.java

示例3: main

import com.github.sarxos.webcam.WebcamResolution; //导入依赖的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);
	}
 
开发者ID:cycronix,项目名称:cloudturbine,代码行数:19,代码来源:CTcamera.java

示例4: createUIComponents

import com.github.sarxos.webcam.WebcamResolution; //导入依赖的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();
    }

}
 
开发者ID:bither,项目名称:bither-desktop-java,代码行数:16,代码来源:ScanQRCodeDialog.java

示例5: SearchQRCode

import com.github.sarxos.webcam.WebcamResolution; //导入依赖的package包/类
public SearchQRCode(){
	Dimension size = WebcamResolution.QVGA.getSize();
	List<Webcam> webcams = Webcam.getWebcams();
	if(webcams != null && webcams.size() > 0){
		webcam = webcams.get(0);
		webcam.setViewSize(size);
	}else{
		throw new RuntimeException("No webcam found...");
	}
}
 
开发者ID:devmel,项目名称:SerialTerminal,代码行数:11,代码来源:SearchQRCode.java

示例6: ma2in

import com.github.sarxos.webcam.WebcamResolution; //导入依赖的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);
    }
}
 
开发者ID:InternationalSchoolBangkok,项目名称:ROV,代码行数:35,代码来源:Learning.java

示例7: ScanDialog

import com.github.sarxos.webcam.WebcamResolution; //导入依赖的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);
}
 
开发者ID:ScripterRon,项目名称:BitcoinWallet,代码行数:46,代码来源:ScanDialog.java

示例8: startQRScan

import com.github.sarxos.webcam.WebcamResolution; //导入依赖的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();
 
}
 
开发者ID:BitcoinAuthenticator,项目名称:Wallet,代码行数:35,代码来源:StartupController.java

示例9: runQRCamera

import com.github.sarxos.webcam.WebcamResolution; //导入依赖的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();
}
 
开发者ID:BitcoinAuthenticator,项目名称:Wallet,代码行数:33,代码来源:SendToCell.java

示例10: webCam

import com.github.sarxos.webcam.WebcamResolution; //导入依赖的package包/类
private BufferedImage webCam()
{	
	//**get default webcam..set resolution..open it
	Webcam webcam = Webcam.getDefault();
	webcam.setViewSize(WebcamResolution.VGA.getSize());
	webcam.open();
	
	BufferedImage pic = webcam.getImage();
	webcam.close(); // Not sure if webcam should stay open or be closed after each use.
	return pic;
}
 
开发者ID:lo9key,项目名称:ASCII_Art,代码行数:12,代码来源:GUI_ButtonPanel.java

示例11: CapturarFotoManager

import com.github.sarxos.webcam.WebcamResolution; //导入依赖的package包/类
public CapturarFotoManager (FichaDetenido detenido) throws ExcepcionComponenteNulo, ExcepcionCampoVacio {
    this.fichaDetenido = fichaDetenido;
    this.capturarFotoDialog = new CapturarFotoDialog(null, true);
    this.procesos = new Utils();
    this.eventos = new CapturarFotoMethods(this.capturarFotoDialog, this.procesos);
    
    //this.detenido = detenido;
    JOptionPane.showMessageDialog(this.capturarFotoDialog, "id del detenido: " + detenido);
    
    this.capturarFotoDialog.getBtnAceptar().addActionListener(this);
    this.capturarFotoDialog.getBtnCamara().addActionListener(this);
    this.capturarFotoDialog.getBtnCancelar().addActionListener(this);
    this.capturarFotoDialog.getBtnConfiguracion().addActionListener(this);
    this.capturarFotoDialog.getBtnRecapturar().addActionListener(this);
    this.capturarFotoDialog.getBtnZoomIn().addActionListener(this);
    this.capturarFotoDialog.getBtnZoomOut().addActionListener(this);
    
    this.capturarFotoDialog.setTitle(this.procesos.cargarMembreteBarraTitulo(ConstantsApp.ACRONIMO_MODULO_FICHA_DETENIDO, "Administrador", ConstantsApp.TITULO_COMPLETO));
    //this.capturarFotoDialog.setSize(1150, 740);
    this.capturarFotoDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    
    this.camaraThread = new CamaraThread(capturarFotoDialog, 0, WebcamResolution.VGA.getSize());
    camaraThread.start();
    this.listaImagenes = new ArrayList<BufferedImage>();
    //this.capturarFotoDialog.getBtnCancelar().setVisible(false);
    activarTomarFoto();
    System.out.println("pasa por aqui");
    this.capturarFotoDialog.setVisible(true);
    
}
 
开发者ID:sicodetv20,项目名称:dev.sicodetv2.1,代码行数:31,代码来源:CapturarFotoManager.java

示例12: run

import com.github.sarxos.webcam.WebcamResolution; //导入依赖的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();
}
 
开发者ID:ExsonCardona,项目名称:ESIPC,代码行数:49,代码来源:camara.java

示例13: run

import com.github.sarxos.webcam.WebcamResolution; //导入依赖的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();
          
}
 
开发者ID:ExsonCardona,项目名称:ESIPC,代码行数:53,代码来源:camara.java

示例14: run

import com.github.sarxos.webcam.WebcamResolution; //导入依赖的package包/类
@Override
public void run(EyeballsConfiguration eyeballsConfiguration, Environment environment) throws Exception {

    Security.addProvider(new BouncyCastleProvider());

    createUnderylingStorageDirectories(eyeballsConfiguration);

    if (eyeballsConfiguration.getUseAuth()) {
        environment.jersey().register(new AuthDynamicFeature(
                new BasicCredentialAuthFilter.Builder<BasicAuthenticator.EyeballUser>()
                        .setAuthenticator(new BasicAuthenticator(eyeballsConfiguration))
                        .setRealm("Eyeballs Motion Detection Server")
                        .buildAuthFilter()));
    }
    DB db = buildMapDb(eyeballsConfiguration);
    BTreeMap<String, MotionEvent> motionEventStore = db.createTreeMap("motionEventStore")
            .valueSerializer(new LocalEventSerializer())
            .makeOrGet();

    Webcam webcam = Webcam.getDefault();
    if (webcam == null) {
        throw new RuntimeException("No webcam present, or not available to the current user.");
    }

    PictureTakingService pictureTakingService = new PictureTakingService(webcam);
    webcam.addWebcamListener(pictureTakingService);

    Dimension[] dimensions = (Dimension[]) Arrays.stream(WebcamResolution.values())
            .map(WebcamResolution::getSize)
            .collect(Collectors.toList())
            .toArray();

    webcam.setCustomViewSizes(dimensions);
    webcam.setViewSize(new Dimension(eyeballsConfiguration.getImageWidth(), eyeballsConfiguration.getImageHeight()));
    webcam.open();

    MotionEventProcessor.Builder processorBuilder = new MotionEventProcessor.Builder();

    if (eyeballsConfiguration.getUseSftp()) {
        processorBuilder.addMotionEventConsumer(new SftpMotionEventConsumer(eyeballsConfiguration));
    }

    if (eyeballsConfiguration.getUseDropbox()) {
        processorBuilder.addMotionEventConsumer(new DropboxMotionEventConsumer(eyeballsConfiguration));
    }

    if (eyeballsConfiguration.getUseLocalPersistence()) {
        LocalFSMotionEventConsumer localFSMotionEventConsumer = new LocalFSMotionEventConsumer(db, eyeballsConfiguration, motionEventStore);
        processorBuilder.addMotionEventConsumer(localFSMotionEventConsumer);
        processorBuilder.motionEventPersitence(localFSMotionEventConsumer);
    }

    if (eyeballsConfiguration.getUseDropboxPersistence()) {
        processorBuilder.motionEventPersitence(new DropBoxMotionEventPersistence(eyeballsConfiguration, motionEventStore));
    }

    processorBuilder.motionEventStore(motionEventStore);

    MotionEventProcessor motionEventProcessor = processorBuilder.build();

    MotionDetectionService motionDetectionService = new MotionDetectionService(eyeballsConfiguration,
            new SaveMotionDetectedListener(motionEventProcessor, eyeballsConfiguration));
    motionDetectionService.startAndWait();

    EyeballsResource eyeballsResource = new EyeballsResource(webcam, motionEventProcessor, pictureTakingService);

    environment.jersey().register(eyeballsResource);
}
 
开发者ID:chriskearney,项目名称:eyeballs,代码行数:69,代码来源:EyeballsApplication.java

示例15: setupWebcam

import com.github.sarxos.webcam.WebcamResolution; //导入依赖的package包/类
private void setupWebcam() {
	Dimension size = WebcamResolution.QVGA.getSize();

	webcam = Webcam.getWebcams().get(0);
	webcam.setViewSize(size);

	WebcamPanel panel = new WebcamPanel(webcam);
	panel.setPreferredSize(size);
	
	panelForCam.add(panel);
	
	executor.execute(this);
}
 
开发者ID:pavel4n,项目名称:wowdoge.org,代码行数:14,代码来源:DialogWebcamQRScan.java


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