16 std::ostream&
print(std::ostream& os)
const {
23 return source->getValue(x,y);
32 return source->getValue(x,y);
40 std::ostream&
print(std::ostream& os)
const {
52 const std::vector<float> mv =
source->getMValue(x,y);
53 assert(mv.size() ==
cweights.size());
54 for(
dword i=0; i<mv.size(); i++) {
56 if(weight!=0.0f) result += mv[i]*weight;
68 std::ostream&
print(std::ostream& os)
const {
77 const std::vector<float> mv =
source->getMValue(x,y);
78 for(std::vector<float>::const_iterator v=mv.begin();
84 std::vector<float> c =
source->getMValue(x,y);
85 std::vector<float> r =
source->getMValue(x+1,y);
86 std::vector<float> b =
source->getMValue(x,y+1);
88 for(
int i=0; i<
source->getNChannels(); i++)
90 register float dx = r[i]-c[i];
92 register float dy = b[i]-c[i];
107 std::ostream&
print(std::ostream& os)
const {
116 std::vector<float> mv =
source->getMValue(x,y);
120 for(std::vector<float>::const_iterator v=mv.begin();
124 for(std::vector<float>::const_iterator v=mv.begin();
127 register float d = g-*v;
131 #elif defined(SATURATION) 132 float mi = std::numeric_limits<float>::max();
133 float ma = std::numeric_limits<float>::min();
134 for(std::vector<float>::const_iterator v=mv.begin();
140 return ma>0.00001 ? (ma-mi)/ma : 0;
154 std::ostream&
print(std::ostream& os)
const {
161 void calcAllValues();
163 return source->getValue(x,y);
188 std::ostream&
print(std::ostream& os)
const {
197 else return source->getGradient(x,y).norm();
217 std::ostream&
print(std::ostream& os)
const {
226 float value =
source->getValue(x,y);
227 if(value==0)
return 0;
232 #ifdef SS_GRADIENT_WEIGHTED_DETERMINANT 235 float det = ddx.
x*ddy.
y-ddx.
y*ddy.
x;
238 float det = ddx.
x*ddy.
y-ddx.
y*ddy.
x;
268 for(std::vector<sensor_ptr>::const_iterator s = sources.begin();
269 s!=sources.end(); s++)
270 if((*s)->getSkip() >
m_Skip) m_Skip = (*s)->getSkip();
275 std::ostream&
print(std::ostream& os)
const;
279 void setNSources(
int n);
280 void setSource(
sensor_ptr _source,
float weight,
int id);
282 { setSource(_source, weight, sources.size()); }
293 std::vector<sensor_ptr>::const_iterator s = sources.begin();
294 std::vector<float>::const_iterator w =
cweights.begin();
296 for(; s != sources.end(); s++,w++) {
297 result += (*s)->getWeightedValue(x,y)*(*w);
300 for(; s != sources.end(); s++,w++) {
301 result += (*s)->getValue(x,y)*(*w);
308 std::vector<float>::iterator v = vv.begin();
309 std::vector<sensor_ptr>::const_iterator s = sources.begin();
310 std::vector<float>::const_iterator w =
cweights.begin();
312 for(; v != vv.end(); v++, s++,w++)
313 *v = (*s)->getWeightedValue(x,y)*(*w);
315 for(; v != vv.end(); v++, s++,w++)
316 *v = (*s)->getValue(x,y)*(*w);
333 std::ostream&
print(std::ostream& os)
const {
335 <<
"C " << m_Filename;
338 bool loadConfig(
const std::string& fname =
"");
339 bool saveConfig(
const std::string& fname =
"")
const;
348 std::vector<float> mv =
source->getMValue(x,y);
352 float d = (vt.
mulRight(icov.mulRight(v))).
at(0,0);
374 std::ostream&
print(std::ostream& os)
const;
376 {
return s_MappingNames[m_MappingID]; }
379 dword setMapping(
const std::string& mname);
380 bool readParams(std::istream& is);
383 static const char* s_MappingNames[];
386 float v =
source->getValue(x,y);
387 switch(m_MappingID) {
391 if(v < m_Param[0]) v = m_Param[0];
394 if(v > m_Param[0]) v = m_Param[0];
397 if(v < m_Param[0]) v = m_Param[0];
398 else if(v > m_Param[1]) v = m_Param[1];
401 if(v > m_Param[1]) v = m_Param[1];
404 v = (v-m_Param[1])*m_Param[2]+0.5;
407 if(v>0.f) v = (v-m_Param[1])*m_Param[2];
411 v = (v-m_Param[1])*m_Param[2];
const std::string & getFilename() const
std::ostream & print(std::ostream &os) const
bool isModified(dword mask=UPD_ALL) const
virtual std::ostream & hprint(std::ostream &os, SensorCollection *sc) const
virtual Point calcGradient(int x, int y) const
const DMatrix< float > & getICov() const
std::vector< sensor_ptr > sources
std::ostream & print(std::ostream &os) const
float calcValue(int x, int y) const
const char * getMappingName() const
virtual void changeSource(sensor_cptr _source)
MCGSensor(sensor_cptr _source=NULL)
bool isValid(int x, int y) const
virtual int getNChannels() const
std::vector< float > cweights
multi-channel weights ('color')
float calcValue(int x, int y) const
Computes saturation or some other colour indicator.
Image< double > m_SFilter
std::ostream & print(std::ostream &os) const
float calcValue(int x, int y) const
Computes a scalar product between the multi-channel intensitis and the cweights vector.
std::shared_ptr< Sensor > sensor_ptr
virtual bool performUpdate()
bool isInputNormalized() const
dword getMappingID() const
float calcValue(int x, int y) const
Computes a scalar product between the multi-channel intensities and the cweights vector.
std::ostream & print(std::ostream &os) const
std::ostream & print(std::ostream &os) const
MahalSensor(const std::string &fname="")
std::ostream & print(std::ostream &os) const
float normalize()
normalizes the vector; returns old norm
std::vector< float > calcMValue(int x, int y) const
virtual float calcValue(int x, int y) const
Computes saturation or some other colour indicator.
void enableUpdate(dword udMask)
void setSource(sensor_ptr _source, float weight)
float calcValue(int x, int y) const
std::ostream & print(std::ostream &os) const
std::ostream & print(std::ostream &os) const
void setCovi(const DMatrix< float > &icov)
virtual bool performUpdate()
float calcValue(int x, int y) const
Computes a scalar product between the multi-channel intensities and the cweights vector.
const DMatrix< float > & getMean() const
void setMean(const DMatrix< float > &mean)
float calcValue(int x, int y) const
std::shared_ptr< const Sensor > sensor_cptr
float calcValue(int x, int y) const
void normalizeInput(bool doit=true)
float calcValue(int x, int y) const
Computes saturation or some other colour indicator.
std::vector< float > m_Param
float calcValue(int x, int y) const
Image< std::complex< double > > m_FFilter
virtual Sensor & assign(const Sensor &rhs)
MappingSensor(const std::string &mapn="")
virtual std::ostream & print(std::ostream &os) const
MT mulRight(const MT &rhs) const
DMatrix< T > & sqrt(DMatrix< T > &mat)