Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of scoreLight_Advanced by
classLaserSensingTrajectory.h@4:f9d364f10335, 2012-04-04 (annotated)
- Committer:
- mbedalvaro
- Date:
- Wed Apr 04 10:05:25 2012 +0000
- Revision:
- 4:f9d364f10335
- Parent:
- 1:a4050fee11f7
- Child:
- 5:73cd58b58f95
- the new optimized laser output buffer has not been tested, but it compiles; - I am commiting here, because I am planning to change the structure of the classes: soundSpot will not contain an object of type classLaserSensingTrajectory, but be a CHILD o...
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| mbedalvaro | 0:345b3bc7a0ea | 1 | #ifndef LSDTRAJECTORY_H |
| mbedalvaro | 0:345b3bc7a0ea | 2 | #define LSDTRAJECTORY_H |
| mbedalvaro | 0:345b3bc7a0ea | 3 | |
| mbedalvaro | 0:345b3bc7a0ea | 4 | #include <vector> |
| mbedalvaro | 0:345b3bc7a0ea | 5 | using namespace std; |
| mbedalvaro | 0:345b3bc7a0ea | 6 | |
| mbedalvaro | 0:345b3bc7a0ea | 7 | // CONTRAST RATIO to compute autoThreshold: |
| mbedalvaro | 0:345b3bc7a0ea | 8 | #define MIN_CONTRAST_RATIO 1.3//2.4 |
| mbedalvaro | 0:345b3bc7a0ea | 9 | #define THRESHOLD_FACTOR 0.5//0.75 // 2/3 or 1/2 are good values |
| mbedalvaro | 0:345b3bc7a0ea | 10 | |
| mbedalvaro | 0:345b3bc7a0ea | 11 | struct laserSensingPoint { |
| mbedalvaro | 0:345b3bc7a0ea | 12 | // Position and color (after rendering) |
| mbedalvaro | 0:345b3bc7a0ea | 13 | int x, y; // position of the point (after rendering - its integer, because it is in "laser projector pixels") |
| mbedalvaro | 1:a4050fee11f7 | 14 | // char color; // laser color of the point (we will use the first three bits to set the RGB colors) |
| mbedalvaro | 0:345b3bc7a0ea | 15 | // Detection: |
| mbedalvaro | 0:345b3bc7a0ea | 16 | float intensity; // detected intensity |
| mbedalvaro | 0:345b3bc7a0ea | 17 | int lightZone; // the thresholded light zone |
| mbedalvaro | 0:345b3bc7a0ea | 18 | }; |
| mbedalvaro | 0:345b3bc7a0ea | 19 | |
| mbedalvaro | 0:345b3bc7a0ea | 20 | |
| mbedalvaro | 0:345b3bc7a0ea | 21 | class LaserSensingTrajectory { |
| mbedalvaro | 0:345b3bc7a0ea | 22 | |
| mbedalvaro | 0:345b3bc7a0ea | 23 | public: |
| mbedalvaro | 0:345b3bc7a0ea | 24 | |
| mbedalvaro | 0:345b3bc7a0ea | 25 | LaserSensingTrajectory(); |
| mbedalvaro | 0:345b3bc7a0ea | 26 | ~LaserSensingTrajectory(); |
| mbedalvaro | 0:345b3bc7a0ea | 27 | |
| mbedalvaro | 0:345b3bc7a0ea | 28 | // METHODS: |
| mbedalvaro | 0:345b3bc7a0ea | 29 | void processSensedData(); |
| mbedalvaro | 4:f9d364f10335 | 30 | void setDelayMirrors(int); // in general, the delay will depend on the number of points being DISPLAYED (in other terms, on the size of lsdTrajectory). |
| mbedalvaro | 4:f9d364f10335 | 31 | |
| mbedalvaro | 0:345b3bc7a0ea | 32 | // DATA: |
| mbedalvaro | 0:345b3bc7a0ea | 33 | vector <laserSensingPoint> lsdTrajectory; |
| mbedalvaro | 0:345b3bc7a0ea | 34 | char displayColor; |
| mbedalvaro | 0:345b3bc7a0ea | 35 | |
| mbedalvaro | 4:f9d364f10335 | 36 | // software adjustement of mirror delay: |
| mbedalvaro | 4:f9d364f10335 | 37 | 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 |
| mbedalvaro | 4:f9d364f10335 | 38 | |
| mbedalvaro | 0:345b3bc7a0ea | 39 | // parameters for thresholding: |
| mbedalvaro | 0:345b3bc7a0ea | 40 | float autoThreshold; |
| mbedalvaro | 0:345b3bc7a0ea | 41 | |
| mbedalvaro | 0:345b3bc7a0ea | 42 | // Statistics and tests: |
| mbedalvaro | 0:345b3bc7a0ea | 43 | float maxI, minI; // Max and Min intensity |
| mbedalvaro | 0:345b3bc7a0ea | 44 | bool lightTouched; // true if something went over the autoThreshold for the whole loop |
| mbedalvaro | 0:345b3bc7a0ea | 45 | }; |
| mbedalvaro | 0:345b3bc7a0ea | 46 | |
| mbedalvaro | 0:345b3bc7a0ea | 47 | #endif |
| mbedalvaro | 0:345b3bc7a0ea | 48 | |
| mbedalvaro | 0:345b3bc7a0ea | 49 |
