kevin eccli
/
Freescale_CupV4
Adaptation K22F
Analyse.cpp@0:6004a7230f87, 2014-12-16 (annotated)
- Committer:
- singularity
- Date:
- Tue Dec 16 15:52:17 2014 +0000
- Revision:
- 0:6004a7230f87
Creation k22F
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
singularity | 0:6004a7230f87 | 1 | #include "Analyse.h" |
singularity | 0:6004a7230f87 | 2 | |
singularity | 0:6004a7230f87 | 3 | void seuil(unsigned short *v, bool *rslt, unsigned short seuil) |
singularity | 0:6004a7230f87 | 4 | { |
singularity | 0:6004a7230f87 | 5 | for(int i= 0;i<128;i++){ |
singularity | 0:6004a7230f87 | 6 | if(v[i]>seuil){ |
singularity | 0:6004a7230f87 | 7 | rslt[i]=true; |
singularity | 0:6004a7230f87 | 8 | }else{ |
singularity | 0:6004a7230f87 | 9 | rslt[i]=false; |
singularity | 0:6004a7230f87 | 10 | } |
singularity | 0:6004a7230f87 | 11 | } |
singularity | 0:6004a7230f87 | 12 | } |
singularity | 0:6004a7230f87 | 13 | |
singularity | 0:6004a7230f87 | 14 | //nbr doit etre impaire |
singularity | 0:6004a7230f87 | 15 | void moyenneGlissante(unsigned short *v, int nbr, unsigned short *rslt) |
singularity | 0:6004a7230f87 | 16 | { |
singularity | 0:6004a7230f87 | 17 | int i; |
singularity | 0:6004a7230f87 | 18 | int j = (nbr - 1)/2; |
singularity | 0:6004a7230f87 | 19 | |
singularity | 0:6004a7230f87 | 20 | //Generation du premier terme |
singularity | 0:6004a7230f87 | 21 | rslt[0] = (j+1)*v[0]; |
singularity | 0:6004a7230f87 | 22 | for( i = 1 ; i <= j ;i++) { |
singularity | 0:6004a7230f87 | 23 | rslt[0]+= v[j]; |
singularity | 0:6004a7230f87 | 24 | } |
singularity | 0:6004a7230f87 | 25 | |
singularity | 0:6004a7230f87 | 26 | |
singularity | 0:6004a7230f87 | 27 | //Generation des termes d'indice 1:j-1 |
singularity | 0:6004a7230f87 | 28 | for(i = 1 ; i < j ; i++) { |
singularity | 0:6004a7230f87 | 29 | rslt[i] = rslt[i-1] - v[0] + v[j + i]; |
singularity | 0:6004a7230f87 | 30 | } |
singularity | 0:6004a7230f87 | 31 | |
singularity | 0:6004a7230f87 | 32 | //Generation des termes d'indice j:NBR_PIXEL-nbr-1 |
singularity | 0:6004a7230f87 | 33 | |
singularity | 0:6004a7230f87 | 34 | for(i = j; i < NBR_PIXEL-nbr; i++) { |
singularity | 0:6004a7230f87 | 35 | rslt[i] = rslt[i-1] - v[i-j] + v[i+j]; |
singularity | 0:6004a7230f87 | 36 | } |
singularity | 0:6004a7230f87 | 37 | |
singularity | 0:6004a7230f87 | 38 | //Generation des termes d'indice NBR_PIXEL-nbr : 127 |
singularity | 0:6004a7230f87 | 39 | for(i = NBR_PIXEL-nbr; i < NBR_PIXEL-1; i++) { |
singularity | 0:6004a7230f87 | 40 | rslt[i] = rslt[i-1] - v[i-j] + v[NBR_PIXEL-1]; |
singularity | 0:6004a7230f87 | 41 | } |
singularity | 0:6004a7230f87 | 42 | |
singularity | 0:6004a7230f87 | 43 | } |