프로그램 사용/kinect2025. 5. 22. 23:51

intel 7세대 노트북에서

별 옵션 주지 않고 cmake 하니까 아래와 같이 설정이 된다.

2세대 에서는 OpenCL yes, VAAPI no 였다.

-- Using in-tree freenect2 target
-- Feature list:
--   CUDA    no
--   CXX11    disabled
--   Examples    yes
--   OpenCL    no
--   OpenGL    yes
--   OpenNI2    yes
--   TegraJPEG    no
--   Threading    tinythread
--   TurboJPEG    yes
--   VAAPI    yes
--   VideoToolbox    no (Apple only)
--   streamer_recorder    disabled
-- Configuring done (0.1s)
-- Generating done (0.0s)

 

그래서 떴던거 같아서 다시 실행해보니 ir 과 depth는 정상이고 rgb의 폭이 이상해서

3d로 재구성된 녀석도 이상하게 나온다.

$ ./Protonect 
Version: 0.2.0
Environment variables: LOGFILE=<protonect.log>
Usage: ./Protonect [-gpu=<id>] [gl | cl | clkde | cuda | cudakde | cpu] [<device serial>]
        [-noviewer] [-norgb | -nodepth] [-help] [-version]
        [-frames <number of frames to process>]
To pause and unpause: pkill -USR1 Protonect
[Info] [Freenect2Impl] enumerating devices...
[Info] [Freenect2Impl] 9 usb devices connected
[Info] [Freenect2Impl] found valid Kinect v2 @2:11 with serial 501441643042
[Info] [Freenect2Impl] found 1 devices
libva info: VA-API version 1.20.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_20
libva info: va_openDriver() returns 0
[Info] [VaapiRgbPacketProcessorImpl] driver: Intel iHD driver for Intel(R) Gen Graphics - 24.1.0 ()
[Info] [Freenect2DeviceImpl] opening...
[Info] [Freenect2DeviceImpl] transfer pool sizes rgb: 20*16384 ir: 60*8*33792
[Info] [Freenect2DeviceImpl] opened
[Info] [Freenect2DeviceImpl] starting...
[Debug] [Freenect2DeviceImpl] status 0x090000: 9729
[Debug] [Freenect2DeviceImpl] status 0x090000: 9731
[Info] [Freenect2DeviceImpl] submitting rgb transfers...
[Info] [Freenect2DeviceImpl] submitting depth transfers...
[Info] [Freenect2DeviceImpl] started

 

그래서 VAAPI를 끄고 빌드해서 실행해보니

$ cmake .. -DENABLE_VAAPI=OFF
-- Using in-tree freenect2 target
-- Feature list:
--   CUDA    no
--   CXX11    disabled
--   Examples    yes
--   OpenCL    no
--   OpenGL    yes
--   OpenNI2    yes
--   TegraJPEG    no
--   Threading    tinythread
--   TurboJPEG    yes
--   VAAPI    disabled
--   VideoToolbox    no (Apple only)
--   streamer_recorder    disabled
-- Configuring done (0.1s)
-- Generating done (0.0s)

 

영상은 정상적으로 보이는데, transfer pool size가 달라지진 않네.. 머지?

$ ./Protonect 
Version: 0.2.0
Environment variables: LOGFILE=<protonect.log>
Usage: ./Protonect [-gpu=<id>] [gl | cl | clkde | cuda | cudakde | cpu] [<device serial>]
        [-noviewer] [-norgb | -nodepth] [-help] [-version]
        [-frames <number of frames to process>]
To pause and unpause: pkill -USR1 Protonect
[Info] [Freenect2Impl] enumerating devices...
[Info] [Freenect2Impl] 9 usb devices connected
[Info] [Freenect2Impl] found valid Kinect v2 @2:11 with serial 501441643042
[Info] [Freenect2Impl] found 1 devices
[Info] [Freenect2DeviceImpl] opening...
[Info] [Freenect2DeviceImpl] transfer pool sizes rgb: 20*16384 ir: 60*8*33792
[Info] [Freenect2DeviceImpl] opened
[Info] [Freenect2DeviceImpl] starting...
[Debug] [Freenect2DeviceImpl] status 0x090000: 9729
[Debug] [Freenect2DeviceImpl] status 0x090000: 9731
[Info] [Freenect2DeviceImpl] submitting rgb transfers...
[Info] [Freenect2DeviceImpl] submitting depth transfers...
[Debug] [DepthPacketStreamParser] not all subsequences received 0
[Info] [Freenect2DeviceImpl] started

 

 

Posted by 구차니

링크와는 다르게 내용상으로는 preview 시절(?) api 같은데

colorframe -> depth

public void MapColorFrameToDepthSpace (
         Array<UInt16>[] depthFrameData,
         out Array<DepthSpacePoint>[] depthSpacePoints
)

[링크 : https://learn.microsoft.com/en-us/previous-versions/windows/kinect/dn791296(v=ieb.10)?redirectedfrom=MSDN]

 

depth -> colorframe 가 존재한다.

public void MapDepthFrameToCameraSpace (
         Array<UInt16>[] depthFrameData,
         out Array<CameraSpacePoint>[] cameraSpacePoints
)

[링크 : https://learn.microsoft.com/en-us/previous-versions/windows/kinect/dn791303(v=ieb.10)?redirectedfrom=MSDN]

    [링크 : https://learn.microsoft.com/en-us/previous-versions/windows/kinect/dn758445(v=ieb.10)?redirectedfrom=MSDN]

 

v1.8에도 존재 (링크 사라짐)

[링크 : https://learn.microsoft.com/en-us/previous-versions/windows/kinect-1.8/jj663707(v=ieb.10)]

   [링크 : https://stackoverflow.com/questions/17012585/how-do-you-map-kinects-depth-data-to-its-rgb-color]

 

그래서 함수 명으로 검색했는데 좀 이름이 다르다.

HRESULT MapDepthFrameToColorFrame(
         NUI_IMAGE_RESOLUTION eDepthResolution,
         DWORD cDepthPixels,
         NUI_DEPTH_IMAGE_PIXEL *pDepthPixels,
         NUI_IMAGE_TYPE eColorType,
         NUI_IMAGE_RESOLUTION eColorResolution,
         DWORD cColorPoints,
         NUI_COLOR_IMAGE_POINT *pColorPoints
)

[링크 : https://learn.microsoft.com/en-us/previous-versions/windows/kinect-1.8/jj883691(v=ieb.10)]

 

HRESULT MapColorFrameToDepthFrame(
         NUI_IMAGE_TYPE eColorType,
         NUI_IMAGE_RESOLUTION eColorResolution,
         NUI_IMAGE_RESOLUTION eDepthResolution,
         DWORD cDepthPixels,
         NUI_DEPTH_IMAGE_PIXEL *pDepthPixels,
         DWORD cDepthPoints,
         NUI_DEPTH_IMAGE_POINT *pDepthPoints
)

[링크 : https://learn.microsoft.com/en-us/previous-versions/windows/kinect-1.8/jj883688(v=ieb.10)]

'프로그램 사용 > kinect' 카테고리의 다른 글

libfreenect2 VAAPI 버그?  (2) 2025.05.22
kinect v2 잘못된 깊이 맵 맵핑  (0) 2025.05.06
libfreenect2 rgb / depth 매핑 소스코드 분석  (0) 2025.05.05
kinect rgb - depth mapping  (0) 2025.05.01
kinect 깊이 정밀도  (0) 2025.04.15
Posted by 구차니

심심해서(?) 실행해봤는데 어라...

아무래도 depth 카메라와 rgb 카메라의 거리가 떨어져있어서 시차로 인한 오류가 발생을 하는지

특수한 각도에서는 다음과 같이 이상하게 맵핑이 된다.

(노트북 뒤로 몽둥이를 들고 있는데 3d로 합성된 쪽에서는 투명하게 뚫는 것 처럼 보임)

libfreenect2의 한계인가.. 아니면 윈도우 버전도 이럴려나?

'프로그램 사용 > kinect' 카테고리의 다른 글

libfreenect2 VAAPI 버그?  (2) 2025.05.22
kinect 1.x, 2.x color <-> depth mapping  (0) 2025.05.07
libfreenect2 rgb / depth 매핑 소스코드 분석  (0) 2025.05.05
kinect rgb - depth mapping  (0) 2025.05.01
kinect 깊이 정밀도  (0) 2025.04.15
Posted by 구차니

libfreenect2 내의 매핑 코드가 이해가 안되서 다른걸 찾아보는데 여전히 이해가 안된다..

코드 상으로는 크게 차이가 없는 것 같지만, color map에 depth map을 합성하는게 더 자연스러워 보이는 것 같다.

The following snippet shows us how to locate the color bytes from the ColorSpacePoint:

// we need a starting point, let's pick 0 for now
int index = 0;
 
ushort depth = _depthData[index];
ColorSpacePoint point = _colorSpacePoints[index];
 
// round down to the nearest pixel
int colorX = (int)Math.Floor(point.X + 0.5);
int colorY = (int)Math.Floor(point.Y + 0.5);
 
// make sure the pixel is part of the image
if ((colorX >= 0 && (colorX < colorWidth) && (colorY >= 0) && (colorY < colorHeight))
{
 
    int colorImageIndex = ((colorWidth * colorY) + colorX) * bytesPerPixel;
 
    byte b = _colorFrameData[colorImageIndex];
    byte g = _colorFrameData[colorImageIndex + 1];
    byte r = _colorFrameData[colorImageIndex + 2];
    byte a = _colorFrameData[colorImageIndex + 3];
 
}

 

그나저나 depth sensor가 더 FOV가 넓어서 왜곡되다보니

depth map에 맵핑했을 경우에는 lens 왜곡 보정을 한 것 같기도 한데

코드 상에는 별 내용이 없는 것 같기도 하고.. 멀 한거지?

// clear the pixels before we color them
Array.Clear(_pixels, 0, _pixels.Length);
 
for (int depthIndex = 0; depthIndex < _depthData.Length; ++depthIndex)
{
    ColorSpacePoint point = _colorSpacePoints[depthIndex];
 
    int colorX = (int)Math.Floor(point.X + 0.5);
    int colorY = (int)Math.Floor(point.Y + 0.5);
    if ((colorX >= 0) && (colorX < colorWidth) && (colorY >= 0) && (colorY < colorHeight))
    {
        int colorImageIndex = ((colorWidth * colorY) + colorX) * bytesPerPixel;
        int depthPixel = depthIndex * bytesPerPixel;
 
        _pixels[depthPixel] = _colorData[colorImageIndex];
        _pixels[depthPixel + 1] = _colorData[colorImageIndex + 1];
        _pixels[depthPixel + 2] = _colorData[colorImageIndex + 2];
        _pixels[depthPixel + 3] = 255;
    }
}

[링크 : https://www.bryancook.net/2014/03/mapping-between-kinect-color-and-depth.html]

    [링크 : https://stackoverflow.com/questions/29479746/kinect-v2-color-depth-mapping-using-c-sharp]

[링크 : https://kr.mathworks.com/matlabcentral/answers/268152-mapping-rgb-and-depth-kinect-v2]

[링크 : https://learn.microsoft.com/en-us/previous-versions/windows/kinect/dn758445(v=ieb.10)?redirectedfrom=MSDN]

    [링크 : https://tommyhsm.tistory.com/124]

 

libfreenct의 Protonect 실행하는 부분에서, rgb와 depth를 어떻게 매핑하는지 궁금해서 찾아보는데 크게 자료가 있진 않다.

/// [registration setup]
  libfreenect2::Registration* registration = new libfreenect2::Registration(dev->getIrCameraParams(), dev->getColorCameraParams());
  libfreenect2::Frame undistorted(512, 424, 4), registered(512, 424, 4);

/// [loop start]
  while(!protonect_shutdown && (framemax == (size_t)-1 || framecount < framemax))
  {
    if (!listener.waitForNewFrame(frames, 10*1000)) // 10 sconds
    {
      std::cout << "timeout!" << std::endl;
      return -1;
    }
    libfreenect2::Frame *rgb = frames[libfreenect2::Frame::Color];
    libfreenect2::Frame *ir = frames[libfreenect2::Frame::Ir];
    libfreenect2::Frame *depth = frames[libfreenect2::Frame::Depth];
/// [loop start]

    if (enable_rgb && enable_depth)
    {
/// [registration]
      registration->apply(rgb, depth, &undistorted, &registered);
/// [registration]
    }

    framecount++;
    if (!viewer_enabled)
    {
      if (framecount % 100 == 0)
        std::cout << "The viewer is turned off. Received " << framecount << " frames. Ctrl-C to stop." << std::endl;
      listener.release(frames);
      continue;
    }

#ifdef EXAMPLES_WITH_OPENGL_SUPPORT
    if (enable_rgb)
    {
      viewer.addFrame("RGB", rgb);
    }
    if (enable_depth)
    {
      viewer.addFrame("ir", ir);
      viewer.addFrame("depth", depth);
    }
    if (enable_rgb && enable_depth)
    {
      viewer.addFrame("registered", &registered);
    }

    protonect_shutdown = protonect_shutdown || viewer.render();
#endif

/// [loop end]
    listener.release(frames);
    /** libfreenect2::this_thread::sleep_for(libfreenect2::chrono::milliseconds(100)); */
  }
/// [loop end]

[링크 : https://github.com/OpenKinect/libfreenect2/blob/fd64c5d9b214df6f6a55b4419357e51083f15d93/examples/Protonect.cpp#L348]

void Registration::apply(const Frame *rgb, const Frame *depth, Frame *undistorted, Frame *registered, const bool enable_filter, Frame *bigdepth, int *color_depth_map) const
{
  impl_->apply(rgb, depth, undistorted, registered, enable_filter, bigdepth, color_depth_map);
}

void RegistrationImpl::apply(const Frame *rgb, const Frame *depth, Frame *undistorted, Frame *registered, const bool enable_filter, Frame *bigdepth, int *color_depth_map) const
{
  // Check if all frames are valid and have the correct size
  if (!rgb || !depth || !undistorted || !registered ||
      rgb->width != 1920 || rgb->height != 1080 || rgb->bytes_per_pixel != 4 ||
      depth->width != 512 || depth->height != 424 || depth->bytes_per_pixel != 4 ||
      undistorted->width != 512 || undistorted->height != 424 || undistorted->bytes_per_pixel != 4 ||
      registered->width != 512 || registered->height != 424 || registered->bytes_per_pixel != 4)
    return;

  const float *depth_data = (float*)depth->data;
  const unsigned int *rgb_data = (unsigned int*)rgb->data;
  float *undistorted_data = (float*)undistorted->data;
  unsigned int *registered_data = (unsigned int*)registered->data;
  const int *map_dist = distort_map;
  const float *map_x = depth_to_color_map_x;
  const int *map_yi = depth_to_color_map_yi;

  const int size_depth = 512 * 424;
  const int size_color = 1920 * 1080;
  const float color_cx = color.cx + 0.5f; // 0.5f added for later rounding

  // size of filter map with a border of filter_height_half on top and bottom so that no check for borders is needed.
  // since the color image is wide angle no border to the sides is needed.
  const int size_filter_map = size_color + 1920 * filter_height_half * 2;
  // offset to the important data
  const int offset_filter_map = 1920 * filter_height_half;

  // map for storing the min z values used for each color pixel
  float *filter_map = NULL;
  // pointer to the beginning of the important data
  float *p_filter_map = NULL;

  // map for storing the color offset for each depth pixel
  int *depth_to_c_off = color_depth_map ? color_depth_map : new int[size_depth];
  int *map_c_off = depth_to_c_off;

  // initializing the depth_map with values outside of the Kinect2 range
  if(enable_filter){
    filter_map = bigdepth ? (float*)bigdepth->data : new float[size_filter_map];
    p_filter_map = filter_map + offset_filter_map;

    for(float *it = filter_map, *end = filter_map + size_filter_map; it != end; ++it){
      *it = std::numeric_limits<float>::infinity();
    }
  }

  /* Fix depth distortion, and compute pixel to use from 'rgb' based on depth measurement,
   * stored as x/y offset in the rgb data.
   */

  // iterating over all pixels from undistorted depth and registered color image
  // the four maps have the same structure as the images, so their pointers are increased each iteration as well
  for(int i = 0; i < size_depth; ++i, ++undistorted_data, ++map_dist, ++map_x, ++map_yi, ++map_c_off){
    // getting index of distorted depth pixel
    const int index = *map_dist;

    // check if distorted depth pixel is outside of the depth image
    if(index < 0){
      *map_c_off = -1;
      *undistorted_data = 0;
      continue;
    }

    // getting depth value for current pixel
    const float z = depth_data[index];
    *undistorted_data = z;

    // checking for invalid depth value
    if(z <= 0.0f){
      *map_c_off = -1;
      continue;
    }

    // calculating x offset for rgb image based on depth value
    const float rx = (*map_x + (color.shift_m / z)) * color.fx + color_cx;
    const int cx = rx; // same as round for positive numbers (0.5f was already added to color_cx)
    // getting y offset for depth image
    const int cy = *map_yi;
    // combining offsets
    const int c_off = cx + cy * 1920;

    // check if c_off is outside of rgb image
    // checking rx/cx is not needed because the color image is much wider then the depth image
    if(c_off < 0 || c_off >= size_color){
      *map_c_off = -1;
      continue;
    }

    // saving the offset for later
    *map_c_off = c_off;

    if(enable_filter){
      // setting a window around the filter map pixel corresponding to the color pixel with the current z value
      int yi = (cy - filter_height_half) * 1920 + cx - filter_width_half; // index of first pixel to set
      for(int r = -filter_height_half; r <= filter_height_half; ++r, yi += 1920) // index increased by a full row each iteration
      {
        float *it = p_filter_map + yi;
        for(int c = -filter_width_half; c <= filter_width_half; ++c, ++it)
        {
          // only set if the current z is smaller
          if(z < *it)
            *it = z;
        }
      }
    }
  }

  /* Construct 'registered' image. */

  // reseting the pointers to the beginning
  map_c_off = depth_to_c_off;
  undistorted_data = (float*)undistorted->data;

  /* Filter drops duplicate pixels due to aspect of two cameras. */
  if(enable_filter){
    // run through all registered color pixels and set them based on filter results
    for(int i = 0; i < size_depth; ++i, ++map_c_off, ++undistorted_data, ++registered_data){
      const int c_off = *map_c_off;

      // check if offset is out of image
      if(c_off < 0){
        *registered_data = 0;
        continue;
      }
f
      const float min_z = p_filter_map[c_off];
      const float z = *undistorted_data;

      // check for allowed depth noise
      *registered_data = (z - min_z) / z > filter_tolerance ? 0 : *(rgb_data + c_off);
    }

    if (!bigdepth) delete[] filter_map;
  }
  else
  {
    // run through all registered color pixels and set them based on c_off
    for(int i = 0; i < size_depth; ++i, ++map_c_off, ++registered_data){
      const int c_off = *map_c_off;

      // check if offset is out of image
      *registered_data = c_off < 0 ? 0 : *(rgb_data + c_off);
    }
  }
  if (!color_depth_map) delete[] depth_to_c_off;
}

[링크 : https://github.com/OpenKinect/libfreenect2/blob/fd64c5d9b214df6f6a55b4419357e51083f15d93/src/registration.cpp#L123]

'프로그램 사용 > kinect' 카테고리의 다른 글

kinect 1.x, 2.x color <-> depth mapping  (0) 2025.05.07
kinect v2 잘못된 깊이 맵 맵핑  (0) 2025.05.06
kinect rgb - depth mapping  (0) 2025.05.01
kinect 깊이 정밀도  (0) 2025.04.15
libfreenect2 on 2760p 성공  (0) 2024.08.18
Posted by 구차니

보기에는 단순하게 변형하고 잘라서 깊이정보를 주는것 같은데.. 맞나?

[링크 : https://tommyhsm.tistory.com/124]

[링크 : https://www.researchgate.net/publication/340527659_Color_and_depth_mapping_of_Kinect_v2]

[링크 : https://m.blog.naver.com/sense_sciencefiction/221967976514]

'프로그램 사용 > kinect' 카테고리의 다른 글

kinect v2 잘못된 깊이 맵 맵핑  (0) 2025.05.06
libfreenect2 rgb / depth 매핑 소스코드 분석  (0) 2025.05.05
kinect 깊이 정밀도  (0) 2025.04.15
libfreenect2 on 2760p 성공  (0) 2024.08.18
libfreenect2 성공  (0) 2024.07.17
Posted by 구차니
프로그램 사용/kinect2025. 4. 15. 14:55

 

깊이가 선형적으로 나오는 게 아닌건가? 나중에 확인을 해봐야겠다.

 

50cm 에서는 1.5mm 정밀도고 5m 에서는 5cm라..

Depth resolution: ~ 1.5 mm at 50 cm. About 5 cm at 5 m.

[링크 : https://stackoverflow.com/questions/7696436/precision-of-the-kinect-depth-camera]

[링크 : https://pmc.ncbi.nlm.nih.gov/articles/PMC9002889/]

'프로그램 사용 > kinect' 카테고리의 다른 글

libfreenect2 rgb / depth 매핑 소스코드 분석  (0) 2025.05.05
kinect rgb - depth mapping  (0) 2025.05.01
libfreenect2 on 2760p 성공  (0) 2024.08.18
libfreenect2 성공  (0) 2024.07.17
libfreenect2 실행 성공..  (0) 2024.07.15
Posted by 구차니
프로그램 사용/kinect2024. 8. 18. 23:39

오늘 우분트 24.04 설치하려고 쑈하다가

bios 설정에서 Express Card Link Speed를 발견

어...라.. Gen1과 Gen2.. 설마...

 

후다닥 다시 빌드

$ git clone https://github.com/OpenKinect/libfreenect2.git
$ cd libfreenect2/
$ mkdir build
$ cd build/
$ cmake .. -DENABLE_CUDA=OFF
$ make -j4
$ cd bin
$ sudo ./Protonect

 

실행... 성공!

'프로그램 사용 > kinect' 카테고리의 다른 글

kinect rgb - depth mapping  (0) 2025.05.01
kinect 깊이 정밀도  (0) 2025.04.15
libfreenect2 성공  (0) 2024.07.17
libfreenect2 실행 성공..  (0) 2024.07.15
libfreenect2 실행 실패  (0) 2024.07.14
Posted by 구차니
프로그램 사용/kinect2024. 7. 17. 23:55

아.. 역시 컴퓨터를 바꾸면 잘되는구나.. (어?)

 

심심해서 키넥트 본체는 연결안하고 허브만 연결했더니 당연하게(?) 허브만 뜬다.

 

파란 부분은 키넥트 본체를 꼽아야만 뜨는 부분

$ sudo dmesg -w
[ 1780.341670] usb 4-4: new SuperSpeed USB device number 8 using xhci_hcd
[ 1781.804378] usb 3-4: new high-speed USB device number 7 using xhci_hcd
[ 1781.954783] usb 3-4: New USB device found, idVendor=045e, idProduct=02d9, bcdDevice= 0.70
[ 1781.954794] usb 3-4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1781.954797] usb 3-4: Product: NuiSensor Adaptor      
[ 1781.954800] usb 3-4: Manufacturer: Microsoft Corporation  
[ 1781.955676] hub 3-4:1.0: USB hub found
[ 1781.955807] hub 3-4:1.0: 1 port detected
[ 1783.324924] usb 4-4: New USB device found, idVendor=045e, idProduct=02d9, bcdDevice= 0.73
[ 1783.324936] usb 4-4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1783.324940] usb 4-4: Product: NuiSensor Adaptor      
[ 1783.324942] usb 4-4: Manufacturer: Microsoft Corporation  
[ 1783.326192] hub 4-4:1.0: USB hub found
[ 1783.326380] hub 4-4:1.0: 1 port detected
[ 1783.808453] usb 4-4.1: new SuperSpeed USB device number 9 using xhci_hcd
[ 1783.829395] usb 4-4.1: New USB device found, idVendor=045e, idProduct=02d8, bcdDevice= 1.00
[ 1783.829404] usb 4-4.1: New USB device strings: Mfr=1, Product=2, SerialNumber=4
[ 1783.829408] usb 4-4.1: Product: Xbox NUI Sensor
[ 1783.829410] usb 4-4.1: Manufacturer: Microsoft
[ 1783.829413] usb 4-4.1: SerialNumber: 501441643042

 

빌드하고 실행하니

~/src/libfreenect2/build/bin$ ./Protonect 
Version: 0.2.0
Environment variables: LOGFILE=<protonect.log>
Usage: ./Protonect [-gpu=<id>] [gl | cl | clkde | cuda | cudakde | cpu] [<device serial>]
        [-noviewer] [-norgb | -nodepth] [-help] [-version]
        [-frames <number of frames to process>]
To pause and unpause: pkill -USR1 Protonect
[Info] [Freenect2Impl] enumerating devices...
[Info] [Freenect2Impl] 10 usb devices connected
[Info] [Freenect2Impl] found valid Kinect v2 @4:5 with serial 501441643042
[Info] [Freenect2Impl] found 1 devices
libva info: VA-API version 1.14.0
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[Error] [VaapiRgbPacketProcessorImpl] vaInitialize(display, &major_ver, &minor_ver): unknown libva error
[Info] [Freenect2DeviceImpl] opening...
[Info] [Freenect2DeviceImpl] transfer pool sizes rgb: 20*16384 ir: 60*8*33792
[Info] [Freenect2DeviceImpl] opened
[Info] [Freenect2DeviceImpl] starting...
[Debug] [Freenect2DeviceImpl] status 0x090000: 9729
[Debug] [Freenect2DeviceImpl] status 0x090000: 9731
[Info] [Freenect2DeviceImpl] submitting rgb transfers...
[Info] [Freenect2DeviceImpl] submitting depth transfers...
[Debug] [DepthPacketStreamParser] not all subsequences received 0
[Info] [Freenect2DeviceImpl] started
device serial: 501441643042
device firmware: 4.0.3911.0
[Debug] [DepthPacketStreamParser] not all subsequences received 768
[Debug] [DepthPacketStreamParser] skipping depth packet
[Debug] [DepthPacketStreamParser] skipping depth packet
[Debug] [DepthPacketStreamParser] skipping depth packet
[Debug] [DepthPacketStreamParser] skipping depth packet
[Debug] [DepthPacketStreamParser] skipping depth packet
[Debug] [DepthPacketStreamParser] skipping depth packet
[Info] [DepthPacketStreamParser] 6 packets were lost
[Info] [OpenGLDepthPacketProcessor] avg. time: 16.9263ms -> ~59.0797Hz
[Info] [TurboJpegRgbPacketProcessor] avg. time: 15.0939ms -> ~66.2519Hz
[Info] [OpenGLDepthPacketProcessor] avg. time: 14.96ms -> ~66.8449Hz
[Info] [TurboJpegRgbPacketProcessor] avg. time: 15.5262ms -> ~64.4071Hz
[Info] [OpenGLDepthPacketProcessor] avg. time: 14.8158ms -> ~67.4954Hz
[Info] [TurboJpegRgbPacketProcessor] avg. time: 15.8073ms -> ~63.2617Hz
[Info] [OpenGLDepthPacketProcessor] avg. time: 14.3364ms -> ~69.7524Hz
[Info] [TurboJpegRgbPacketProcessor] avg. time: 16.633ms -> ~60.1215Hz

 

잘나온다. 저번에 10세대에서는 카메라 영상(좌하단)과 3d로 재구성된 영상(우상단)이 찌그러지던데, 무슨 차이이려나?

 

 

'프로그램 사용 > kinect' 카테고리의 다른 글

kinect 깊이 정밀도  (0) 2025.04.15
libfreenect2 on 2760p 성공  (0) 2024.08.18
libfreenect2 실행 성공..  (0) 2024.07.15
libfreenect2 실행 실패  (0) 2024.07.14
libfreenect2 CUDA 끄고 빌드 성공  (0) 2024.07.13
Posted by 구차니
프로그램 사용/kinect2024. 7. 15. 21:57

10세대 노트북에서 해서 그런가 잘 된다.

2세대에는 native USB3.0이 없어서 그런가?

 

[  102.223422] usb 1-3: new high-speed USB device number 5 using xhci_hcd
[  102.375595] usb 1-3: New USB device found, idVendor=045e, idProduct=02d9, bcdDevice= 0.70
[  102.375609] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  102.375615] usb 1-3: Product: NuiSensor Adaptor      
[  102.375619] usb 1-3: Manufacturer: Microsoft Corporation  
[  102.377490] hub 1-3:1.0: USB hub found
[  102.377643] hub 1-3:1.0: 1 port detected
[  102.832793] usb 2-3: new SuperSpeed USB device number 3 using xhci_hcd
[  105.820384] usb 2-3: New USB device found, idVendor=045e, idProduct=02d9, bcdDevice= 0.73
[  105.820400] usb 2-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  105.820406] usb 2-3: Product: NuiSensor Adaptor      
[  105.820411] usb 2-3: Manufacturer: Microsoft Corporation  
[  105.825068] hub 2-3:1.0: USB hub found
[  105.825375] hub 2-3:1.0: 1 port detected
[  106.307431] usb 2-3.1: new SuperSpeed USB device number 4 using xhci_hcd
[  106.328374] usb 2-3.1: New USB device found, idVendor=045e, idProduct=02d8, bcdDevice= 1.00
[  106.328380] usb 2-3.1: New USB device strings: Mfr=1, Product=2, SerialNumber=4
[  106.328381] usb 2-3.1: Product: Xbox NUI Sensor
[  106.328383] usb 2-3.1: Manufacturer: Microsoft
[  106.328384] usb 2-3.1: SerialNumber: 501441643042
[  106.379651] usbcore: registered new interface driver snd-usb-audio
[  120.739532] usb 2-3.1: reset SuperSpeed USB device number 4 using xhci_hcd
[  163.891946] warning: `ThreadPoolForeg' uses wireless extensions which will stop working for Wi-Fi 7 hardware; use nl80211
[  188.498922] usb 1-3: USB disconnect, device number 5
[  188.581688] usb 2-3: USB disconnect, device number 3
[  188.581693] usb 2-3.1: USB disconnect, device number 4

 

되니 좋긴한데.. 되서 나쁘네.. 컴퓨터 바꾸어야 한다는 말이잖아.. ㅠㅠ

libfreenect2/build/bin$ ./Protonect 
Version: 0.2.0
Environment variables: LOGFILE=<protonect.log>
Usage: ./Protonect [-gpu=<id>] [gl | cl | clkde | cuda | cudakde | cpu] [<device serial>]
        [-noviewer] [-norgb | -nodepth] [-help] [-version]
        [-frames <number of frames to process>]
To pause and unpause: pkill -USR1 Protonect
[Info] [Freenect2Impl] enumerating devices...
[Info] [Freenect2Impl] 8 usb devices connected
[Info] [Freenect2Impl] found valid Kinect v2 @2:4 with serial 501441643042
[Info] [Freenect2Impl] found 1 devices
libva info: VA-API version 1.14.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_14
libva info: va_openDriver() returns 0
[Info] [VaapiRgbPacketProcessorImpl] driver: Intel iHD driver for Intel(R) Gen Graphics - 22.3.1 ()
[Info] [Freenect2DeviceImpl] opening...
[Info] [Freenect2DeviceImpl] transfer pool sizes rgb: 20*16384 ir: 60*8*33792
[Info] [Freenect2DeviceImpl] opened
[Info] [Freenect2DeviceImpl] starting...
[Debug] [Freenect2DeviceImpl] status 0x090000: 9729
[Debug] [Freenect2DeviceImpl] status 0x090000: 9731
[Info] [Freenect2DeviceImpl] submitting rgb transfers...
[Info] [Freenect2DeviceImpl] submitting depth transfers...
[Debug] [DepthPacketStreamParser] not all subsequences received 0
[Info] [Freenect2DeviceImpl] started
device serial: 501441643042
device firmware: 4.0.3911.0
[Debug] [DepthPacketStreamParser] not all subsequences received 960
[Debug] [DepthPacketStreamParser] not all subsequences received 1007
[Info] [DepthPacketStreamParser] 1 packets were lost
[Debug] [DepthPacketStreamParser] not all subsequences received 1022
[Debug] [DepthPacketStreamParser] not all subsequences received 511
[Debug] [DepthPacketStreamParser] not all subsequences received 1019
[Info] [DepthPacketStreamParser] 3 packets were lost
[Debug] [DepthPacketStreamParser] not all subsequences received 1015
[Debug] [DepthPacketStreamParser] not all subsequences received 1015
[Debug] [DepthPacketStreamParser] not all subsequences received 1019
[Info] [DepthPacketStreamParser] 3 packets were lost
[Info] [OpenGLDepthPacketProcessor] avg. time: 7.41895ms -> ~134.79Hz
[Info] [VaapiRgbPacketProcessor] avg. time: 3.69809ms -> ~270.41Hz
[Debug] [DepthPacketStreamParser] not all subsequences received 1015
[Info] [DepthPacketStreamParser] 1 packets were lost
[Info] [OpenGLDepthPacketProcessor] avg. time: 7.03777ms -> ~142.091Hz
[Info] [VaapiRgbPacketProcessor] avg. time: 3.92516ms -> ~254.767Hz
[Debug] [DepthPacketStreamParser] not all subsequences received 1022
[Debug] [DepthPacketStreamParser] not all subsequences received 1019
[Debug] [DepthPacketStreamParser] not all subsequences received 1022
[Debug] [DepthPacketStreamParser] not all subsequences received 1022
[Debug] [DepthPacketStreamParser] not all subsequences received 991
[Debug] [DepthPacketStreamParser] not all subsequences received 1022
[Debug] [DepthPacketStreamParser] not all subsequences received 987
[Info] [DepthPacketStreamParser] 7 packets were lost
[Debug] [DepthPacketStreamParser] not all subsequences received 511
[Debug] [DepthPacketStreamParser] not all subsequences received 511
[Debug] [DepthPacketStreamParser] not all subsequences received 991
[Debug] [DepthPacketStreamParser] not all subsequences received 511
[Debug] [DepthPacketStreamParser] not all subsequences received 1022
[Debug] [DepthPacketStreamParser] not all subsequences received 1019
[Debug] [DepthPacketStreamParser] not all subsequences received 767
[Debug] [DepthPacketStreamParser] not all subsequences received 991
[Debug] [DepthPacketStreamParser] not all subsequences received 1019
[Info] [DepthPacketStreamParser] 9 packets were lost
[Debug] [DepthPacketStreamParser] not all subsequences received 1022
[Debug] [DepthPacketStreamParser] not all subsequences received 1022
[Debug] [DepthPacketStreamParser] not all subsequences received 971
[Debug] [DepthPacketStreamParser] not all subsequences received 511
[Debug] [DepthPacketStreamParser] not all subsequences received 511
[Debug] [DepthPacketStreamParser] not all subsequences received 1022
[Info] [VaapiRgbPacketProcessor] avg. time: 4.29916ms -> ~232.603Hz
[Debug] [DepthPacketStreamParser] not all subsequences received 1019
[Debug] [DepthPacketStreamParser] not all subsequences received 511
[Debug] [DepthPacketStreamParser] not all subsequences received 511
[Info] [DepthPacketStreamParser] 9 packets were lost
[Debug] [DepthPacketStreamParser] not all subsequences received 1022
[Debug] [DepthPacketStreamParser] not all subsequences received 1022
[Debug] [DepthPacketStreamParser] not all subsequences received 987
[Info] [OpenGLDepthPacketProcessor] avg. time: 7.66351ms -> ~130.489Hz
[Debug] [DepthPacketStreamParser] not all subsequences received 511
[Debug] [DepthPacketStreamParser] not all subsequences received 1022
[Debug] [DepthPacketStreamParser] not all subsequences received 1019
[Debug] [DepthPacketStreamParser] not all subsequences received 511
[Debug] [DepthPacketStreamParser] not all subsequences received 511
[Debug] [DepthPacketStreamParser] not all subsequences received 511
[Info] [DepthPacketStreamParser] 9 packets were lost
[Debug] [DepthPacketStreamParser] not all subsequences received 1022
[Debug] [DepthPacketStreamParser] not all subsequences received 1019
[Info] [DepthPacketStreamParser] 2 packets were lost
[Debug] [DepthPacketStreamParser] not all subsequences received 1022
[Debug] [DepthPacketStreamParser] not all subsequences received 1007
[Info] [VaapiRgbPacketProcessor] avg. time: 4.41688ms -> ~226.404Hz
[Info] [DepthPacketStreamParser] 2 packets were lost
[Debug] [DepthPacketStreamParser] not all subsequences received 1022
[Debug] [DepthPacketStreamParser] not all subsequences received 1019
[Info] [DepthPacketStreamParser] 2 packets were lost
[Debug] [DepthPacketStreamParser] not all subsequences received 1022
[Info] [OpenGLDepthPacketProcessor] avg. time: 6.63554ms -> ~150.704Hz
[Debug] [DepthPacketStreamParser] not all subsequences received 510
[Debug] [DepthPacketStreamParser] not all subsequences received 1022
[Debug] [DepthPacketStreamParser] not all subsequences received 1019
[Debug] [DepthPacketStreamParser] not all subsequences received 1015
[Info] [DepthPacketStreamParser] 5 packets were lost
[Debug] [DepthPacketStreamParser] not all subsequences received 1022
[Debug] [DepthPacketStreamParser] not all subsequences received 1022
[Info] [DepthPacketStreamParser] 2 packets were lost
[Info] [VaapiRgbPacketProcessor] avg. time: 4.01999ms -> ~248.757Hz
[Debug] [DepthPacketStreamParser] not all subsequences received 511
[Info] [DepthPacketStreamParser] 1 packets were lost
[Debug] [DepthPacketStreamParser] not all subsequences received 1022
[Debug] [DepthPacketStreamParser] not all subsequences received 511
[Debug] [DepthPacketStreamParser] not all subsequences received 1022
[Info] [OpenGLDepthPacketProcessor] avg. time: 6.68671ms -> ~149.55Hz
[Debug] [DepthPacketStreamParser] not all subsequences received 1022
[Debug] [DepthPacketStreamParser] not all subsequences received 1022
[Info] [DepthPacketStreamParser] 5 packets were lost
[Debug] [DepthPacketStreamParser] not all subsequences received 511
[Debug] [DepthPacketStreamParser] not all subsequences received 511
[Info] [DepthPacketStreamParser] 2 packets were lost
[Info] [VaapiRgbPacketProcessor] avg. time: 4.43949ms -> ~225.251Hz
[Info] [OpenGLDepthPacketProcessor] avg. time: 6.87763ms -> ~145.399Hz
[Info] [VaapiRgbPacketProcessor] avg. time: 4.5502ms -> ~219.771Hz
[Info] [OpenGLDepthPacketProcessor] avg. time: 6.86435ms -> ~145.68Hz
[Debug] [DepthPacketStreamParser] not all subsequences received 511
[Debug] [DepthPacketStreamParser] not all subsequences received 959
[Debug] [DepthPacketStreamParser] not all subsequences received 895
[Debug] [DepthPacketStreamParser] not all subsequences received 511
[Debug] [DepthPacketStreamParser] not all subsequences received 959
[Info] [DepthPacketStreamParser] 5 packets were lost
[Info] [VaapiRgbPacketProcessor] avg. time: 4.07819ms -> ~245.207Hz
[Info] [OpenGLDepthPacketProcessor] avg. time: 6.89874ms -> ~144.954Hz
[Info] [VaapiRgbPacketProcessor] avg. time: 4.5117ms -> ~221.646Hz
[Debug] [DepthPacketStreamParser] not all subsequences received 991
[Info] [DepthPacketStreamParser] 1 packets were lost
[Info] [OpenGLDepthPacketProcessor] avg. time: 7.00382ms -> ~142.779Hz
[Info] [VaapiRgbPacketProcessor] avg. time: 4.54288ms -> ~220.125Hz
[Info] [OpenGLDepthPacketProcessor] avg. time: 7.04759ms -> ~141.892Hz
[Info] [VaapiRgbPacketProcessor] avg. time: 4.4388ms -> ~225.286Hz
[Debug] [DepthPacketStreamParser] not all subsequences received 959
[Info] [DepthPacketStreamParser] 1 packets were lost
[Info] [Freenect2DeviceImpl] stopping...
[Info] [Freenect2DeviceImpl] canceling rgb transfers...
[Info] [OpenGLDepthPacketProcessor] avg. time: 7.02522ms -> ~142.344Hz
[Info] [Freenect2DeviceImpl] canceling depth transfers...
[Info] [Freenect2DeviceImpl] stopped
[Info] [Freenect2DeviceImpl] closing...
[Info] [Freenect2DeviceImpl] releasing usb interfaces...
[Info] [Freenect2DeviceImpl] deallocating usb transfer pools...
[Info] [Freenect2DeviceImpl] closing usb device...
[Info] [Freenect2DeviceImpl] closed
[Info] [Freenect2DeviceImpl] closing...
[Info] [Freenect2DeviceImpl] already closed, doing nothing

 

디버그 모드로 하니 몇 줄 더 나오긴 한데.. 별 차이가 없어 보인다

$ LIBUSB_DEBUG=3 ./Protonect 
Version: 0.2.0
Environment variables: LOGFILE=<protonect.log>
Usage: ./Protonect [-gpu=<id>] [gl | cl | clkde | cuda | cudakde | cpu] [<device serial>]
        [-noviewer] [-norgb | -nodepth] [-help] [-version]
        [-frames <number of frames to process>]
To pause and unpause: pkill -USR1 Protonect
libusb: warning [libusb_init] installing new context as implicit default
[Info] [Freenect2Impl] enumerating devices...
[Info] [Freenect2Impl] 8 usb devices connected
[Info] [Freenect2Impl] found valid Kinect v2 @2:6 with serial 501441643042
[Info] [Freenect2Impl] found 1 devices
libva info: VA-API version 1.14.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_14
libva info: va_openDriver() returns 0
[Info] [VaapiRgbPacketProcessorImpl] driver: Intel iHD driver for Intel(R) Gen Graphics - 22.3.1 ()
[Info] [Freenect2DeviceImpl] opening...
[Info] [Freenect2DeviceImpl] transfer pool sizes rgb: 20*16384 ir: 60*8*33792
[Info] [Freenect2DeviceImpl] opened
[Info] [Freenect2DeviceImpl] starting...
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
[Debug] [Freenect2DeviceImpl] status 0x090000: 1024
[Debug] [Freenect2DeviceImpl] status 0x090000: 9729
[Debug] [Freenect2DeviceImpl] status 0x090000: 9731
[Info] [Freenect2DeviceImpl] submitting rgb transfers...
[Info] [Freenect2DeviceImpl] submitting depth transfers...
[Debug] [DepthPacketStreamParser] not all subsequences received 0
[Info] [Freenect2DeviceImpl] started
device serial: 501441643042
device firmware: 4.0.3911.0
[Debug] [DepthPacketStreamParser] not all subsequences received 896
[Info] [OpenGLDepthPacketProcessor] avg. time: 7.5057ms -> ~133.232Hz
[Info] [VaapiRgbPacketProcessor] avg. time: 4.58964ms -> ~217.882Hz
[Debug] [DepthPacketStreamParser] not all subsequences received 511

 

$ lsusb -t -v
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 10000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub
    |__ Port 3: Dev 5, If 0, Class=Hub, Driver=hub/1p, 5000M
        ID 045e:02d9 Microsoft Corp. 
        |__ Port 1: Dev 6, If 0, Class=Vendor Specific Class, Driver=, 5000M
            ID 045e:02d8 Microsoft Corp. 
        |__ Port 1: Dev 6, If 1, Class=Vendor Specific Class, Driver=, 5000M
            ID 045e:02d8 Microsoft Corp. 
        |__ Port 1: Dev 6, If 2, Class=Audio, Driver=snd-usb-audio, 5000M
            ID 045e:02d8 Microsoft Corp. 
        |__ Port 1: Dev 6, If 3, Class=Audio, Driver=snd-usb-audio, 5000M
            ID 045e:02d8 Microsoft Corp. 
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    |__ Port 3: Dev 6, If 0, Class=Hub, Driver=hub/1p, 480M
        ID 045e:02d9 Microsoft Corp. 
    |__ Port 5: Dev 2, If 0, Class=Vendor Specific Class, Driver=, 12M
        ID 04e8:730b Samsung Electronics Co., Ltd 
    |__ Port 6: Dev 3, If 0, Class=Video, Driver=uvcvideo, 480M
        ID 2b7e:0134  
    |__ Port 6: Dev 3, If 1, Class=Video, Driver=uvcvideo, 480M
        ID 2b7e:0134  
    |__ Port 10: Dev 4, If 0, Class=Wireless, Driver=btusb, 12M
        ID 8087:0026 Intel Corp. AX201 Bluetooth
    |__ Port 10: Dev 4, If 1, Class=Wireless, Driver=btusb, 12M
        ID 8087:0026 Intel Corp. AX201 Bluetooth

 

 

+

2024.07.18

빌드 타임 추가 (노트북)

8쓰레드 4쓰레드 2쓰레드 1쓰레드
real 0m6.974s
user 0m27.675s
sys 0m2.416s
real 0m7.923s
user 0m19.886s
sys 0m1.687s
real 0m11.978s
user 0m19.263s
sys 0m1.688s
real 0m17.982s
user 0m16.453s
sys 0m1.503s

 

+

2024.07.20

빌드 타임 추가 (데스크 탑 / i7-3770)

8쓰레드 4쓰레드 2쓰레드 1쓰레드
real 0m4.899s
user 0m22.435s
sys 0m2.366s
real 0m5.263s
user 0m14.712s
sys 0m1.612s
real 0m8.456s
user 0m13.561s
sys 0m1.707s
real 0m15.343s
user 0m13.623s
sys 0m1.707s

 

 

'프로그램 사용 > kinect' 카테고리의 다른 글

libfreenect2 on 2760p 성공  (0) 2024.08.18
libfreenect2 성공  (0) 2024.07.17
libfreenect2 실행 실패  (0) 2024.07.14
libfreenect2 CUDA 끄고 빌드 성공  (0) 2024.07.13
kinect v2 / freenect 실패  (0) 2024.07.09
Posted by 구차니
프로그램 사용/kinect2024. 7. 14. 11:19

처음 실행하니 권한부족.. libusb가 권한이 필요한 녀석이었던가?

libfreenect2/build/bin$ ./Protonect 
Version: 0.2.0
Environment variables: LOGFILE=<protonect.log>
Usage: ./Protonect [-gpu=<id>] [gl | cl | clkde | cuda | cudakde | cpu] [<device serial>]
        [-noviewer] [-norgb | -nodepth] [-help] [-version]
        [-frames <number of frames to process>]
To pause and unpause: pkill -USR1 Protonect
[Info] [Freenect2Impl] enumerating devices...
[Info] [Freenect2Impl] 10 usb devices connected
[Error] [Freenect2Impl] failed to open Kinect v2: @4:3 LIBUSB_ERROR_ACCESS Access denied (insufficient permissions)
[Info] [Freenect2Impl] found 0 devices
no device connected!

 

짜잔~하고 먼가 나오길 기대했지만... 안된다 -_-

$ sudo ./Protonect 
Version: 0.2.0
Environment variables: LOGFILE=<protonect.log>
Usage: ./Protonect [-gpu=<id>] [gl | cl | clkde | cuda | cudakde | cpu] [<device serial>]
        [-noviewer] [-norgb | -nodepth] [-help] [-version]
        [-frames <number of frames to process>]
To pause and unpause: pkill -USR1 Protonect
[Info] [Freenect2Impl] enumerating devices...
[Info] [Freenect2Impl] 10 usb devices connected
[Info] [Freenect2Impl] found valid Kinect v2 @4:5 with serial 501441643042
[Info] [Freenect2Impl] found 1 devices
[Info] [Freenect2DeviceImpl] opening...
[Info] [Freenect2DeviceImpl] transfer pool sizes rgb: 20*16384 ir: 60*8*33792
[Info] [Freenect2DeviceImpl] opened
[Info] [Freenect2DeviceImpl] starting...
[Debug] [Freenect2DeviceImpl] status 0x090000: 9729
[Error] [protocol::UsbControl] failed to set ir interface state! LIBUSB_ERROR_OTHER Other error. Try debugging with environment variable: export LIBUSB_DEBUG=3 .
[Info] [Freenect2DeviceImpl] closing...
[Info] [Freenect2DeviceImpl] releasing usb interfaces...
[Info] [Freenect2DeviceImpl] deallocating usb transfer pools...
[Info] [Freenect2DeviceImpl] closing usb device...
[Info] [Freenect2DeviceImpl] closed

 

LIBUSB_DEBUG를 줘도 두 줄 추가 되는 것 외에는 별다른 에러 메시지가 없다.

# LIBUSB_DEBUG=3 ./Protonect 
Version: 0.2.0
Environment variables: LOGFILE=<protonect.log>
Usage: ./Protonect [-gpu=<id>] [gl | cl | clkde | cuda | cudakde | cpu] [<device serial>]
        [-noviewer] [-norgb | -nodepth] [-help] [-version]
        [-frames <number of frames to process>]
To pause and unpause: pkill -USR1 Protonect
libusb: warning [libusb_init] installing new context as implicit default
[Info] [Freenect2Impl] enumerating devices...
[Info] [Freenect2Impl] 10 usb devices connected
[Info] [Freenect2Impl] found valid Kinect v2 @4:7 with serial 501441643042
[Info] [Freenect2Impl] found 1 devices
[Info] [Freenect2DeviceImpl] opening...
[Info] [Freenect2DeviceImpl] transfer pool sizes rgb: 20*16384 ir: 60*8*33792
[Info] [Freenect2DeviceImpl] opened
[Info] [Freenect2DeviceImpl] starting...
libusb: error [udev_hotplug_event] ignoring udev action change
libusb: error [udev_hotplug_event] ignoring udev action change
[Debug] [Freenect2DeviceImpl] status 0x090000: 9731
libusb: error [op_set_interface] set interface failed, errno=28
[Error] [protocol::UsbControl] failed to set ir interface state! LIBUSB_ERROR_OTHER Other error. Try debugging with environment variable: export LIBUSB_DEBUG=3 .
[Info] [Freenect2DeviceImpl] closing...
[Info] [Freenect2DeviceImpl] releasing usb interfaces...
[Info] [Freenect2DeviceImpl] deallocating usb transfer pools...
[Info] [Freenect2DeviceImpl] closing usb device...
[Info] [Freenect2DeviceImpl] closed
libusb: warning [libusb_exit] device 4.7 still referenced
libusb: warning [libusb_exit] device 4.6 still referenced
libusb: warning [libusb_exit] device 4.1 still referenced

 

커널 메시지로는.... 엥? 왜 갑자기 대역폭 부족?

$ sudo dmesg -w
[  415.484074] usb 4-1.1: reset SuperSpeed USB device number 7 using xhci_hcd
[  415.595900] usb 4-1.1: Not enough bandwidth for new device state.
[  415.595907] usb 4-1.1: Not enough bandwidth for altsetting 1

 

라이브러리 홈페이지 가서 다시 보니 

make install 하고 udev rule을 복사한 뒤, 키넥트를 뽑았다 꽂으라고 한다.

Build (if you have run cd depends previously, cd .. back to the libfreenect2 root directory first.)
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/freenect2
make
make install
You need to specify cmake -Dfreenect2_DIR=$HOME/freenect2/lib/cmake/freenect2 for CMake based third-party application to find libfreenect2.
Set up udev rules for device access: sudo cp ../platform/linux/udev/90-kinect2.rules /etc/udev/rules.d/, then replug the Kinect.
Run the test program: ./bin/Protonect
Run OpenNI2 test (optional): sudo apt-get install openni2-utils && sudo make install-openni2 && NiViewer2. Environment variable LIBFREENECT2_PIPELINE can be set to cl, cuda, etc to specify the pipeline.

[링크 : https://github.com/OpenKinect/libfreenect2]

 

먼가 잔뜩 뜨긴 한데.. udev 쪽 먼가 실행하는 것 같진 않고..

[  517.098960] usb 3-1: new high-speed USB device number 5 using xhci_hcd
[  517.251097] usb 3-1: New USB device found, idVendor=045e, idProduct=02d9, bcdDevice= 0.70
[  517.251115] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  517.251122] usb 3-1: Product: NuiSensor Adaptor      
[  517.251127] usb 3-1: Manufacturer: Microsoft Corporation  
[  517.254367] hub 3-1:1.0: USB hub found
[  517.254752] hub 3-1:1.0: 1 port detected
[  517.704842] usb 4-1: new SuperSpeed USB device number 8 using xhci_hcd
[  520.690577] usb 4-1: New USB device found, idVendor=045e, idProduct=02d9, bcdDevice= 0.73
[  520.690597] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  520.690604] usb 4-1: Product: NuiSensor Adaptor      
[  520.690610] usb 4-1: Manufacturer: Microsoft Corporation  
[  520.694210] hub 4-1:1.0: USB hub found
[  520.694623] hub 4-1:1.0: 1 port detected
[  521.187545] usb 4-1.1: new SuperSpeed USB device number 9 using xhci_hcd
[  521.212947] usb 4-1.1: New USB device found, idVendor=045e, idProduct=02d8, bcdDevice= 1.00
[  521.212966] usb 4-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=4
[  521.212973] usb 4-1.1: Product: Xbox NUI Sensor
[  521.212977] usb 4-1.1: Manufacturer: Microsoft
[  521.212982] usb 4-1.1: SerialNumber: 501441643042

 

키넥트 관련은 MODE 주는 것 외에는 별다른게 없어 보인다.

src/libfreenect2/build/bin# cat ../../platform/linux/udev/90-kinect2.rules 
# this file belongs in /etc/udev/rules.d/
# ATTR{product}=="Kinect2"
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02c4", MODE="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02d8", MODE="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02d9", MODE="0666"

 

에러는 동일하게 대역폭 부족이 뜬다.

$ sudo ./Protonect 
Version: 0.2.0
Environment variables: LOGFILE=<protonect.log>
Usage: ./Protonect [-gpu=<id>] [gl | cl | clkde | cuda | cudakde | cpu] [<device serial>]
        [-noviewer] [-norgb | -nodepth] [-help] [-version]
        [-frames <number of frames to process>]
To pause and unpause: pkill -USR1 Protonect
[Info] [Freenect2Impl] enumerating devices...
[Info] [Freenect2Impl] 10 usb devices connected
[Info] [Freenect2Impl] found valid Kinect v2 @4:13 with serial 501441643042
[Info] [Freenect2Impl] found 1 devices
[Info] [Freenect2DeviceImpl] opening...
[Info] [Freenect2DeviceImpl] transfer pool sizes rgb: 20*16384 ir: 60*8*33792
[Info] [Freenect2DeviceImpl] opened
[Info] [Freenect2DeviceImpl] starting...
[Debug] [Freenect2DeviceImpl] status 0x090000: 9731
[Error] [protocol::UsbControl] failed to set ir interface state! LIBUSB_ERROR_OTHER Other error. Try debugging with environment variable: export LIBUSB_DEBUG=3 .
[Info] [Freenect2DeviceImpl] closing...
[Info] [Freenect2DeviceImpl] releasing usb interfaces...
[Info] [Freenect2DeviceImpl] deallocating usb transfer pools...
[Info] [Freenect2DeviceImpl] closing usb device...
[Info] [Freenect2DeviceImpl] closed

 

[  786.203660] usb 4-2.1: reset SuperSpeed USB device number 13 using xhci_hcd
[  786.318931] usb 4-2.1: Not enough bandwidth for new device state.
[  786.318939] usb 4-2.1: Not enough bandwidth for altsetting 1

 

혹시나 해서 USB2.0에 꽂아보니 아래와 같이 에러가 발생한다.

$ sudo ./Protonect 
Version: 0.2.0
Environment variables: LOGFILE=<protonect.log>
Usage: ./Protonect [-gpu=<id>] [gl | cl | clkde | cuda | cudakde | cpu] [<device serial>]
        [-noviewer] [-norgb | -nodepth] [-help] [-version]
        [-frames <number of frames to process>]
To pause and unpause: pkill -USR1 Protonect
[Info] [Freenect2Impl] enumerating devices...
[Info] [Freenect2Impl] 9 usb devices connected
[Info] [Freenect2Impl] found valid Kinect v2 @2:5 with serial 501441643042
[Info] [Freenect2Impl] found 1 devices
[Info] [Freenect2DeviceImpl] opening...
[Error] [protocol::UsbControl] failed to claim interface with IrInterfaceId(=1)! LIBUSB_ERROR_BUSY Resource busy. Try debugging with environment variable: export LIBUSB_DEBUG=3 .
[Info] [Freenect2DeviceImpl] closing...
[Info] [Freenect2DeviceImpl] deallocating usb transfer pools...
[Info] [Freenect2DeviceImpl] closing usb device...
[Info] [Freenect2DeviceImpl] closed
[Error] [Freenect2Impl] failed to open Kinect v2: @2:5
failure opening device!

 

dmesg 상에는 아래와 같이 BOS desciptor 가 없거나 너무 짧다는게 그건 또 머냐..

[  683.513603] usb 2-1.1.1: reset high-speed USB device number 5 using ehci-pci
[  683.634757] usb 2-1.1.1: unable to get BOS descriptor or descriptor too short

 

expresscard to USB3.0 을 써서 생기는 문제인가.. 아니면 빌드라던가 다른 문제인가..

 

 

+

2024.07.15

usbfs 크기가 적으니 늘리는게 도움이 된다는데 해도 해결은 안된다.

기본은 ubutu 22.04 에서 16MB 인 듯한데 1000MB로 늘려도 안된다.

$ cat /etc/default/grub | grep GRUB_CMDLINE_LINUX_DEFAULT
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
$ cat /sys/module/usbcore/parameters/usbfs_memory_mb
16
$ sudo sh -c 'echo 1000 > /sys/module/usbcore/parameters/usbfs_memory_mb'
$ cat /sys/module/usbcore/parameters/usbfs_memory_mb
1000

[링크 : https://github.com/OpenKinect/libfreenect2/issues/971]

[링크 : https://importgeek.wordpress.com/2017/02/26/increase-usbfs-memory-limit-in-ubuntu/]

 

+

혹시나 해서 찾아보는데..

expresscard의 경우 PCIe 2 or USB 3 mode 일 경우 3.2Gbps로 USB3.0의 5Gbps 에는 어떤 모드던 부족하다.

그런데 풀 대역폭을 쓰진 않을수도 있긴한데.. USB 장치에서 필요로 하는 대역폭을 다 커버 할 수 없는건가?

 

Speed
480 Mbit/s effective (USB 2 mode)
1.6 Gbit/s effective (PCIe 1 mode)
3.2 Gbit/s effective (PCIe 2 or USB 3 mode)

[링크 : https://en.wikipedia.org/wiki/ExpressCard]

 

칩셋인 uPD720202도 스펙상 PCIe Gen2 1 lane 이고, 속도까진 나와있지 않다

System I/F: PCIe Gen2 x 1 Lane

[링크 : https://www.renesas.com/us/en/products/interface/usb-switches-hubs/upd720202-usb-30-host-controller#overview]

 

i5-2520m 도 PCIe Gen 2 라고 하는데

확장 옵션
PCI Express 개정판 2.0
PCI Express 구성 ‡ 1x16, 2x8, 1x8+2x4
최대 PCI Express 레인 수 16

[링크 : https://www.intel.co.kr/content/www/kr/ko/products/sku/52229/intel-core-i52520m-processor-3m-cache-up-to-3-20-ghz/specifications.html]

 

pci-e 2.0 lane 1은 5.0GT/s 이고 5Gbps로 계산이 되긴한다.

반대로 생각하면 USB3.0이 생각외로 빠른거구나..

[링크 : https://en.wikipedia.org/wiki/PCI_Express]

 

Depends on your thinkpad's generation of Expresscard
Gen 1 is 1.6gbps
Gen 2 is 3.2gbps
Gen 3 is 6.4gbps, but each usb port can only do a max of 5gbps
In this case it's a T420 so it has gen 2 expresscard

[링크 : https://www.reddit.com/r/thinkpad/comments/xy44zj/finally_got_the_cheapest_usb_30_express_card_for/]

 

expresscard 34 규격의 sony sxs pro 라는 저장장치 인데

우연인지 아니면 대역폭 한계인지 3.2Gbps가 검색되서 나온다. expresscard와 pci-e 와는 속도 차이가 존재하는건가?

Max. Speeds
Read speed 3.5Gbps (=440MB/s) (1)
Write Speed 3.2Gbps (=400MB/s) (1)

[링크 : https://ccktech.com/product/sony-sxs-pro/]

[링크 :  https://ccktech.com/product-interface/expresscard-34/]

'프로그램 사용 > kinect' 카테고리의 다른 글

libfreenect2 성공  (0) 2024.07.17
libfreenect2 실행 성공..  (0) 2024.07.15
libfreenect2 CUDA 끄고 빌드 성공  (0) 2024.07.13
kinect v2 / freenect 실패  (0) 2024.07.09
xbox one S / 기본형?  (0) 2024.06.25
Posted by 구차니