• Community
  • Subpixel doesn't work when running gen2-collecting-training-data

I want to collect stereo data using subpixel mode for long depth measurements but the script crashes when trying to apply a color map with this error message:
cv2.error: OpenCV(4.5.1) /tmp/pip-req-build-jr1ur_cf/opencv/modules/imgproc/src/colormap.cpp:736: error: (-5:Bad argument) cv::ColorMap only supports source images of type CV_8UC1 or CV_8UC3 in function 'operator()'

I was also running the gen2-camera-demo to test the subpixel mode but my disparity looks strange.

any insight on this issue?

  • erik replied to this.

    Hello nickjrz ,
    so disparity is being colorized on this line. By default, disparity has values [0..95], so within a byte. After you add subpixel mode, however, disparity takes up 2 bytes, as it's values are [0..3040], more info here. So if you want to fit 0..3040 values into 0..255, you could divide the whole frame by 11,921568627 and convert these values to uint8.
    Thanks, Erik

      erik Thanks for your prompt reply, I will give that a try. The subpixel disparity would still hold depth information, right?

      Also any idea why I keep getting this error when subpixel is activated? I disabled all imageManip commands on script and still running into issues.

      device.startPipeline(create_pipeline(depth_enabled))
      RuntimeError: , LRT: 'Stereo subpixel/extended mode is not stable when one of the following nodes are enabled: 'ImageManip''