8 Replies Latest reply on Mar 27, 2017 10:09 AM by Intel Corporation

    Memory leak persists in CreateDepthImageMappedToColor of the latest SDK

    hengel

      Hello,

      I have found the memory leak still persists in newest version of RealSense SDK (intel_rs_sdk_mw_core_offline_11.0.27.1384)."

      My OS is Windows 10.

      DCM version is intel_rs_dcm_r200_2.1.27.2853

      Is there any previous release that does not have this memory leak?

      I did release the memory but it does not have effect. Is my code has anything wrong?

      void PXCImage2CVMat(PXCImage *pxcImage, PXCImage::PixelFormat format, cv::Mat *output)
      {
        PXCImage::ImageData data;
        pxcImage->AcquireAccess(PXCImage::ACCESS_READ, format, &data);
      
      
        int width = pxcImage->QueryInfo().width;
        int height = pxcImage->QueryInfo().height;
        if (!format)
        format = pxcImage->QueryInfo().format;
      
      
        int type;
        if (format == PXCImage::PIXEL_FORMAT_Y8)
        type = CV_8UC1;
        else if (format == PXCImage::PIXEL_FORMAT_RGB24)
        type = CV_8UC3;
        else if (format == PXCImage::PIXEL_FORMAT_DEPTH_F32)
        type = CV_32FC1;
        else if (format == PXCImage::PIXEL_FORMAT_DEPTH)
        type = CV_16UC1;
      
      
        *output = cv::Mat(cv::Size(width, height), type, data.planes[0]);
      
        pxcImage->ReleaseAccess(&data);
        return;
      }
      
      // inside main function
        sm->AcquireFrame(true);
        PXCCapture::Sample *sample = sm->QuerySample();
        PXCImage2CVMat(sample->color, PXCImage::PIXEL_FORMAT_RGB24, &colorImage);
        PXCImage2CVMat(projection->CreateDepthImageMappedToColor(sample->depth, sample->color), PXCImage::PIXEL_FORMAT_DEPTH, &depthImage);
        cv::cvtColor(colorImage, curImage, CV_BGR2GRAY);
      
        sm->ReleaseFrame();
      

       

      Thank you in advance, I really appreciate the help.

      Best regards

      Williem