Forums - FastCV Depth Registration Issue

1 post / 0 new
FastCV Depth Registration Issue
efong
Join Date: 5 Jul 22
Posts: 1
Posted: Fri, 2023-02-10 15:15

Hello,

 

Anyone have experience with fast cv depth registration?  It is returning an image after processing.  I overlayed my depth image on top of my rgb image and they are not registered.  Here is my source.  I'm reading a 16uint depth image and convert it to float32.  I write the output file as tiff.  My depth image is rotated 90 degrees to the right relative to my rgb image.  However, fcvRegisterDepth doesn't rotate the image to the same orientation.  OpenCV registerDepth does it correctly.  Any ideas what I'm doing incorrectly with fcvRegisterDepthf32.

  cv::Mat src_16u(1024, 1024, CV_16U, input);
  //cv::Mat src_float32(1024, 1024, CV_32F, input);
  cv::Mat src_float32;
  src_16u.convertTo(src_float32, CV_32F);
  src_float32 = src_float32 * (1.0 / 1000.0);

  LOGD("depth file size: %ld", input_len);
  LOGD("output file size: %ld", output_len);

  std::string result;
#ifdef FASTCV_AVAILABLE

  // inverse depth intrinsics Kd inverse
  float kdinv[] = {
          0.0015077190540756175,
          0.0,
          -0.7955785393714905,
          0.0,
          0.0015092206713858062,
          -0.7336310744285583,
          0.0,
          0.0,
          1.0
  };

  // Color intrinsics K
  float kc[] = {
          747.49267578125,
          0.0,
          636.737937743892,
          0.0,
          750.3214721679688,
          513.7492803585737,
          0.0,
          0.0,
          1.0
  };

  // depth to color rotation
  float rd2c[] = {
          0.004122896914301166,
          -0.9999901410490459,
          -0.001649098463817929,
          0.9999885162318807,
          0.00412690811460568,
          -0.0024363977046377816,
          0.0024431793621444045,
          -0.001639034509375106,
          0.9999956722108758
  };

  // depth to color transform
  float td2c[] = {
          0.0037047370975357985,
          -0.027640989577712438,
          -0.009672658148084823
  };

  auto start_register = std::chrono::steady_clock::now();

  auto status =
      fcvRegisterDepthImagef32(reinterpret_cast<const float32_t *>(src_float32.data),
                               1024,
                               1024,
                               1024 * sizeof(uint32_t),
                               kdinv,
                               kc,
                               rd2c,
                               td2c,
                               reinterpret_cast<float32_t *>(output),
                               0);

 

  • Up0
  • Down0

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.