11 #define SHOW(a) TRACE(a) 32 if(s->getID().empty())
return NULL;
34 selectSensor(s->getID());
39 SHOW(
"replacing sensor "<<s->getID());
40 if(spr->assignRef(s)) {
53 iterator fs = find(
id);
70 m_Printlist.insert(
"d0");
71 m_Printlist.insert(
"0");
77 return m_Printlist.find(
id) != m_Printlist.end();
82 m_Printlist.insert(
id);
88 for(map<string,sensor_ptr>::const_iterator s=sc.begin(); s!=sc.end(); s++) {
89 if (s->second->getID() !=
"0" &&
90 !s->second->getID().empty() &&
91 s->second->getID() !=
"d0" &&
118 if (para1 ==
"source") {
121 source = getSensor(sname);
122 if(std::dynamic_pointer_cast<const ZeroSensor>(source))
123 cout <<
"Using zero sensor as source. Source name was: " 126 SHOW(
"Using source " << source->getID());
133 source = getSensor(
string(
"d0"));
138 s = makeSensor<IntensitySensor>(source);
139 SHOW(
"created intensity sensor");
145 s = makeSensor<SmoothIntensitySensor>(source, scale);
146 SHOW(
"created Gaussian sensor of scale " << scale);
153 s = makeSensor<GradMagSensor>(source);
154 SHOW(
"created gm sensor");
161 s = makeSensor<CornerSensor>(source);
162 SHOW(
"created corner sensor");
166 s = makeSensor<CombiSensor>();
167 std::dynamic_pointer_cast<
CombiSensor>(s)->normalizeInput(
false);
173 if(!s) s = makeSensor<CombiSensor>();
180 cout <<
"added zero sensor" << endl;
181 std::dynamic_pointer_cast<CombiSensor>(s)->setSource(ss,weight);
184 SHOW(
"created combi sensor with " << nsensors<<
" sub-sensors.");
189 int nc = source ? source->getNChannels() : 0;
190 vector<float> weights;
193 while(vs >> weight) {
194 weights.push_back(weight);
195 cout << weight <<
" ";
198 s = makeSensor<MCIntensitySensor>(source);
199 s->setCWeights(weights);
200 SHOW(
"created multi-channel sensor.");
205 s = makeSensor<MCGSensor>(source);
206 SHOW(
"created multi-channel gradient sensor.");
211 s = makeSensor<CRSensor>(source);
212 SHOW(
"created multi-channel chrominance sensor.");
220 s = makeSensor<MahalSensor>(source, fname);
221 if(!std::dynamic_pointer_cast<MahalSensor>(s)->getFilename().empty()) {
222 SHOW(
"created colour classification sensor");
224 SHOW(
"error loading configuration file for colour sensor " 235 s = makeSensor<MappingSensor>(source, mapping);
237 SHOW(
"created mapping sensor of type " <<
238 std::dynamic_pointer_cast<MappingSensor>(s)->getMappingName());
243 s = makeSensor<ZeroSensor>();
244 SHOW(
"created zero sensor");
258 if(
this == &rhs)
return *
this;
259 for(map<string, sensor_ptr >::iterator si = rhs.begin();
260 si != rhs.end(); si++)
262 if(!si->first.empty() && si->first!=
"0") {
267 bool lnzs = !std::dynamic_pointer_cast<
ZeroSensor>(spr);
268 bool rnzs = !std::dynamic_pointer_cast<
ZeroSensor>(si->second);
274 si->second->replaceBy(spr);
284 m_Models.insert(model);
289 m_Models.erase(model);
294 for(set<Model*>::iterator mo = m_Models.begin();
295 mo != m_Models.end(); mo++)
296 (*mo)->reattachSensors();
void clearPrintList(bool skipdefaults=true)
void replaceBy(sensor_ptr target)
void updateModels() const
std::shared_ptr< Sensor > sensor_ptr
void refModel(Model *model) const
sensor_ptr getSensor(const std::string &id)
const std::string & getValue() const
sensor_ptr getZeroSensor()
void setPrinted(const std::string &id)
const std::string & getKey() const
void unrefModel(Model *model) const
bool isPrinted(const std::string &id) const
void setParseError(const std::string &msg="")
std::shared_ptr< const Sensor > sensor_cptr
ostream & operator<<(ostream &os, const SensorCollection &sc)
SensorCollection & merge(SensorCollection &rhs)
void pushLine(const std::string &line)
sensor_ptr readSensor(ParseFile &is)
sensor_ptr addSensor(const std::string &key, sensor_ptr s)