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

#include <SensorSet.h>

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

Public Member Functions

 CornerSensor ()
 
bool performUpdate ()
 
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
 
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 getNChannels () 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
 
- 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

curvature Sensor

Definition at line 202 of file SensorSet.h.

Constructor & Destructor Documentation

CornerSensor::CornerSensor ( )
inline

Definition at line 204 of file SensorSet.h.

References Sensor::enableUpdate(), Sensor::m_AddSkip, PPSensor::PP_FORCE, and Sensor::UPD_DATA.

205  {
208  m_AddSkip = 3;
209  };
int m_AddSkip
Definition: Sensor.h:183
void enableUpdate(dword udMask)
Definition: Sensor.h:113
void togglePP(enum PPState state=PP_DO)
Definition: Sensor.h:243

Member Function Documentation

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

Compute cornerness

Implements Sensor.

Definition at line 224 of file SensorSet.h.

References Sensor::isValid(), Point2D::normalize(), Sensor::source, Point2D::x, and Point2D::y.

224  {
225  if(!isValid(x,y)) return 0;
226  float value = source->getValue(x,y);
227  if(value==0) return 0;
228  Point c=source->getGradient(x,y);
229  Point ddx = source->getGradient(x+1,y)-c;
230  Point ddy = source->getGradient(x,y+1)-c;
231 //#define SS_GRADIENT_WEIGHTED_DETERMINANT
232 #ifdef SS_GRADIENT_WEIGHTED_DETERMINANT
233  float n1 = ddx.normalize();
234  float n2 = ddy.normalize();
235  float det = ddx.x*ddy.y-ddx.y*ddy.x;
236  det *= min(n1,n2);
237 #else
238  float det = ddx.x*ddy.y-ddx.y*ddy.x;
239 #endif
240  if(det<0) return 0; // repelling regions are no good
241  float ret=det*value;
242  return ret;
243 /* using eigenvalues
244 //cout << det;
245 //cout << ddx << endl << ddy << endl;
246 float p = (ddx.x+ddy.y)/2;
247 float d = sqrt(p*p-ddx.x*ddy.y+ddx.y*ddy.x);
248 //cout << "p=" << p << " d=" << d<<endl;
249 float e1 = p+d;
250 float e2 = p-d;
251 //cout << "e1="<<e1<<" e2="<<e2<<endl;
252 //cout << "---------------------" << endl;
253 return e1*e2;
254 */
255  }
float y
Definition: Point.h:224
bool isValid(int x, int y) const
Definition: Sensor.cpp:197
float normalize()
normalizes the vector; returns old norm
Definition: Point.h:175
Definition: Point.h:16
sensor_cptr source
Definition: Sensor.h:170
float x
Definition: Point.h:224
bool CornerSensor::performUpdate ( )
inlinevirtual

clear all data sheets

Reimplemented from PPSensor.

Definition at line 211 of file SensorSet.h.

References Sensor::isModified(), Sensor::m_AddSkip, Sensor::m_Skip, PPSensor::performUpdate(), Sensor::source, and Sensor::UPD_DATA.

211  {
212  if(isModified(UPD_DATA)) {
213  m_Skip = source->getSkip()+m_AddSkip;
214  }
215  return PPSensor::performUpdate();
216  }
bool isModified(dword mask=UPD_ALL) const
Definition: Sensor.h:108
int m_AddSkip
Definition: Sensor.h:183
virtual bool performUpdate()
Definition: Sensor.cpp:306
sensor_cptr source
Definition: Sensor.h:170
int m_Skip
Definition: Sensor.h:182
std::ostream& CornerSensor::print ( std::ostream &  os) const
inlinevirtual

Reimplemented from Sensor.

Definition at line 217 of file SensorSet.h.

References Sensor::print().

217  {
218  Sensor::print(os)
219  << "c";
220  return os;
221  }
virtual std::ostream & print(std::ostream &os) const
Definition: Sensor.cpp:213

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