facebook360_dep
Facebook360 Depth Estimation Pipeline
Classes | Typedefs | Functions | Variables
fb360_dep::depth_estimation Namespace Reference

Classes

class  PointDistance
 
struct  PyramidLevel
 

Typedefs

using PixelType = cv::Vec3w
 
using PixelTypeFloat = cv::Vec3f
 

Functions

void plotMatches (const PyramidLevel< PixelType > &pyramidLevel, const std::string &caller, const filesystem::path &debugDir)
 
void getPyramidLevelSizes (std::map< int, cv::Size > &sizes, const filesystem::path &imageDir)
 
std::tuple< float, float > computeCost (const PyramidLevel< PixelType > &pyramidLevel, const int dstIdx, const float disparity, const int x, const int y)
 
void computeBruteForceCosts (PyramidLevel< PixelType > &pyramidLevel, const int dstIdx, const float disparity, cv::Mat_< float > &costMap, cv::Mat_< float > &confidenceMap)
 
void computeBruteForceDisparity (PyramidLevel< PixelType > &pyramidLevel, const int dstIdx, const float minDepthMeters, const float maxDepthMeters, const bool partialCoverage, const bool useForegroundMasks, const int numThreads)
 
void computeBruteForceDisparities (PyramidLevel< PixelType > &pyramidLevel, const float minDepthMeters, const float maxDepthMeters, const bool partialCoverage, const bool useForegroundMasks, const int numThreads)
 
void pingPongRectangle (cv::Mat_< float > &dispRes, cv::Mat_< float > &costsRes, cv::Mat_< float > &confidencesRes, const cv::Mat_< bool > &changed, const cv::Mat_< cv::Vec3b > &labImage, const PyramidLevel< PixelType > &pyramidLevel, const int dstIdx, const int xBegin, const int yBegin, const int xEnd, const int yEnd)
 
void pingPong (PyramidLevel< PixelType > &pyramidLevel, const int iterations, const int numThreads)
 
void pingPongPropagation (PyramidLevel< PixelType > &pyramidLevel, const int iterations, const int numThreads, const filesystem::path &debugDir)
 
void getSrcMismatches (std::vector< float > &dispMatches, std::vector< float > &dispMismatches, const PyramidLevel< PixelType > &pyramidLevel, const int dstIdx, const int x, const int y)
 
void updateDstDisparityAndMismatchMask (bool &dstDispMask, float &dstDispNew, const float dispCurr, const std::vector< float > &dispMatches, std::vector< float > &dispMismatches, const float dstVar, const float varThreshLow, const float varThreshHigh)
 
void handleDisparityMismatch (std::unordered_map< std::string, cv::Mat_< float >> &mapDstDisp, PyramidLevel< PixelType > &pyramidLevel, const int dstIdx)
 
void handleDisparityMismatches (PyramidLevel< PixelType > &pyramidLevel, const int startLevel, const int numThreads)
 
void randomProposal (PyramidLevel< PixelType > &pyramidLevel, const int dstIdx, const int y, const int numProposals, const float minDepthMeters, const float maxDepthMeters)
 
void preprocessLevel (PyramidLevel< PixelType > &pyramidLevel, const float minDepthMeters, const float maxDepthMeters, const bool partialCoverage, const bool useForegroundMasks, const int numThreads)
 
void randomProposals (PyramidLevel< PixelType > &pyramidLevel, const int numProposals, const float minDepthMeters, const float maxDepthMeters, const int numThreads, const filesystem::path &debugDir)
 
void bilateralFilter (PyramidLevel< PixelType > &pyramidLevel, const int numThreads)
 
void medianFilter (PyramidLevel< PixelType > &pyramidLevel, const int numThreads)
 
void saveResults (PyramidLevel< PixelType > &pyramidLevel, const bool saveDebugImages, const std::string &outputFormatsIn)
 
void maskFov (PyramidLevel< PixelType > &pyramidLevel, const int numThreads)
 
void precomputeProjections (PyramidLevel< PixelType > &pyramidLevel, const int threads)
 
void reprojectColors (PyramidLevel< PixelType > &pyramidLevel, const int numThreads)
 
void processLevel (PyramidLevel< PixelType > &pyramidLevel, const std::string &outputFormats, const bool useForegroundMasks, const std::string &outputRoot, const int numRandomProposals, const bool partialCoverage, const float minDepthM, const float maxDepthM, const bool doMedianFilter, const bool saveDebugImages, const int pingPongIterations, const int mismatchesStartLevel, const bool doBilateralFilter, const int threads)
 
bool operator> (const PointDistance &ptDist1, const PointDistance &ptDist2)
 
bool operator< (const PointDistance &ptDist1, const PointDistance &ptDist2)
 
Camera::Vector3 dstToWorldPoint (const Camera &camDst, const int x, const int y, const float disparity, const int dstW, const int dstH, const double shiftX, const double shiftY)
 
bool worldToSrcPoint (Camera::Vector2 &pSrc, const Camera::Vector3 &pWorld, const Camera &camSrc, const int srcW, const int srcH)
 
std::vector< int > mapSrcToDstIndexes (const Camera::Rig &rigSrc, const Camera::Rig &rigDst)
 
std::vector< std::array< int, 2 > > prunePingPongCandidates (const std::vector< std::array< int, 2 >> &pingPongCandidateOffsets, const cv::Mat_< cv::Vec3b > &labImage, const std::array< int, 2 > &startPoint, const size_t numNeighbors)
 
std::pair< float, float > computeSSD (const cv::Mat_< PixelType > &dstColor, const int x, const int y, const PixelType &dstBias, const cv::Mat_< PixelType > &dstSrcColor, const float xDstSrc, const float yDstSrc, const PixelType &dstSrcBias, const int radius)
 
void plotDstPointInSrc (const Camera &camDst, const int x, const int y, const float disparity, const Camera camSrc, const cv::Mat_< PixelType > &srcColor, const cv::Mat_< PixelType > &dstColor, const filesystem::path &outputDir, const std::string &prefix)
 
cv::Mat_< PixelTypeproject (const cv::Mat_< PixelType > &srcColor, const cv::Mat_< cv::Vec2f > &warpDstToSrc)
 
cv::Mat_< PixelTypecolorBias (const cv::Mat_< PixelType > &color, const int blurRadius)
 
cv::Mat computeRgbVariance (const cv::Mat &image, const int windowRadius)
 
cv::Mat_< float > computeImageVariance (const cv::Mat &image)
 
std::vector< cv::Mat_< bool > > generateFovMasks (const Camera::Rig &rig, const cv::Size &size, const int threads)
 
filesystem::path getImageDir (const filesystem::path &dir, const ImageType &imageType)
 
filesystem::path getImageDir (const filesystem::path &dir, const ImageType &imageType, const int level)
 
filesystem::path getImageDir (const filesystem::path &dir, const ImageType &imageType, const int level, const std::string &camId)
 
filesystem::path getImageDir (const filesystem::path &dir, const ImageType &imageType, const std::string &camId)
 
filesystem::path genFilename (const filesystem::path &dir, const ImageType &imageType, const int level, const std::string &camId, const std::string &frameName, const std::string &extension)
 
void createLevelOutputDirs (const filesystem::path &outputDir, const int level, const Camera::Rig &rig, const bool saveDebugImages)
 
template<typename TPixel , typename TGuide >
cv::Mat_< TPixel > generalizedJointBilateralFilter (const cv::Mat_< TPixel > &image, const cv::Mat_< TGuide > &guide, const cv::Mat_< TGuide > &neighborTGuide, const cv::Mat_< bool > &mask, const int radius, const float sigma, const float weight0=1.0f, const float weight1=1.0f, const float weight2=1.0f, const int numThreads=-1)
 
int getRadius (const cv::Size &size, const cv::Size &sizeUp)
 
std::vector< cv::Mat_< float > > upsampleDisparities (const Camera::Rig &rigIn, const std::vector< cv::Mat_< float >> &disps, const std::vector< cv::Mat_< float >> &bgDispsUp, const std::vector< cv::Mat_< bool >> &masks, const std::vector< cv::Mat_< bool >> &masksUpIn, const cv::Size &sizeUp, const bool useForegroundMasks, const int threads)
 

Variables

const float kLevelScale = 0.9f
 
const float kScaleDisparityPlot = 255.0f
 
const float kScaleCostPlot = 255.0f / 100.0f
 
const float kScaleConfidencePlot = 255.0f * 100.0f
 
const std::vector< float > kRgbWeights = {0.3333f, 0.3334f, 0.3333f}
 
const float kMinVar = 1.0f / 12.0f / 65025.0f
 
const std::vector< std::array< int, 2 > > candidateTemplateOriginal
 

Typedef Documentation

◆ PixelType

using fb360_dep::depth_estimation::PixelType = typedef cv::Vec3w

◆ PixelTypeFloat

Function Documentation

◆ bilateralFilter()

void fb360_dep::depth_estimation::bilateralFilter ( PyramidLevel< PixelType > &  pyramidLevel,
const int  numThreads 
)

◆ colorBias()

cv::Mat_< PixelType > fb360_dep::depth_estimation::colorBias ( const cv::Mat_< PixelType > &  color,
const int  blurRadius 
)

◆ computeBruteForceCosts()

void fb360_dep::depth_estimation::computeBruteForceCosts ( PyramidLevel< PixelType > &  pyramidLevel,
const int  dstIdx,
const float  disparity,
cv::Mat_< float > &  costMap,
cv::Mat_< float > &  confidenceMap 
)

◆ computeBruteForceDisparities()

void fb360_dep::depth_estimation::computeBruteForceDisparities ( PyramidLevel< PixelType > &  pyramidLevel,
const float  minDepthMeters,
const float  maxDepthMeters,
const bool  partialCoverage,
const bool  useForegroundMasks,
const int  numThreads 
)

◆ computeBruteForceDisparity()

void fb360_dep::depth_estimation::computeBruteForceDisparity ( PyramidLevel< PixelType > &  pyramidLevel,
const int  dstIdx,
const float  minDepthMeters,
const float  maxDepthMeters,
const bool  partialCoverage,
const bool  useForegroundMasks,
const int  numThreads 
)

◆ computeCost()

std::tuple< float, float > fb360_dep::depth_estimation::computeCost ( const PyramidLevel< PixelType > &  pyramidLevel,
const int  dstIdx,
const float  disparity,
const int  x,
const int  y 
)

◆ computeImageVariance()

cv::Mat_< float > fb360_dep::depth_estimation::computeImageVariance ( const cv::Mat &  image)

◆ computeRgbVariance()

cv::Mat fb360_dep::depth_estimation::computeRgbVariance ( const cv::Mat &  image,
const int  windowRadius 
)

◆ computeSSD()

std::pair< float, float > fb360_dep::depth_estimation::computeSSD ( const cv::Mat_< PixelType > &  dstColor,
const int  x,
const int  y,
const PixelType dstBias,
const cv::Mat_< PixelType > &  dstSrcColor,
const float  xDstSrc,
const float  yDstSrc,
const PixelType dstSrcBias,
const int  radius 
)

◆ createLevelOutputDirs()

void fb360_dep::depth_estimation::createLevelOutputDirs ( const filesystem::path &  outputDir,
const int  level,
const Camera::Rig rig,
const bool  saveDebugImages 
)

◆ dstToWorldPoint()

Camera::Vector3 fb360_dep::depth_estimation::dstToWorldPoint ( const Camera camDst,
const int  x,
const int  y,
const float  disparity,
const int  dstW,
const int  dstH,
const double  shiftX,
const double  shiftY 
)

◆ generalizedJointBilateralFilter()

template<typename TPixel , typename TGuide >
cv::Mat_<TPixel> fb360_dep::depth_estimation::generalizedJointBilateralFilter ( const cv::Mat_< TPixel > &  image,
const cv::Mat_< TGuide > &  guide,
const cv::Mat_< TGuide > &  neighborTGuide,
const cv::Mat_< bool > &  mask,
const int  radius,
const float  sigma,
const float  weight0 = 1.0f,
const float  weight1 = 1.0f,
const float  weight2 = 1.0f,
const int  numThreads = -1 
)

◆ generateFovMasks()

std::vector< cv::Mat_< bool > > fb360_dep::depth_estimation::generateFovMasks ( const Camera::Rig rig,
const cv::Size &  size,
const int  threads 
)

◆ genFilename()

filesystem::path fb360_dep::depth_estimation::genFilename ( const filesystem::path &  dir,
const ImageType imageType,
const int  level,
const std::string &  camId,
const std::string &  frameName,
const std::string &  extension 
)

◆ getImageDir() [1/4]

filesystem::path fb360_dep::depth_estimation::getImageDir ( const filesystem::path &  dir,
const ImageType imageType 
)

◆ getImageDir() [2/4]

filesystem::path fb360_dep::depth_estimation::getImageDir ( const filesystem::path &  dir,
const ImageType imageType,
const int  level 
)

◆ getImageDir() [3/4]

filesystem::path fb360_dep::depth_estimation::getImageDir ( const filesystem::path &  dir,
const ImageType imageType,
const int  level,
const std::string &  camId 
)

◆ getImageDir() [4/4]

filesystem::path fb360_dep::depth_estimation::getImageDir ( const filesystem::path &  dir,
const ImageType imageType,
const std::string &  camId 
)

◆ getPyramidLevelSizes()

void fb360_dep::depth_estimation::getPyramidLevelSizes ( std::map< int, cv::Size > &  sizes,
const filesystem::path &  imageDir 
)

◆ getRadius()

int fb360_dep::depth_estimation::getRadius ( const cv::Size &  size,
const cv::Size &  sizeUp 
)

◆ getSrcMismatches()

void fb360_dep::depth_estimation::getSrcMismatches ( std::vector< float > &  dispMatches,
std::vector< float > &  dispMismatches,
const PyramidLevel< PixelType > &  pyramidLevel,
const int  dstIdx,
const int  x,
const int  y 
)

◆ handleDisparityMismatch()

void fb360_dep::depth_estimation::handleDisparityMismatch ( std::unordered_map< std::string, cv::Mat_< float >> &  mapDstDisp,
PyramidLevel< PixelType > &  pyramidLevel,
const int  dstIdx 
)

◆ handleDisparityMismatches()

void fb360_dep::depth_estimation::handleDisparityMismatches ( PyramidLevel< PixelType > &  pyramidLevel,
const int  startLevel,
const int  numThreads 
)

◆ mapSrcToDstIndexes()

std::vector< int > fb360_dep::depth_estimation::mapSrcToDstIndexes ( const Camera::Rig rigSrc,
const Camera::Rig rigDst 
)

◆ maskFov()

void fb360_dep::depth_estimation::maskFov ( PyramidLevel< PixelType > &  pyramidLevel,
const int  numThreads 
)

◆ medianFilter()

void fb360_dep::depth_estimation::medianFilter ( PyramidLevel< PixelType > &  pyramidLevel,
const int  numThreads 
)

◆ operator<()

bool fb360_dep::depth_estimation::operator< ( const PointDistance ptDist1,
const PointDistance ptDist2 
)

◆ operator>()

bool fb360_dep::depth_estimation::operator> ( const PointDistance ptDist1,
const PointDistance ptDist2 
)

◆ pingPong()

void fb360_dep::depth_estimation::pingPong ( PyramidLevel< PixelType > &  pyramidLevel,
const int  iterations,
const int  numThreads 
)

◆ pingPongPropagation()

void fb360_dep::depth_estimation::pingPongPropagation ( PyramidLevel< PixelType > &  pyramidLevel,
const int  iterations,
const int  numThreads,
const filesystem::path &  debugDir 
)

◆ pingPongRectangle()

void fb360_dep::depth_estimation::pingPongRectangle ( cv::Mat_< float > &  dispRes,
cv::Mat_< float > &  costsRes,
cv::Mat_< float > &  confidencesRes,
const cv::Mat_< bool > &  changed,
const cv::Mat_< cv::Vec3b > &  labImage,
const PyramidLevel< PixelType > &  pyramidLevel,
const int  dstIdx,
const int  xBegin,
const int  yBegin,
const int  xEnd,
const int  yEnd 
)

◆ plotDstPointInSrc()

void fb360_dep::depth_estimation::plotDstPointInSrc ( const Camera camDst,
const int  x,
const int  y,
const float  disparity,
const Camera  camSrc,
const cv::Mat_< PixelType > &  srcColor,
const cv::Mat_< PixelType > &  dstColor,
const filesystem::path &  outputDir,
const std::string &  prefix 
)

◆ plotMatches()

void fb360_dep::depth_estimation::plotMatches ( const PyramidLevel< PixelType > &  pyramidLevel,
const std::string &  caller,
const filesystem::path &  debugDir 
)

◆ precomputeProjections()

void fb360_dep::depth_estimation::precomputeProjections ( PyramidLevel< PixelType > &  pyramidLevel,
const int  threads 
)

◆ preprocessLevel()

void fb360_dep::depth_estimation::preprocessLevel ( PyramidLevel< PixelType > &  pyramidLevel,
const float  minDepthMeters,
const float  maxDepthMeters,
const bool  partialCoverage,
const bool  useForegroundMasks,
const int  numThreads 
)

◆ processLevel()

void fb360_dep::depth_estimation::processLevel ( PyramidLevel< PixelType > &  pyramidLevel,
const std::string &  outputFormats,
const bool  useForegroundMasks,
const std::string &  outputRoot,
const int  numRandomProposals,
const bool  partialCoverage,
const float  minDepthM,
const float  maxDepthM,
const bool  doMedianFilter,
const bool  saveDebugImages,
const int  pingPongIterations,
const int  mismatchesStartLevel,
const bool  doBilateralFilter,
const int  threads 
)

◆ project()

cv::Mat_< PixelType > fb360_dep::depth_estimation::project ( const cv::Mat_< PixelType > &  srcColor,
const cv::Mat_< cv::Vec2f > &  warpDstToSrc 
)

◆ prunePingPongCandidates()

std::vector< std::array< int, 2 > > fb360_dep::depth_estimation::prunePingPongCandidates ( const std::vector< std::array< int, 2 >> &  pingPongCandidateOffsets,
const cv::Mat_< cv::Vec3b > &  labImage,
const std::array< int, 2 > &  startPoint,
const size_t  numNeighbors 
)

◆ randomProposal()

void fb360_dep::depth_estimation::randomProposal ( PyramidLevel< PixelType > &  pyramidLevel,
const int  dstIdx,
const int  y,
const int  numProposals,
const float  minDepthMeters,
const float  maxDepthMeters 
)

◆ randomProposals()

void fb360_dep::depth_estimation::randomProposals ( PyramidLevel< PixelType > &  pyramidLevel,
const int  numProposals,
const float  minDepthMeters,
const float  maxDepthMeters,
const int  numThreads,
const filesystem::path &  debugDir 
)

◆ reprojectColors()

void fb360_dep::depth_estimation::reprojectColors ( PyramidLevel< PixelType > &  pyramidLevel,
const int  numThreads 
)

◆ saveResults()

void fb360_dep::depth_estimation::saveResults ( PyramidLevel< PixelType > &  pyramidLevel,
const bool  saveDebugImages,
const std::string &  outputFormatsIn 
)

◆ updateDstDisparityAndMismatchMask()

void fb360_dep::depth_estimation::updateDstDisparityAndMismatchMask ( bool &  dstDispMask,
float &  dstDispNew,
const float  dispCurr,
const std::vector< float > &  dispMatches,
std::vector< float > &  dispMismatches,
const float  dstVar,
const float  varThreshLow,
const float  varThreshHigh 
)

◆ upsampleDisparities()

std::vector< cv::Mat_< float > > fb360_dep::depth_estimation::upsampleDisparities ( const Camera::Rig rigIn,
const std::vector< cv::Mat_< float >> &  disps,
const std::vector< cv::Mat_< float >> &  bgDispsUp,
const std::vector< cv::Mat_< bool >> &  masks,
const std::vector< cv::Mat_< bool >> &  masksUpIn,
const cv::Size &  sizeUp,
const bool  useForegroundMasks,
const int  threads 
)

◆ worldToSrcPoint()

bool fb360_dep::depth_estimation::worldToSrcPoint ( Camera::Vector2 pSrc,
const Camera::Vector3 pWorld,
const Camera camSrc,
const int  srcW,
const int  srcH 
)

Variable Documentation

◆ candidateTemplateOriginal

const std::vector<std::array<int, 2> > fb360_dep::depth_estimation::candidateTemplateOriginal
Initial value:
= {{{{0, 0}},
{{-1, 0}},
{{1, 0}},
{{0, -1}},
{{0, 1}},
{{-2, -2}},
{{2, -2}},
{{-2, 2}},
{{2, 2}}}}

◆ kLevelScale

const float fb360_dep::depth_estimation::kLevelScale = 0.9f

◆ kMinVar

const float fb360_dep::depth_estimation::kMinVar = 1.0f / 12.0f / 65025.0f

◆ kRgbWeights

const std::vector<float> fb360_dep::depth_estimation::kRgbWeights = {0.3333f, 0.3334f, 0.3333f}

◆ kScaleConfidencePlot

const float fb360_dep::depth_estimation::kScaleConfidencePlot = 255.0f * 100.0f

◆ kScaleCostPlot

const float fb360_dep::depth_estimation::kScaleCostPlot = 255.0f / 100.0f

◆ kScaleDisparityPlot

const float fb360_dep::depth_estimation::kScaleDisparityPlot = 255.0f