1
votes

I have installed openni2.2, nite2.2 and kinect SDK 1.6 along with Simpleopenni library for processing. Everything working fine except infrared image - it is simply not there. That is really strange since at the same time I can clearly see the depth image (and depthimage logically need the infra camera and projector working to run). So I assume there is a problem with drivers or software? I would like to use kinect as infrared camera. Please help, below I attach my test code:

/* --------------------------------------------------------------------------
 * SimpleOpenNI IR Test
 * --------------------------------------------------------------------------
 * Processing Wrapper for the OpenNI/Kinect library
 * http://code.google.com/p/simple-openni
 * --------------------------------------------------------------------------
 * prog:  Max Rheiner / Interaction Design / zhdk / http://iad.zhdk.ch/
 * date:  02/16/2011 (m/d/y)
 * ----------------------------------------------------------------------------
 */

import SimpleOpenNI.*;


SimpleOpenNI  context;

void setup()
{
  context = new SimpleOpenNI(this);

  // enable depthMap generation 
  if(context.enableDepth() == false)
  {
     println("Can't open the depthMap, maybe the camera is not connected!"); 
     exit();
     return;
  }

  // enable ir generation
  if(context.enableIR() == false)
  {
     println("Can't open the depthMap, maybe the camera is not connected!"); 
     exit();
     return;
  }

  background(200,0,0);
  size(context.depthWidth() + context.irWidth() + 10, context.depthHeight()); 
}

void draw()
{
  // update the cam
  context.update();

  // draw depthImageMap
  image(context.depthImage(),0,0);

  // draw irImageMap
  image(context.irImage(),context.depthWidth() + 10,0);
}
4
image showing the error: i.imgur.com/jzdqbXN.jpg?1doku

4 Answers

2
votes

This does the job:

context.enableIR(1,1,1);
0
votes

I have the exact same issue. It's not a solution but the closest I can get to getting an infra-red image from the kinect is by getting the point cloud from the depth Image That soltuion is here

import SimpleOpenNI.*;

import processing.opengl.*;

SimpleOpenNI kinect;

void setup()
{

  size( 1024, 768, OPENGL);

  kinect = new SimpleOpenNI( this );

  kinect.enableDepth();

}

void draw()
{

  background( 0);

  kinect.update();
  image(kinect.depthImage(),0,0,160,120);//check depth image

  translate( width/2,  height/2, -1000);

  rotateX( radians(180));

  stroke(255);

  PVector[] depthPoints = kinect.depthMapRealWorld();

  //the program get stucked in the for loop it loops 307200 times and I don't have any points output

  for( int i = 0; i < depthPoints.length ; i+=4)//draw point for every 4th pixel
  {

    PVector currentPoint = depthPoints[i];
    if(i == 0) println(currentPoint);
    point(currentPoint.x,  currentPoint.y, currentPoint.z );
  }

}
0
votes

Are you able to capture the infrared stream, but you just can't see it?

Then the issue might be RANGE (which it should be in [0, 255]).

I had this issue in Python and C++; I solved it by dividing the array by the range (max-min) and then multiply all entries by 255.

0
votes

user3550091 is right! For reference here is my complete working code (Processing+OpenNI):

import SimpleOpenNI.*;
SimpleOpenNI  context;
void setup(){
  size(640 * 2 + 10, 480);
  context = new SimpleOpenNI(this);
  if(context.isInit() == false){
     println("fail"); 
     exit();
     return;
  }
  context.enableDepth();

  // enable ir generation
  //context.enableIR(); old line 
  context.enableIR(1,1,1); //new line

  background(200,0,0);
}

void draw(){
  context.update();
  image(context.depthImage(),context.depthWidth() + 10,0);

  image(context.irImage(),0,0);
}