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-04-07
Revision:
7:0df17f3078bc
Parent:
5:73cd58b58f95
Child:
9:3321170d157c

File content as of revision 7:0df17f3078bc:

#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();
    void setDelayMirrors(int); // in general, the delay will depend on the number of points being DISPLAYED (in other terms, on the size of lsdTrajectory).

    // DATA:
    vector <laserSensingPoint> lsdTrajectory;
    char displayColor;

    // software adjustement of mirror delay:
    int delayMirrorSamples; // this is required because it will affect the way the blob behaves - it could be in the laser renderer, but by putting it here we can have more per-blob fine tunning

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

#endif