Package com.googlecode.javacv

Examples of com.googlecode.javacv.CanvasFrame


        this.roiPts = roiPts.clone();
    }

    public static void main(String[] args) throws Exception {
        CanvasFrame frame = new CanvasFrame("Virtual Ball Test");
        IplImage image = IplImage.create(640, 960, IPL_DEPTH_8U, 3);
        cvSetZero(image);
        double[] roiPts = { 0,0, 640,0, 640,480, 0,400 };
        cvFillConvexPoly(image, new CvPoint((byte)16, roiPts), roiPts.length/2, CvScalar.WHITE, CV_AA, 16);
        VirtualBall virtualBall = new VirtualBall(new Settings(roiPts));

        for (int i = 0; i < 1000; i++) {
            Thread.sleep(100);
            cvSetZero(image);
            if (i == 50) {
                roiPts[5] -= 100;
            }
            if (i > 100 && i < 1200) {
                roiPts[3] += 1;
                roiPts[5] += 1;
            }
//if (i > 103) {
//    System.out.println(i);
//}
            cvFillConvexPoly(image, new CvPoint((byte)16, roiPts), roiPts.length/2, CvScalar.WHITE, CV_AA, 16);
            virtualBall.draw(image, roiPts);
            frame.showImage(image);
        }
    }
View Full Code Here


                cameraDevices[i] = new CameraDevice(cs[i]);
            } else {
                cameraDevices[i].setSettings(cs[i]);
            }
            if (cameraSettings.getMonitorWindowsScale() > 0) {
                cameraCanvasFrames[i] = new CanvasFrame(cs[i].getName());
            }
        }

        ProjectorDevice.Settings[] ps = projectorSettings.toArray();
        if (projectorDevices == null) {
View Full Code Here

                if (frameGrabbers[i].isTriggerMode()) {
                    frameGrabbers[i].trigger();
                }
                final IplImage image = frameGrabbers[i].grab();
                //final IplImage image = IplImage.create(640, 480, IPL_DEPTH_8U, 1);
                final CanvasFrame c = cameraCanvasFrames[i];
                final String name = cameraDevices[i].getSettings().getName();
                final double gamma = frameGrabbers[i].getGamma();
                EventQueue.invokeLater(new Runnable() {
                    public void run() {
                        int width = image.width(), height = image.height();
                        c.setCanvasSize((int)Math.round(width *scale),
                                        (int)Math.round(height*scale));
                        c.setTitle(name + " (" + width + " x " + height + "  " +
                                   (image.depth()&~IPL_DEPTH_SIGN) + " bpp  gamma = " +
                                   gamma + ") - ProCamCalib");
                    }
                });
            }
View Full Code Here

        projectorFrame = projectorDevice.createCanvasFrame();

        if (trackingSettings.getMonitorWindowsScale() > 0) {
            monitorWindows = new CanvasFrame[monitorWindowsTitles.length];
            for (int i = 0; i < monitorWindows.length; i++) {
                monitorWindows[i] = new CanvasFrame(monitorWindowsTitles[i]);
            }
        } else {
            monitorWindows = null;
        }
    }
View Full Code Here

            // resize and tile the monitor frames according to the size of the grabbed images
            if (monitorWindows != null) {
                final double scale = trackingSettings.getMonitorWindowsScale();
                // access FrameGrabber objects from _this_ thread *ONLY*...
                for (int i = 0; i < monitorWindows.length; i++) {
                    final CanvasFrame c = monitorWindows[i];
                    final int index = i;
                    EventQueue.invokeLater(new Runnable() {
                        public void run() {
                            c.setCanvasSize((int)Math.round(initWidth *scale),
                                            (int)Math.round(initHeight*scale));
                            c.setTitle(monitorWindowsTitles[index] + " (" +
                                    initWidth + " x " + initHeight + "  " +
                                    (initDepth&~IPL_DEPTH_SIGN) + " bpp  gamma = " +
                                    frameGrabber.getGamma() + ") - ProCamTracker");
                        }
                    });
View Full Code Here

   * can set up the camera position to capture the area they want
   */
  public static void show() {

    OpenCVFrameGrabber grabber = new OpenCVFrameGrabber(0); // 1 for next
    CanvasFrame canvas = new CanvasFrame("You have 10 seconds to position the camera then 10 seconds to leave the room");
    try {
      IplImage currFrame;
      grabber.start();
      long now = System.currentTimeMillis();
      // for 10 seconds
      while (System.currentTimeMillis() - now < 10000) {
        currFrame = grabber.grab();
        if (currFrame != null) {
          // 90_degrees_steps_anti_clockwise
          cvFlip(currFrame, currFrame, 1);// l-r =
          // show image on window
          canvas.showImage(currFrame);
        }
      }
      grabber.stop();
    } catch (Exception e) {
      e.printStackTrace();
    }
    canvas.dispose();

  }
View Full Code Here

    public CameraDetection() {
        OpenCVFrameGrabber grabber = new OpenCVFrameGrabber(0);
        try {
            grabber.start();
            IplImage frame = grabber.grab();
            canvasFrame = new CanvasFrame("Camera Detecção");
            canvasFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            canvasFrame.setCanvasSize(frame.width(), frame.height());
           
            CvMemStorage storage = CvMemStorage.create();
View Full Code Here

TOP

Related Classes of com.googlecode.javacv.CanvasFrame

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.