OpenKinect-for-Processing icon indicating copy to clipboard operation
OpenKinect-for-Processing copied to clipboard

Get scaled down images to speed up processing

Open wassgha opened this issue 8 years ago • 5 comments

Hello,

Is there any way to specify the Kinect resolution for the RGB image on the Kinect v2? I am trying to process the image with OpenCV and it is taking too long (totally not adapted to live processing). I tried to resize the image before passing it to OpenCV (using img.resize) but I ended up with a weird striped image:

screen shot 2016-08-18 at 12 05 01 am

Thank you in advance!

wassgha avatar Aug 18 '16 04:08 wassgha

Hello wassgha, do you have part of the code that I could look at?

ThomasLengeling avatar Aug 18 '16 04:08 ThomasLengeling

To put you in context, I am trying to use OpenCV's calibration (using a checkerboard) on the video image from the Kinect v2 (I am trying to make a projector-kinect touch interface)

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

class PWindow extends PApplet {
  Kinect2 kinect2;
  ArrayList<PVector> cornerPoints;
  OpenCV opencv;
  PImage video;

  PWindow() {
    super();
    PApplet.runSketch(new String[] {this.getClass().getSimpleName()}, this);
  }

  void settings() {
    size(1024, 848);
  }

  void setup() {
    background(255);
    kinect2 = new Kinect2(this);
    kinect2.initVideo();
    kinect2.initDepth();
    kinect2.initIR();
    kinect2.initRegistered();
    // Start all data
    kinect2.initDevice();
  }

  void draw() {
    background(255);
    video = kinect2.getVideoImage();
    video.resize(kinect2.colorWidth/5, kinect2.colorHeight/5);
    image(video, 0, 0);
      opencv = new OpenCV(this, video);
      cornerPoints = opencv.findChessboardCorners(9,6);
      for(PVector p : cornerPoints){
        ellipse(p.x, p.y, 5, 5);
      }  
  }
}

wassgha avatar Aug 18 '16 05:08 wassgha

We experienced a similar issue during calibration - if you use kinect2.getRegisteredImage() instead of kinect2.getVideoImage() performance is considerably improved and the calibration is accurate. The registered image has the depth sensor's resolution with the RGB colors mapped to the depth "pixels".

bradenneufeld avatar Aug 18 '16 07:08 bradenneufeld

I get the same problem even with getRegisteredImage() :(

wassgha avatar Aug 27 '16 14:08 wassgha

I have the same issue

abdelwahed avatar Oct 17 '18 08:10 abdelwahed