Laser Sensing Display for UI interfaces in the real world

Dependencies:   mbed

Fork of skinGames_forktest by Alvaro Cassinelli

classLaserSensingTrajectory.h

Committer:
mbedalvaro
Date:
2012-03-31
Revision:
1:a4050fee11f7
Parent:
0:345b3bc7a0ea
Child:
4:f9d364f10335

File content as of revision 1:a4050fee11f7:

#ifndef LSDTRAJECTORY_H
#define LSDTRAJECTORY_H

#include <vector>
using namespace std;

// CONTRAST RATIO to compute autoThreshold:
#define MIN_CONTRAST_RATIO 1.3//2.4
#define THRESHOLD_FACTOR 0.5//0.75 // 2/3 or 1/2 are good values

struct laserSensingPoint {
    // Position and color (after rendering)
    int x, y; // position of the point (after rendering - its integer, because it is in "laser projector pixels")
//    char color; // laser color of the point (we will use the first three bits to set the RGB colors)
    // Detection:
    float intensity; // detected intensity
    int lightZone; // the thresholded light zone
};


class LaserSensingTrajectory  {

public:

    LaserSensingTrajectory();
    ~LaserSensingTrajectory();

    // METHODS:
    void processSensedData();

    // DATA:
    vector <laserSensingPoint> lsdTrajectory;
    char displayColor;
    
    // parameters for thresholding:
    float autoThreshold;

    // Statistics and tests:
    float maxI, minI;      // Max and Min intensity
    bool lightTouched;     // true if something went over the autoThreshold for the whole loop
};

#endif