The constructor "processing.Kinect2(RGBDepthTest2)" does not exist error

mmkmmk
edited April 2017 in Kinect

I am using the existing examples of KInect2 from OpenKinect_Processing library and trying to integrate it with my code.

// Daniel Shiffman
// All features test

// https://github.com/shiffman/OpenKinect-for-Processing
// http://shiffman.net/p5/kinect/

import org.openkinect.freenect.*;
import org.openkinect.freenect2.*;
import org.openkinect.processing.*;

class RGBDepthTest2{
  Kinect2 kinect2;

  RGBDepthTest2()
  {
  }

  void setup() {
    size(1024, 848, P2D);

    kinect2 = new Kinect2(this);
    kinect2.initVideo();
    kinect2.initDepth();
    kinect2.initIR();
    kinect2.initRegistered();
    // Start all data
    kinect2.initDevice();
  }


  void draw() {
    background(0);
    image(kinect2.getVideoImage(), 0, 0, kinect2.colorWidth*0.267, kinect2.colorHeight*0.267);
    image(kinect2.getDepthImage(), kinect2.depthWidth, 0);
    image(kinect2.getIrImage(), 0, kinect2.depthHeight);

    image(kinect2.getRegisteredImage(), kinect2.depthWidth, kinect2.depthHeight);
    fill(255);
    text("Framerate: " + (int)(frameRate), 10, 515);
  }
}  

I am trying to call this class from the main class by instating it, however I keeping on getting this error. The constructor "processing.Kinect2(RGBDepthTest2)" does not exist.

Please suggest a solution for the same.

Thanks in advance :)

Answers

  • This below is one way to start a sketch in Processing. Please check https://processing.org/reference/draw_.html to make sure you understand how draw works. Also check previous posts related to your topic: https://forum.processing.org/two/search?Search=kinect2

    Kf

          import org.openkinect.freenect.*;
          import org.openkinect.freenect2.*;
          import org.openkinect.processing.*;     
        
          Kinect2 kinect2;    
         
          void setup() {
            size(1024, 848, P2D);
         
            kinect2 = new Kinect2(this);
            kinect2.initVideo();
            kinect2.initDepth();
            kinect2.initIR();
            kinect2.initRegistered();
            // Start all data
            kinect2.initDevice();
          }
         
         
          void draw() {
            background(0);
            image(kinect2.getVideoImage(), 0, 0, kinect2.colorWidth*0.267, kinect2.colorHeight*0.267);
            image(kinect2.getDepthImage(), kinect2.depthWidth, 0);
            image(kinect2.getIrImage(), 0, kinect2.depthHeight);
         
            image(kinect2.getRegisteredImage(), kinect2.depthWidth, kinect2.depthHeight);
            fill(255);
            text("Framerate: " + (int)(frameRate), 10, 515);
          }
        
    
  • mmkmmk
    edited April 2017

    But this way I cannot call it from the main class considering I have multiple effects that need to be run.

  • edited April 2017

    processing.Kinect2(RGBDepthTest2)

    what exactly is this trying to do? what is processing here?

    looking at this based on usual standards we have

    processing - an instance of a thing of unknown type

    Kinect2 a class name, you're using it as a method on the processing instance

    RGBDepthTest2 another class name, you're passing it as an argument

    none of which makes a lot of sense.

  • In Java, keyword this is always of the datatype of the immediate class it is typed in. L-)

Sign In or Register to comment.