错误'ImageGenerator'无法解析

时间:2016-01-08 07:12:31

标签: java opencv javacv openni

我正在尝试以下代码,但得到:

  

无法解析ImageGenerator

我已经导入了所需的JavaCV和OpenCV库。我需要导入更多库吗?我搜索过,但找不到了!

import java.awt.*;
import java.awt.image.*;
import java.io.*;
import java.nio.ByteBuffer;

import javax.naming.Context;

 enum Resolution {
      NORMAL, HIGH
    }


    public class KinectCapture 
    {
      private BufferedImage image = null;
      private int imWidth, imHeight;
      private int fps;

      private boolean isReleased = true;    
               // when Kinect context has been released

      // OpenNI
      private Context context;
      private ImageGenerator imageGen; **Here I am getting the error.**

      public KinectCapture()
      {  this(Resolution.NORMAL);  }

          public KinectCapture(Resolution res)
      {  configOpenNI(res); }


      private void configOpenNI(Resolution res)
      // create context and image generator
      {
        try {
          context = new Context();

          // add the NITE Licence 
          License licence = new License("PrimeSense", "0KOIk2JeIBYClPWVnMoRKn5cdY4=");   // vendor, key
          context.addLicense(licence); 

          imageGen = ImageGenerator.create(context);

1 个答案:

答案 0 :(得分:0)

我无法在JavaDoc中找到ImageGenerator,所以我假设你要么有你学校给你的包或其他什么,那么你也必须导入它,或者你需要在某处创建Class ImageGenerator你的包裹。

编辑:经过一些研究,我发现了这个:https://github.com/OpenNI/OpenNI/blob/master/Wrappers/OpenNI.java/src/org/openni/ImageGenerator.java