34 #include <visp3/ustk_confidence_map/usScanlineConfidence2D.h>
55 unsigned int AN = preScanImage.getHeight();
56 unsigned int LN = preScanImage.getWidth();
57 if (AN == 0 || LN == 0)
58 throw(vpException(vpException::notInitialized,
"pre-scan image dimension is 0"));
60 preScanConfidence.
resize(AN, LN);
65 for (
unsigned int i = 0; i < AN; ++i)
66 for (
unsigned int j = 0; j < LN; ++j) {
67 if (
static_cast<double>(preScanImage(i, j)) < min)
68 min =
static_cast<double>(preScanImage(i, j));
69 if (
static_cast<double>(preScanImage(i, j)) > max)
70 max =
static_cast<double>(preScanImage(i, j));
74 for (
unsigned int j = 0; j < LN; ++j) {
76 for (
unsigned int i = 0; i < AN; ++i)
77 sum += vpMath::sqr((preScanImage(i, j) - min) / (max - min));
80 preScanConfidence(0, j, 255);
81 for (
unsigned int i = 1; i < AN; ++i) {
82 val -= vpMath::sqr((preScanImage(i - 1, j) - min) / (max - min));
83 preScanConfidence(i, j, (
unsigned char)(val / sum * 255));
void resize(const unsigned int h, const unsigned int w)
void setImagePreScanSettings(const usImagePreScanSettings &preScanSettings)
void run(usImagePreScan2D< unsigned char > &preScanConfidence, const usImagePreScan2D< unsigned char > &preScanImage)
virtual ~usScanlineConfidence2D()