/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.seniorproject.augmentedreality.utils;

import com.github.sarxos.webcam.Webcam;
import com.github.sarxos.webcam.WebcamException;
import java.awt.Canvas;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeoutException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.JFrame;

/**
 *
 * @author RainWhileLoop
 */
public class TestWebcam {

    public static void main(String[] args) {
        Webcam webcam = Webcam.getDefault();
        webcam.open();
        System.out.println("\n\n\n-----------" + webcam.getDevice().getName());
        JFrame frame = new JFrame("TestWebcam");
        MyCanvas canvas = new MyCanvas();
        while (true) {
            BufferedImage bufferedImage = webcam.getImage();
            int width = bufferedImage.getWidth();
            int height = bufferedImage.getHeight();
            Image image = bufferedImage.getScaledInstance(width, height, Image.SCALE_DEFAULT);
            canvas.setImage(image);
            canvas.setSize(width, height);
            canvas.paint(bufferedImage.getGraphics());
            frame.add(canvas);

            frame.setSize(800, 600);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);

        }
    }
}

@@ -288,331 +288,60 @@
 ort 
-com.github.sarxos.webcam.WebcamException;%0D%0Aimport java.awt.Canvas;%0D%0Aimport java.awt.Image;%0D%0Aimport java.awt.image.BufferedImage;%0D%0Aimport java.io.File;%0D%0Aimport java.io.IOException;%0D%0Aimport java.util.concurrent.TimeoutException;%0D%0Aimport java.util.logging.Level;%0D%0Aimport java.util.logging.Logger;%0D%0Aimport javax.imageio.ImageIO
+java.awt.Image;%0D%0Aimport java.awt.image.BufferedImage
 ;%0D%0Ai

add test webcam