Structural deformable models
Public Member Functions | Protected Member Functions | List of all members
CRSensor Class Reference

#include <SensorSet.h>

Inheritance diagram for CRSensor:
Inheritance graph
[legend]
Collaboration diagram for CRSensor:
Collaboration graph
[legend]

Public Member Functions

 CRSensor ()
 
int getNChannels () const
 
std::ostream & print (std::ostream &os) const
 
- Public Member Functions inherited from PPSensor
 PPSensor ()
 
virtual float getValue (int x, int y) const
 
virtual Point getGradient (int x, int y) const
 
virtual bool performUpdate ()
 
Sensorassign (const Sensor &rhs)
 
void togglePP (enum PPState state=PP_DO)
 
dword getPPState () const
 
- Public Member Functions inherited from Sensor
virtual ~Sensor ()
 
sensor_cptr getSource ()
 
virtual void changeSource (sensor_cptr _source)
 
void replaceBy (sensor_ptr target)
 
bool assignRef (sensor_cptr rhs)
 
float getValue (const Point &p) const
 get value at position p using nearest neighbour interpolation More...
 
virtual std::vector< float > getMValue (int x, int y) const
 get multi-channel value More...
 
Point2D getGradient (const Point2D &p) const
 get gradient at position p using nearest neighbor interpolation More...
 
float getMax () const
 
float getMin () const
 
float getMinMaxRange () const
 
float getWeightedValue (int x, int y) const
 get max normalized value at discrete position range [0,1] More...
 
Point2D getWeightedGradient (int x, int y) const
 get range weighted gradient at discrete position More...
 
void setCWeights (const std::vector< float > &weights)
 
const std::vector< float > & getCWeights () const
 
void setDirection (const Point &dir)
 
const PointgetDirection () const
 
void setScale (float _scale)
 
float getScale () const
 
bool isModified (dword mask=UPD_ALL) const
 
void setModified (dword mask=UPD_ALL)
 
void unsetModified (dword mask=UPD_ALL)
 
bool isUpdate (dword udMask) const
 
void enableUpdate (dword udMask)
 
void disableUpdate (dword udMask)
 
virtual int getDim1Size () const
 
virtual int getDim2Size () const
 
virtual int getDim3Size () const
 
virtual int getSkip () const
 
bool isValid (int x, int y) const
 
virtual Image< float > createSensorImage () const
 
const std::string & getID () const
 
void setID (const std::string &id)
 
virtual std::ostream & hprint (std::ostream &os, SensorCollection *sc) const
 
void refSuperSensor (sensor_ptr super)
 
void unrefSuperSensor (sensor_ptr super)
 
void invalidateSource ()
 
template<typename Derived >
std::shared_ptr< Derived > shared_from_base ()
 

Protected Member Functions

float calcValue (int x, int y) const
 Computes saturation or some other colour indicator. More...
 
- Protected Member Functions inherited from PPSensor
void fitSheets ()
 
virtual void calcAllValues ()
 
virtual void calcAllGradients ()
 
- Protected Member Functions inherited from Sensor
 Sensor (dword updateMask)
 
 Sensor ()
 
virtual std::vector< float > calcMValue (int x, int y) const
 
virtual Point calcGradient (int x, int y) const
 
virtual void calcMinMax ()
 

Additional Inherited Members

- Public Types inherited from PPSensor
enum  PPState { PP_DONT =0, PP_DO, PP_FORCE }
 
- Public Types inherited from Sensor
enum  UpdateParam {
  UPD_NOTHING =0, UPD_DATA =1, UPD_SCALE =2, UPD_CWEIGHTS =4,
  UPD_DIR =8, UPD_MINMAX =16, UPD_LAST =32, UPD_ALL =0xffffffff
}
 
- Static Public Member Functions inherited from Sensor
static dword getStringNumber (const char *sid)
 
static void getNumberString (char sid[5], dword id)
 
- Protected Attributes inherited from PPSensor
Image< float > values
 caching sheet for sensed values More...
 
Image< Pointgradients
 caching sheet for gradients More...
 
dword doPP
 do preprocessing? More...
 
- Protected Attributes inherited from Sensor
sensor_cptr source
 
float scale
 
std::vector< float > cweights
 multi-channel weights ('color') More...
 
Point dir
 direction parameter More...
 
float maxval
 
float minval
 overall minimum and maximum More...
 
float mean
 
float stdev
 overall mean and stdev More...
 
dword toupdate
 bitflag for updates More...
 
dword updateMask
 bitflag to mask unimportant updates More...
 
std::string m_ID
 
int m_Skip
 
int m_AddSkip
 

Detailed Description

Multi-chrominance Sensor

Definition at line 102 of file SensorSet.h.

Constructor & Destructor Documentation

CRSensor::CRSensor ( )
inline

Definition at line 104 of file SensorSet.h.

References Sensor::m_AddSkip.

105  { m_AddSkip = 1; }
int m_AddSkip
Definition: Sensor.h:183

Member Function Documentation

float CRSensor::calcValue ( int  x,
int  y 
) const
inlineprotectedvirtual

Computes saturation or some other colour indicator.

Implements Sensor.

Definition at line 114 of file SensorSet.h.

References Sensor::source, and dmutil::sqrt().

114  {
115  float result = 0.0f;
116  std::vector<float> mv = source->getMValue(x,y);
117 #define SATURATION
118 #ifdef CHROMITHING
119  float g = 0;
120  for(std::vector<float>::const_iterator v=mv.begin();
121  v != mv.end(); v++)
122  g+=*v;
123  g/=mv.size();
124  for(std::vector<float>::const_iterator v=mv.begin();
125  v != mv.end(); v++)
126  {
127  register float d = g-*v;
128  result += d*d;
129  }
130  return sqrt(result);
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();
135  v != mv.end(); v++)
136  {
137  if(*v>ma) ma = *v;
138  if(*v<mi) mi = *v;
139  }
140  return ma>0.00001 ? (ma-mi)/ma : 0;
141 #endif
142 
143 #undef SATURATION
144 #undef CHROMITHING
145  }
sensor_cptr source
Definition: Sensor.h:170
DMatrix< T > & sqrt(DMatrix< T > &mat)
Definition: DMatrixUtil.h:81
int CRSensor::getNChannels ( ) const
inlinevirtual

Reimplemented from Sensor.

Definition at line 106 of file SensorSet.h.

106 { return 1; }
std::ostream& CRSensor::print ( std::ostream &  os) const
inlinevirtual

Reimplemented from Sensor.

Definition at line 107 of file SensorSet.h.

References Sensor::print().

107  {
108  Sensor::print(os)
109  << "r";
110  return os;
111  }
virtual std::ostream & print(std::ostream &os) const
Definition: Sensor.cpp:213

The documentation for this class was generated from the following file: