is there any way to calculate Volume from Depth data ? using depth based cameras

489 Views Asked by At

Currently I am getting the total Intensity of the frame by adding all the depth data.so can i consider intensity as volume ?

or is there any other way to get the volume ?

  while(true)
    {
          // This call waits until a new coherent set of frames is available on a device
        // Calls to get_frame_data(...) and get_frame_timestamp(...) on a device will return stable values until wait_for_frames(...) is called
        dev->wait_for_frames();

        // Retrieve depth data, which was previously configured as a 640 x 480 image of 16-bit depth values
        const uint16_t * depth_frame = reinterpret_cast<const uint16_t *>(dev->get_frame_data(rs::stream::depth));

        Mat depthData(Size(640, 480), CV_16UC1, (void*)dev->get_frame_data(rs::stream::depth), Mat::AUTO_STEP);
        imshow( "WINDOW_DEPTH", depthData );
        cvWaitKey( 1 );

      //  cout<<"\n\n\n\n\n\n\n\n\ndepthData:-------------------->"<<depthData;

        //cal vol
        int Totalintensity = 0;
        for (int i=0; i < depthData.rows; ++i){
          for (int j=0; j < depthData.cols; ++j){
            Totalintensity += (int)depthData.at<uchar>(i, j);
          }
      }
        cout<<"\ntotalVol:"<<Totalintensity;
    }

0

There are 0 best solutions below