-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcontrastePoisson.cpp
More file actions
executable file
·66 lines (50 loc) · 1.51 KB
/
contrastePoisson.cpp
File metadata and controls
executable file
·66 lines (50 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "poisson.h"
const byte OBSCUR = 50; // Seuil d'intensite des pixels dont on change le gradient
const float FACTEUR = 3.0f; // Facteur de multiplication du gradient
// Rehausse le gradient des pixels sombres, et montre en rouge ces pixels.
void masque(const Image<float> &I, Image<float> &Vx, Image<float> &Vy) {
for (int i=0; i<I.width() ; i++){
for (int j=0 ; j<I.height() ; j++){
if (I(i,j)<OBSCUR){
Vx(i,j)*=FACTEUR;
Vy(i,j)*=FACTEUR;
drawPoint(i,j,RED);
}
}
}
}
int main(int argc, char *argv[]) {
Image<byte> I;
Image<float> Vx, Vy;
if (!load(I, argc > 1 ? argv[1] : srcPath("salon.png"))) {
cout << "Echec de lecture d'image" << endl;
return 1;
}
openWindow(I.width(), I.height());
display(I);
click();
cout << "Contraste simple" << endl;
affiche(I);
gradient(I, Vx, Vy);
click();
cout << "Dérivée selon x par la fonction gradient" <<endl;
affiche(Vx);
click();
cout << "Dérivée selon y par la fonction gradient" <<endl;
affiche(Vy);
click();
Image<float> F = dx(I);
cout << "Dérivée selon x par la fonction dx" <<endl;
affiche(F);
click();
Image<float> U= dy(I);
cout << "Dérivée selon y par la fonction dy" <<endl;
affiche(U);
click();
masque(I,F,U);
Image<float> z = poisson(F,U);
cout << "Image reconstruite par poisson" <<endl;
affiche(z);
endGraphics();
return 0;
}