Template Function lib3d::computeNormalError

Function Documentation

template<typename T>
void lib3d::computeNormalError(const cv::Mat &iComputedNormalMap, const cv::Mat &iGroundtruthNormalMap, T &oAvgAngError, T &oAngErrorStdDev, T &oComputedDensity, T &oGroundtruthDensity, const cv::Mat &iRoiMask = cv::Mat())

Compute Average Angular Error error between two normal maps.

Note

Since lib3d::types::NormalMap is a subclass of they can be passed directly to this function.

Parameters:
  • iComputedNormalMap[in] Computed normal map with normalized vectors.

  • iGroundtruthNormalMap[in] Ground truth normal map with normalized vectors.

  • oAvgAngError[out] Average Angular Error in radian:

    \[\text{AAE} = \frac{1}{m}\sum_{m}\delta(\mathrm{n}, \hat{\mathrm{n}})\ ,\ \ \text{with}\ \delta(\mathrm{n}, \hat{\mathrm{n}}) = \cos^{-1}\langle \mathrm{n}, \hat{\mathrm{n}} \rangle.\]
    With \(\mathrm{n}\) and \(\hat{\mathrm{n}}\) being the predicted normal and the ground truth normal value, and \(m\) being the pixels for which both \(\mathrm{n}\) and \(\hat{\mathrm{n}}\) exist. In this, \(\delta(\mathrm{n}, \hat{\mathrm{n}})\) can be considered as the enclosed angles between the two vectors. Both normal vectors need to be normalized.

  • oAngErrorStdDev[out] Standard deviation of the pixel wise average angular error:

    \[\sigma\text{-AE} = \sqrt{\frac{\sum_{m}\left(\delta(\mathrm{n}, \hat{\mathrm{n}}) - \text{AAE}\right)^2}{m}}.\]
    Under the assumption that the ground truth is sufficiantly smooth, this will indicate the smoothness of the estimate. If \(\sigma\text{-AE}\) is small, it can be assumed that the estimate is just as smooth as the groundtruth, but might have a certain offset.

  • oComputedDensity[out] Density of computed normal map.

  • oGroundtruthDensity[out] Density of ground truth normal map.

  • iRoiMask[in] Binary mask indicating region of interest. If provided the error is only calculated for the pixels for wich iRoiMask = 1.