43 std::vector<unsigned char> cost_interpretation_table(256);
44 for (
unsigned int i = 0; i < cost_interpretation_table.size(); i++)
46 double intensity =
static_cast<double>(i) / 255.0;
47 if (intensity > occupied_threshold)
49 cost_interpretation_table[i] = +100;
51 else if (intensity < free_threshold)
53 cost_interpretation_table[i] = 0;
57 cost_interpretation_table[i] = -1;
60 return cost_interpretation_table;
65 std::vector<unsigned char> cost_interpretation_table(256);
66 for (
unsigned int i = 0; i < cost_interpretation_table.size(); i++)
68 double intensity =
static_cast<double>(i) / 255.0;
69 if (intensity > occupied_threshold)
71 cost_interpretation_table[i] = +100;
73 else if (intensity < free_threshold)
75 cost_interpretation_table[i] = 0;
80 cost_interpretation_table[i] = 99 * (intensity - free_threshold) / (occupied_threshold - free_threshold);
83 return cost_interpretation_table;
88 std::vector<unsigned char> cost_interpretation_table(256);
89 for (
unsigned int i = 0; i < cost_interpretation_table.size(); i++)
92 if (use_unknown_value && i == 255)
94 else if (!use_unknown_value && i == 255)
102 double scale =
static_cast<double>(i) / 100.0;
103 value =
static_cast<unsigned char>(scale * 254);
105 cost_interpretation_table[i] = value;
107 return cost_interpretation_table;
std::vector< unsigned char > pixelColoringInterpretation(const double free_threshold, const double occupied_threshold)
Above occupied_threshold is occupied, below free_threshold is free, and the middle gray is unknown...
std::vector< unsigned char > grayScaleInterpretation(const double free_threshold, const double occupied_threshold)
Above occupied_threshold is occupied, below free_threshold is free, and the middle is in between...
std::vector< unsigned char > getOccupancyInput(bool trinary=false, bool use_unknown_value=false)
Above 100 is occupied, -1 is sometimes unknown, and otherwise it is either scaled or freespace...