Package com.googlecode.javacv.cpp.opencv_core

Examples of com.googlecode.javacv.cpp.opencv_core.IplImage


      /*
       * this loop is so that the camera is given time to adjust to
       * lighting to get a good first frame for the motion detection.
       */
      warmup(grabber);
      IplImage firstFrame = grabber.grab();
      // send the first frame to the motionDetect Constructor
      MotionDetect detector = new MotionDetect(firstFrame);
      IplImage currFrame;

      while (true) {
        currFrame = grabber.grab();
        if (currFrame != null) {
          if (detector.Detect(currFrame)) {
            /*
             * hand over control of webcam to the record video
             * method to capture the frames for the 30 second movie
             */
            grabber.stop();
            recordVideo();
            // take control back of the webcam
            grabber.start();
            warmup(grabber);
            IplImage newbackground = grabber.grab();
            detector.setBackground(newbackground);
          }
        }
      }
    } catch (Exception e) {
View Full Code Here


    OpenCVFrameGrabber grabber = new OpenCVFrameGrabber(0);
    grabber.setFrameRate(frameRate);
    grabber.start();
    int numOfFrames = 0;
    int maxFramesIn10Seconds = 100;
    IplImage currFrame = grabber.grab();
    int height = currFrame.height();
    int width = currFrame.width();
    try {
      while (numOfFrames < maxFramesIn10Seconds) {
        if (currFrame != null) {
          String i = "" + numOfFrames;
          if (numOfFrames < 10) {
View Full Code Here

  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();
View Full Code Here

   */
  public boolean Detect(IplImage currFrame) {
   
    int h = currFrame.height();
    int w = currFrame.width();
    IplImage preProcessed = preProcess(currFrame);
    // diffImg = grayDiff(preProcessed, background); <-- no longer needed as
    // it has been consolidated into another method for optimization

    // threshold is 10 % of the total pixels
    int threshold = (int) (h * w * 0.1);
 
View Full Code Here

            (int) (redAdjust * (float) c.getRed()) << 16
                | (int) (greenAdjust * (float) c.getGreen()) << 8
                | (int) (blueAdjust * (float) c.getBlue()));
      }
    }
    IplImage colourAdjusted = IplImage.createFrom(bufImg);
    cvSaveImage("colourAdjusted.jpg", colourAdjusted);
    return colourAdjusted;
  }
View Full Code Here

        }
        Color newC = new Color((int) sum, (int) sum, (int) sum);
        edgeImg.setRGB(col, row, newC.getRGB());
      }
    }
    IplImage edgeDetected = IplImage.createFrom(edgeImg);
    cvSaveImage("edge_detect.jpg", edgeDetected);
    return edgeDetected;
  }
View Full Code Here

   */

  public static String getFrameWithFace(int maxFramesIn10Seconds) {
    FaceDetect fd = new FaceDetect();
    String FrameWithFaceFileName = "";
    IplImage frame;
    for (int i = maxFramesIn10Seconds - 1; i > 0; i--) {
      String stri = "" + i;
      if (i < 10) {
        stri = "00" + i;
      } else if (i < 100) {
View Full Code Here

  @Override
  protected List<ScreenRegion> getUnorderedMatches(ScreenRegion screenRegion) {
   
    BufferedImage image = screenRegion.capture();
    IplImage foregroundMask = VisionUtils.computeForegroundMaskOf(IplImage.createFrom(image));
    List<CvRect> blobs = VisionUtils.detectBlobs(foregroundMask);
   
    List<ScreenRegion> results = Lists.newArrayList();
    for (CvRect b : blobs){
      System.out.println(String.format("%d,%d,%d,%d",b.x(),b.y(),b.width(),b.height()));
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();

            while(detectionXmlFile==null || detectionXmlFile.isEmpty()) {
                chooseXmlDetectionFile();
            }
           
            int detectionCount = 0;
           
            CvSeq faces = null;

            while (canvasFrame.isVisible() && (frame = grabber.grab()) != null) {
                cvSmooth(frame, frame, CV_GAUSSIAN, 9, 9, 2, 2);
               
                detectionCount++;
                if (detectionCount > 5) {
                    detectionCount=0;
                    IplImage grayImage = null;
                    try {
                        grayImage = IplImage.create(frame.width(),
                                frame.height(), IPL_DEPTH_8U, 1);
                    } catch (NullPointerException e) {
                        System.out.println("Error: " + e);
View Full Code Here

    }

    public ImageIcon detectionExecute(String imgFileName, String cascadeFileName) {
        System.out.println(cascadeFileName);
        System.out.println(imgFileName);
        IplImage originalImage = cvLoadImage(imgFileName, 1);
        // We need a grayscale image in order to do the recognition, so we 
        // create a new image of the same size as the original one.
        IplImage grayImage = null;
        try {
            grayImage = IplImage.create(originalImage.width(),
                    originalImage.height(), IPL_DEPTH_8U, 1);
        } catch (NullPointerException e) {
            System.out.println("Error: " + e);
View Full Code Here

TOP

Related Classes of com.googlecode.javacv.cpp.opencv_core.IplImage

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.