Making two windows in Processing

YukYuk
edited September 2015 in Questions about Code

Hey guys
Im trying to make two windows.
One for the Movie and one for the Capture using OpenCV
An error occurs in the PFrame class.
the error massage is below:

TAB 0,LN 16LN START OFF: 3,LN STOP OFF: 5,PROB: The function "add()" expects parameters like: "add(Component)" The function "add()" expects parameters like: "add(Component)" first 17
TAB 0,LN 17LN START OFF: 5,LN STOP OFF: 8,PROB: The function "init()" does not exist The function "init()" does not exist first 18
TAB 0,LN 18LN START OFF: 3,LN STOP OFF: 8,PROB: The method show() from the type Window is deprecated The method show() from the type Window is deprecated first 19

I don't have any idea why this error occurs.
and when i erase the add(s) and s.init() then a NULLPOINTEREXEPTION occurs in the s.image(s.movie,0,0) in the last line of main draw()
Is there anyone who knows how to solve it?
I'm using the latest version of processing

My code is below:

import gab.opencv.*;
import processing.video.*;
import java.awt.*;
import java.awt.Frame.*;


Capture video;
OpenCV opencv;
PImage img;
PFrame f;
secondApplet s;

public class PFrame extends Frame {
  public PFrame() {
    setBounds(0, 0, 640, 480);
    s = new secondApplet();
    //add(s);
    //s.init();
    show();
  }
}
public class secondApplet extends PApplet {
  public Movie movie;
  public void setup() {
    size(640, 480);
  }
  public void movieEvent(Movie m) {
    m.read();
  }
  public void draw() {
  }
}

void setup() {
  frameRate(30);
  size(640, 480);
  f=new PFrame();
  s.movie = new Movie(this, "MVI_1114.mov");
  s.movie.loop();
  video = new Capture(this, 640/2, 480/2);
  opencv = new OpenCV(this, 640/2, 480/2);
  opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);  

  video.start();
}

void draw() {

  scale(2);
  opencv.loadImage(video);

  //image(video, 0, 0 );

  noFill();
  stroke(0, 255, 0);
  strokeWeight(3);
  Rectangle[] faces = opencv.detect();
  //println(faces.length);

  for (int i = 0; i < faces.length; i++) {
    //println(faces[i].x + "," + faces[i].y);
    img = video.get(faces[i].x-30, faces[i].y-30, faces[i].width+100, faces[i].height+100);
    image(img, 0, 0, 320, 240);
  }
  //int x=0;
  //x=x+1;
  //saveFrame("data/######.jpg");
  s.image(s.movie, 0, 0);
}

void captureEvent(Capture c) {
  c.read();
}

void mousePressed() {
  video.stop();
}

Answers

Sign In or Register to comment.