-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScilab_Interactive_Project.sce
More file actions
3346 lines (2769 loc) · 125 KB
/
Scilab_Interactive_Project.sce
File metadata and controls
3346 lines (2769 loc) · 125 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//Configuration de la fenêtre
global f;
global handles;
handles = struct();
f = figure('figure_position', [496, 145], 'figure_size', [1200, 800], 'auto_resize', 'on', 'resize', 'off', ...
'background', [34], 'figure_name', 'Figure n°%d', 'dockable', 'off', 'infobar_visible', 'off', ...
'toolbar_visible', 'off', 'menubar_visible', 'off', 'default_axes', 'on', 'visible', 'off');
f.visible = "on";
global chemin_dossier_menu;
// ON DOIT DABORD RECCUPERER LE CHEMIN VERS LE DOSSIER CONTENANT TOUTES LES IMAGES POUR LE MENU
// CAR SCILAB EST LIMITE ET ACCEPTE PAS LES CHMEIN RELATIF
global chemin_dossier_menu_edit;
//Texte indiquant à l'utilisateur d'entrer le chemin du dossier 'image_menu'
texte_chemin_doss_menu= uicontrol(f,'unit', 'normalized', ...
"Style", "text", ...
"Position", [0.2, 0.8, 0.6, 0.05], ...
"BackgroundColor", [1, 1, 1], ...
"foreground", [1,0,0],...
'FontWeight', 'bold', ...
"FontSize", 15, ...
"String", "ENTREZ LE CHEMIN JUSQU AU DOSSIER || image_menu ||",...
'Visible', 'on');
//Edit pour entrer le chemin du dossier
chemin_dossier_menu_edit = uicontrol(f,'unit', 'normalized', ...
"Style", "edit", ...
"Position", [0.2, 0.75, 0.6, 0.05], ...
"FontSize", 12, ...
"BackgroundColor", [1, 1, 1], ...
"String", "", ...
"Callback", 'enr_chemin_dossier_menu',...
'Visible', 'on');
//bouton "Enregistrer" pour valider et activer la fonction menu_home_callback
enregistrer_chemin_menu= uicontrol(f, 'unit', 'normalized', ...
"Style", "pushbutton", ...
"Position", [0.2, 0.7, 0.2, 0.05], ...
"FontSize", 12, ...
"BackgroundColor", [0.5, 0.5, 0.5], ...
"String", "Enregistrer", ...
"Callback", 'enregistrer_et_activer_callback',...
'Visible', 'on');
//Fonction pour récupérer le chemin entré dans le champ edit
function enr_chemin_dossier_menu()
global chemin_dossier_menu;
chemin_dossier_menu = get(chemin_dossier_menu_edit, 'String');
//affichage du chemin
disp("Chemin du dossier || images_menu || : " + chemin_dossier_menu);
endfunction
//Fonction du bouton "Enregistrer" pour enregistrer le chemin et activer la fonction menu_home_callback
function enregistrer_et_activer_callback(handles)
// Sauvegarder le chemin d'abord
enr_chemin_dossier_menu();
//appel du menu home
menu_home_callback();
endfunction
//-------------------------------------------------------------------------------//
function menu_home_callback(handles)
global chemin_dossier_menu;
global global chemin_dossier_menu;
delete("all");
//Boutons Commencer et Quitter
handles.btn_commencer = uicontrol(f, 'unit', 'normalized', ...
'ForegroundColor', [0, 0.7, 0], ...
'FontSize', 26, ...
'FontWeight', 'bold', ...
'String', 'COMMENCER', ...
'Position', [0.35, 0.17, 0.3, 0.1], ...
'Callback', 'btn_menu1_callback(handles)', ...
'Tag', 'btn_commencer', ...
'Visible', 'on');
handles.btn_quitter = uicontrol(f, 'unit', 'normalized', ...
'ForegroundColor', [1, 0, 0], ...
'FontSize', 26, ...
'FontWeight', 'bold', ...
'String', 'QUITTER', ...
'Position', [0.35, 0.04, 0.3, 0.1], ...
'Callback', 'btn_quitter_callback()', ...
'Tag', 'btn_quitter', ...
'Visible', 'on');
//-------------------------------------------------------------------------------//
//Initialisation de l'axe d'affichage pour les images
handles.axes = newaxes();
handles.axes.margins = [0, 0, 0, 0];
handles.axes.axes_bounds = [0, 0.0, 1, 1];
handles.axes.auto_clear = 'on';
f.visible = "on";
chemin_img_menu= chemin_dossier_menu + filesep() + "menu_traitement_image1.png";
img_menuHome =imread(chemin_img_menu);
imshow(img_menuHome);
endfunction
//-------------------------------------------------------------------------------//
function btn_aide_callback(handles)
global f;
delete("all");
//Texte d'aide en HTML avec mise en forme
texte_aide = "<html>" + ...
"<h2 style=font-size:16px;>Guide d Utilisation</h2>" + ...
"<p>Bienvenue sur mon application de traitement d image interactif,<br> " + ...
"grâce aux différents boutons et flèches, vous pouvez naviguer entre les différents traitements disponibles.<br> " + ...
"Dans ce menu d aide, vous allez pouvoir consulter une description des fonctions disponibles ainsi que la manière de les utiliser.</p><br>" + ...
"<p><b><span style=color:red;>1. Afficher Image</span></b> (<b>Permet d afficher une image sélectionnée</b>).<br>" + ...
"<i><span style=color:blue;>Comment utiliser la fonction de traitement</span></i><br>" + ...
" - Choisir une image.<br>" + ...
" - Cliquez sur Montrer Image.</p>" + ...
"<p><b><span style=color:red;>2. Agrandir Image</span></b> (<b>Permet de redimensionner une image en modifiant son échelle</b>).<br>" + ...
"<i><span style=color:blue;>Comment utiliser la fonction de traitement</span></i><br>" + ...
" - Choisir une image.<br>" + ...
" - Ajuster la valeur dans le champ (haut/bas).<br>" + ...
" - Cliquez sur Agrandir Image.</p>" + ...
"<p><b><span style=color:red;>3. Histogramme</span></b> (<b>Génère et affiche l histogramme d une image</b>).<br>" + ...
"<i><span style=color:blue;>Comment utiliser la fonction de traitement</span></i><br>" + ...
" - Affiche l histogramme de l image.<br>" + ...
" - Produit également un histogramme égalisé et l image égalisée.<br>" + ...
" - Cliquez sur Lancer pour appliquer<br>" + ...
" - Attendez que le traitement se fasse tant que le message ||Traitement en cours || est affiché veuillez ne pas relancer .</p>" + ...
"<p><b><span style=color:red;>4. Seuillage</span></b> (<b>Applique un seuil sur les pixels d une image</b>).<br>" + ...
"<i><span style=color:blue;>Comment utiliser la fonction de traitement</span></i><br>" + ...
" - Choisir une image.<br>" + ...
" - Régler le seuil avec le slider.<br>" + ...
" - Cliquez sur Seuillage Image.</p>" + ...
" - Attendez que le traitement se fasse tant que le message ||Traitement en cours || est affiché veuillez ne pas relancer .</p>" + ...
"<p><b><span style=color:red;>5. Multiplication Image</span></b> (<b>Multiplie les valeurs des pixels d une image par un facteur donné</b>).<br>" + ...
"<i><span style=color:blue;>Comment utiliser la fonction de traitement</span></i><br>" + ...
" - Choisir une image.<br>" + ...
" - Régler la valeur de multiplication avec le slider.<br>" + ...
" - L image est multipliée AUTOMATIQUEMENT EN TEMPS REEL en fonction du slider.</p>" + ...
"<p><b><span style=color:red;>6. 7. Additionner/Soustraire Image</span></b> (<b>Effectue une addition ou une soustraction entre deux images</b>).<br>" + ...
"<i><span style=color:blue;>Comment utiliser la fonction de traitement</span></i><br>" + ...
" - Sélectionner deux images.<br>" + ...
" - Cliquez sur Lancer pour appliquer l opération choisie.</p>" + ...
"<p><b><span style=color:red;>8. Rotation Image</span></b> (<b>Permet de faire pivoter une image d un certain angle</b>).<br>" + ...
"<i><span style=color:blue;>Comment utiliser la fonction de traitement</span></i><br>" + ...
" - Choisir une image.<br>" + ...
" - Ajuster l angle avec le slider.<br>" + ...
" - Cliquez sur Rotation Image.</p>" + ...
" - Attendez que le traitement se fasse tant que le message ||Traitement en cours || est affiché veuillez ne pas relancer .</p>" + ...
"<p><b><span style=color:red;>9. Inverser Couleurs</span></b> (<b>Inverse les couleurs d une image</b>).<br>" + ...
"<i><span style=color:blue;>Comment utiliser la fonction de traitement</span></i><br>" + ...
" - Inverse les couleurs de l image choisie après clic.</p>" + ...
"<p><b><span style=color:red;>10. Symétrie Image</span></b> (<b>Applique une symétrie horizontale, verticale, ou autre à une image</b>).<br>" + ...
"<i><span style=color:blue;>Comment utiliser la fonction de traitement</span></i><br>" + ...
" - Choisir une image.<br>" + ...
" - Sélectionner une méthode de symétrie (menu déroulant).<br>" + ...
" - Cliquez sur Symétrie Image.</p>" + ...
"<p><b><span style=color:red;>11. Filtre Passe-Bas</span></b> (<b>Applique un filtre passe-bas pour lisser l image</b>).<br>" + ...
"<i><span style=color:blue;>Comment utiliser la fonction de traitement</span></i><br>" + ...
" - Choisir une image.<br>" + ...
" - Sélectionner une méthode de filtre (menu déroulant).<br>" + ...
"<ul>" + ...
" <li><b>Bruit Gaussien :</b> Ajoute un bruit aléatoire à l image .</li>" + ...
" <li><b>Bruit Sel & Poivre :</b> Ajoute des pixels noirs et blancs aléatoires à l image</li>" + ...
" <li><b>Filtre Moyenneur :</b> Applique une moyenne locale sur une région de 3x3 pixels réduisant le bruit de haute fréquence.</li>" + ...
" <li><b>Filtre Médian :</b> Remplace chaque pixel par la valeur médiane de son voisinage</li>" + ...
" <li><b>Filtre Gaussien :</b> Applique une convolution avec une matrice gaussienne pour lisser l image</li>" + ...
"</ul>"+ ...
" - Cliquez sur Lancer pour appliquer un filtre passe-bas à l image.</p>" + ...
"<p><b><span style=color:red;>12. Filtre Passe-Haut</span></b> (<b>Applique un filtre passe-haut pour accentuer les détails de l image</b>).<br>" + ...
"<i><span style=color:blue;>Comment utiliser la fonction de traitement</span></i><br>" + ...
" - Choisir une image.<br>" + ...
" - Sélectionner une méthode de filtre (menu déroulant).<br>" + ...
"<ul>" + ...
" <li><b>Filtre Laplacien-4 :</b> Met en évidence les contours grace a Laplacien avec 4 voisins.</li>" + ...
" <li><b>Filtre Laplacien-8 :</b> Accentue les contours avec un opérateur Laplacien prenant 8 voisins.</li>" + ...
" <li><b>Filtre Sobel Vertical :</b> Détecte les contours verticaux dans l image.</li>" + ...
" <li><b>Filtre Sobel Horizontal :</b> Met en évidence les contours horizontaux.</li>" + ...
" <li><b>Module du Gradient Sobel :</b> Combine les résultats des filtres Sobel pour détecter les contours dans toutes les directions.</li>" + ...
"</ul>" + ...
" - Cliquez sur Lancer pour appliquer un filtre passe-haut à l image.</p>" + ...
"<p><b><span style=color:red;>12. Filtre Couleur Personnalisé</span></b> " + ...
"(<b>Applique des modifications aux canaux de couleur rouge, vert et bleu</b>).<br>" + ...
"<i><span style=color:blue;>Comment utiliser la fonction de traitement</span></i><br>" + ...
" - Choisir une image.<br>" + ...
" - Sélectionner un type de filtre (menu déroulant).<br>" + ...
" - Cochez les cases Rouge, Vert ou Bleu pour spécifier les canaux.<br>" + ...
" - L effet est alors appliqué AUTOMATIQUEMENT EN TEMPS REEL.</p>" + ...
"<p>Les options disponibles incluent :</p>" + ...
"<ul>" + ...
" <li><b>Filtre Couleur Monochrome :</b> Désactive les autres canaux pour conserver une seule couleur.</li>" + ...
" <li><b>Filtre Teinte Couleur :</b> Remplace un canal par la couleur maximale.</li>" + ...
" <li><b>Filtre Amplification :</b> Multiplie l intensité d un canal (limité à 255).</li>" + ...
" <li><b>Filtre Suppression :</b> Éteint totalement un ou plusieurs canaux.</li>" + ...
" <li><b>Filtre Normalisation :</b> Redistribue les couleurs activées de façon proportionnelle.</li>" + ...
"</ul>" + ...
"</html>";
//Ajoute le texte d'aide dans la figure
uicontrol(f, 'Style', 'text', ...
'String', texte_aide, ...
'HorizontalAlignment', 'left', ...
'Units', 'normalized', ...
'Position', [0, 0, 1, 1], ...
'BackgroundColor', [1, 1, 1], ...
'FontSize', 14);
handles.btn_retour= uicontrol(f, 'unit', 'normalized', ...
'Style', 'pushbutton', ...
'String', 'Retour', ...
'Position', [0.80, 0.95, 0.1, 0.05], ...
'FontSize', 18, ...
'Background', [0.5,0.5,0.5], ...
'ForegroundColor', [236/255, 209/255, 19/255], ...
'Callback', 'btn_menu1_callback(handles)'); // Appelle la fonction 'menu' lorsque cliqué
// Bouton Retour en bas
handles.btn_retour2= uicontrol(f, 'unit', 'normalized', ...
'Style', 'pushbutton', ...
'String', 'Retour', ...
'Position', [0.80, 0.05, 0.1, 0.05], ...
'FontSize', 18, ...
'Background', [0.5,0.5,0.5], ...
'ForegroundColor', [236/255, 209/255, 19/255], ...
'Callback', 'btn_menu1_callback(handles)');
endfunction
function fn_bout_aide(f)
//Création du bouton aide
handles.btn_aide = uicontrol(f, 'unit', 'normalized', ...
'String', "Aide ?", ...
'FontWeight', 'bold', ...
'Position', [0.90, 0.80, 0.08, 0.05], ...
'Style', 'pushbutton', ...
'Callback', 'btn_aide_callback()', ...
'Visible', 'on', ...
'Background', [134/255,118/255,181/255], ...
'FontSize', 18, ...
'ForegroundColor', [236/255, 209/255, 19/255], ...
'HorizontalAlignment', 'center');
endfunction
//-------------------------------------------------------------------------------//
global handles axe_image1 axis_image2;
//Fonction pour afficher le fond de l'interface
function afficher_background_image(image_path)
axes_background = newaxes();
axes_background.margins = [0, 0, 0, 0];
axes_background.axes_bounds = [0, 0, 1, 1];
axes_background.auto_clear = 'on';
img_menu = imread(image_path);
imshow(img_menu);
endfunction
//-------------------------------------------------------------------------------//
//Boutons à afficher après "Commencer"
function btn_menu1_callback(handles)
global f;
global chemin_dossier_menu;
delete("all"); //Supprimer tous les éléments graphiques de lancienne page
chemin_img_menu= chemin_dossier_menu + filesep() + "menu_traitement_image2.png";
afficher_background_image(chemin_img_menu);
texte = "<html>Afficher<br>"+"Image";
handles.btn_afficher_image = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.12, 0.01, 0.12, 0.1], ...
'Callback', 'btn_afficher_image_callback(handles)', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
texte = "<html>Agrandir<br>"+"Image";
handles.btn_agrandir_image = uicontrol(f, 'unit', 'normalized', ...
'String',texte, ...
'Position', [0.26, 0.01, 0.12, 0.1], ...
'Callback', 'btn_agrandir_image_callback(handles)', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
texte = "<html>Histogramme<br>"+"Image";
handles.btn_histogramme = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position',[0.40, 0.01, 0.12, 0.1], ...
'Callback', 'btn_histogramme_callback(handles)', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
texte = "<html>Seuillage<br>"+"Image";
handles.btn_seuillage = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.54, 0.01, 0.12, 0.1], ...
'Callback', 'btn_seuillage_callback(handles)', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
texte = "<html>Multiplication<br>"+"Image";
handles.btn_multiplication_image = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.68, 0.01, 0.12, 0.1], ...
'Callback', 'btn_multiplication_image_callback(handles)', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
// Nouveau bouton "<-" pour retourner à btn_menu3_callback
handles.btn_back = uicontrol(f, 'unit', 'normalized', ...
'String', "<-", ...
'Position', [0.05, 0.01, 0.06, 0.11], ...
'Style', 'pushbutton', ...
'Callback', 'btn_menu3_callback(handles)', ...
'Visible', 'on', ...
'Background', [28/255, 54/255, 84/255], ...
'FontSize', 30, ...
'ForegroundColor', [1, 1, 1], ...
'HorizontalAlignment', 'center');
//bouton "->" pour le menu supplémentaire
handles.btn_next = uicontrol(f, 'unit', 'normalized', ...
'String', '->', ...
'Position', [0.85, 0.01, 0.06, 0.1], ...
'Callback', 'btn_menu2_callback(handles)', ...
'Visible', 'on',...
'Background' , [28/255, 54/255, 84/255], ...
'FontSize', 30,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
fn_bout_aide(f);
endfunction
//Bouton pour Quitter
function btn_quitter_callback()
close(f);
endfunction
//-------------------------------------------------------------------------------//
//---------------------------- !!! MENU 1 !!!------------------------------------//
//-------------------------------------------------------------------------------//
//Bouton qui sera appeler pour le menu traitement ' Afficher Image'
function btn_afficher_image_callback(handles)
global f;
global chemin_dossier_menu;
delete("all"); //Supprimer tous les éléments graphiques de lancienne page
chemin_img_menu= chemin_dossier_menu + filesep() + "menu_traitement_image4.png";
afficher_background_image(chemin_img_menu);
// Boutons specifiques à Afficher Image
texte = "<html>Choisir<br>"+"Image";
handles.btn_choisir_image = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.05, 0.01, 0.15, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_choisir_image_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
texte = "<html>Montrer<br>"+"Image";
handles.btn_lancer_afficher_image = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.22, 0.01, 0.15, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_lancer_afficher_image_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[0, 0.9 ,0],...
'HorizontalAlignment', 'center');
texte = "<html>Agrandir<br>"+"Image";
handles.btn_agrandir_image = uicontrol(f, 'unit', 'normalized', ...
'String',texte, ...
'Position', [0.50, 0.01, 0.1, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_agrandir_image_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
texte = "<html>Histogramme<br>"+"Image";
handles.btn_histogramme = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.61, 0.01, 0.1, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_histogramme_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
texte = "<html>Seuillage<br>"+"Image";
handles.btn_seuillage = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.72, 0.01, 0.1, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_seuillage_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
texte = "<html>Multiplication<br>"+"Image";
handles.btn_multiplication_image = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.83, 0.01, 0.1, 0.11], ...
'Style', 'pushbutton', ...
'Callback', 'btn_multiplication_image_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
//bouton "<-" pour retourner à btn_menu3_callback
handles.btn_back = uicontrol(f, 'unit', 'normalized', ...
'String', "<-", ...
'Position', [0.44, 0.01, 0.06, 0.11], ...
'Style', 'pushbutton', ...
'Callback', 'btn_menu3_callback(handles)', ...
'Visible', 'on', ...
'Background', [28/255, 54/255, 84/255], ...
'FontSize', 30, ...
'ForegroundColor', [1, 1, 1], ...
'HorizontalAlignment', 'center');
//bouton "->" pour aller à btn_menu2_callback
handles.btn_next = uicontrol(f, 'unit', 'normalized', ...
'String', '->', ...
'Position', [0.94, 0.01, 0.06, 0.11], ...
'Callback', 'btn_menu2_callback(handles)', ...
'Visible', 'on',...
'Background' , [28/255,54/255,84/255],...
'FontSize', 30,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
fn_bout_aide(f);
endfunction
//-------------------------------------------------------------------------------//
//Bouton qui sera appeler pour le menu traitement ' Agrandir Image'
global valeur_agrandissement;
function btn_agrandir_image_callback(handles)
global f;
global chemin_dossier_menu;
global handles;
delete("all");
// Initialisation de valeur_agrandissement pour eviter le probleme de tampon
valeur_agrandissement = 0;
chemin_img_menu= chemin_dossier_menu + filesep() + "menu_traitement_image2.png";
afficher_background_image(chemin_img_menu);
// Boutons specifiques à Agrandir Image
texte = "<html>Choisir<br>"+"Image";
handles.btn_choisir_image = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.05, 0.01, 0.15, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_choisir_image_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
texte = "<html>Lancer<br>"+"Agrandir<br>"+"Image";
handles.btn_lancer_agrandir_image = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.22, 0.01, 0.15, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_lancer_agrandir_image_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[0, 0.9 ,0],..
'HorizontalAlignment', 'center');
texte = "<html>Afficher<br>"+"Image";
handles.btn_afficher_image = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.50, 0.01, 0.1, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_afficher_image_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
texte = "<html>Histogramme<br>"+"Image";
handles.btn_histogramme = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.61, 0.01, 0.1, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_histogramme_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
texte = "<html>Seuillage<br>"+"Image";
handles.btn_seuillage = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.72, 0.01, 0.1, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_seuillage_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
texte = "<html>Multiplication<br>"+"Image";
handles.btn_multiplication_image = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.83, 0.01, 0.1, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_multiplication_image_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
handles.btn_back = uicontrol(f, 'unit', 'normalized', ...
'String', "<-", ...
'Position', [0.44, 0.01, 0.06, 0.11], ...
'Style', 'pushbutton', ...
'Callback', 'btn_menu3_callback(handles)', ...
'Visible', 'on', ...
'Background', [28/255, 54/255, 84/255], ...
'FontSize', 30, ...
'ForegroundColor', [1, 1, 1], ...
'HorizontalAlignment', 'center');
handles.btn_next = uicontrol(f, 'unit', 'normalized', ...
'String', '->', ...
'Position', [0.94, 0.01, 0.06, 0.11], ...
'Callback', 'btn_menu2_callback(handles)', ...
'Visible', 'on',...
'Background' , [28/255,54/255,84/255],...
'FontSize', 30,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
handles.spinner_agrandissement = uicontrol(f, ...
'unit', 'normalized', ...
'BackgroundColor', [0.8, 0.8, 0.8], ...
'Enable', 'on', ...
'FontName', 'Tahoma', ...
'FontSize', 12, ...
'ForegroundColor', [0, 0, 0], ...
'HorizontalAlignment', 'left', ...
'Max', 15, ...
'Min', 1, ...
'Position', [0.26, 0.17, 0.05, 0.05], ...
'Relief', 'default', ...
'SliderStep', [1, 1], ... // pas de 1
'Style', 'spinner', ...
'Value', 0, ...
'Tag', 'spinner_aggrandissement', ...
'Callback', 'spinner_agrandissement_callback(handles);');
//Pour Affichage de la valeur actuelle du slider dans le champ texte
handles.spinner_agrandissement_value_text = uicontrol(f, ...
'Style', 'text', ...
'unit', 'normalized', ...
'FontSize', 13, ...
'FontWeight', 'bold', ...
'Position', [0.32, 0.17, 0.05, 0.05], ...
'Background', [108/255 , 146/255, 204/255], ..
'String', '0', ...
'ForegroundColor', [1, 0, 0]); // Texte en rouge
//Texte au-dessus du slider pour indiquer les instructions
handles.spinner_agrandissement_instruction_text = uicontrol(f, ...
'Style', 'text', ...
'unit', 'normalized', ...
'FontSize', 14, ...
'FontWeight', 'bold', ...
'ForegroundColor', [0.7, 0, 0.7], ...
'Background', [98/255 , 152/255, 209/255], ...
'Position', [0.105, 0.23, 0.222, 0.05], ...
'String', 'Choisissez le niveau dagrandissement');
fn_bout_aide(f);
endfunction
// fonction qui permet de reccuperer la valeur du spinner
function spinner_agrandissement_callback(handles)
global handles;
global valeur_agrandissement;
valeur_agrandissement = get(handles.spinner_agrandissement, 'Value'); //Récupérer la valeur du slider
set(handles.spinner_agrandissement_value_text, 'String', msprintf("%d", valeur_agrandissement)); //Pour mettre à jour le champ texte
endfunction
//-------------------------------------------------------------------------------//
//Bouton qui sera appeler pour le menu traitement ' Histogramme Image'
function btn_histogramme_callback(handles)
global f;
global chemin_dossier_menu;
delete("all"); //Supprimer tous les éléments graphiques de lancienne page
chemin_img_menu= chemin_dossier_menu + filesep() + "menu_traitement_image5.png";
afficher_background_image(chemin_img_menu);
// Boutons specifiques
texte = "<html>Choisir<br>"+"Image";
handles.btn_choisir_image = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.05, 0.01, 0.15, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_choisir_image_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
texte = "<html>Lancer<br>"+"Histogramme";
handles.btn_lancer_histogramme = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.22, 0.01, 0.15, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_lancer_histogramme_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[0, 0.9 ,0],..
'HorizontalAlignment', 'center');
texte = "<html>Afficher<br>"+"Image";
handles.btn_afficher_image = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.50, 0.01, 0.1, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_afficher_image_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
texte = "<html>Agrandir<br>"+"Image";
handles.btn_agrandir_image = uicontrol(f, 'unit', 'normalized', ...
'String',texte, ...
'Position', [0.61, 0.01, 0.1, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_agrandir_image_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
texte = "<html>Seuillage<br>"+"Image";
handles.btn_seuillage = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.72, 0.01, 0.1, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_seuillage_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
texte = "<html>Multiplication<br>"+"Image";
handles.btn_multiplication_image = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.83, 0.01, 0.1, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_multiplication_image_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
handles.btn_back = uicontrol(f, 'unit', 'normalized', ...
'String', "<-", ...
'Position', [0.44, 0.01, 0.06, 0.10], ...
'Style', 'pushbutton', ...
'Callback', 'btn_menu3_callback(handles)', ...
'Visible', 'on', ...
'Background', [28/255, 54/255, 84/255], ...
'FontSize', 30, ...
'ForegroundColor', [1, 1, 1], ...
'HorizontalAlignment', 'center');
handles.btn_next = uicontrol(f, 'unit', 'normalized', ...
'String', '->', ...
'Position', [0.94, 0.01, 0.06, 0.10], ...
'Callback', 'btn_menu2_callback(handles)', ...
'Visible', 'on',...
'Background' , [28/255,54/255,84/255],...
'FontSize', 30,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
fn_bout_aide(f);
endfunction
//-------------------------------------------------------------------------------//
//Bouton qui sera appeler pour le menu traitement ' Seuillage Image'
global valeur_seuil;
function btn_seuillage_callback(handles)
global f;
global handles;
global chemin_dossier_menu;
delete("all");
//Initialisation de valeur_seuil pour eviter le problème de tampon
valeur_seuil = 0;
chemin_img_menu= chemin_dossier_menu + filesep() + "menu_traitement_image2.png";
afficher_background_image(chemin_img_menu);
//Boutons specifiques
texte = "<html>Choisir<br>"+"Image";
handles.btn_choisir_image = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.05, 0.01, 0.15, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_choisir_image_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
texte = "<html>Lancer<br>"+"Seuillage";
handles.btn_lancer_seuillage = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.22, 0.01, 0.15, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_lancer_seuillage_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[0, 0.9 ,0],..
'HorizontalAlignment', 'center');
texte = "<html>Afficher<br>"+"Image";
handles.btn_afficher_image = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.50, 0.01, 0.1, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_afficher_image_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
texte = "<html>Agrandir<br>"+"Image";
handles.btn_agrandir_image = uicontrol(f, 'unit', 'normalized', ...
'String',texte, ...
'Position', [0.61, 0.01, 0.1, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_agrandir_image_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
texte = "<html>Histogramme<br>"+"Image";
handles.btn_histogramme = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.72, 0.01, 0.1, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_histogramme_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
texte = "<html>Multiplication<br>"+"Image";
handles.btn_multiplication_image = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.83, 0.01, 0.1, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_multiplication_image_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
handles.btn_back = uicontrol(f, 'unit', 'normalized', ...
'String', "<-", ...
'Position', [0.44, 0.01, 0.06, 0.11], ...
'Style', 'pushbutton', ...
'Callback', 'btn_menu3_callback(handles)', ...
'Visible', 'on', ...
'Background', [28/255, 54/255, 84/255], ...
'FontSize', 30, ...
'ForegroundColor', [1, 1, 1], ...
'HorizontalAlignment', 'center');
handles.btn_next = uicontrol(f, 'unit', 'normalized', ...
'String', '->', ...
'Position', [0.94, 0.01, 0.06, 0.11], ...
'Callback', 'btn_menu2_callback(handles)', ...
'Visible', 'on',...
'Background' , [28/255,54/255,84/255],...
'FontSize', 30,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
handles.slider_seuillage = uicontrol(f, ...
'unit', 'normalized', ...
'BackgroundColor', [0.8, 0.8, 0.8], ... //couleur d'arriere-plan
'Enable', 'on', ...
'FontName', 'Tahoma', ...
'FontSize', 12, ...
'ForegroundColor', [0, 0, 0], ...
'HorizontalAlignment', 'left', ...
'Max', 255, ...
'Min', 0, ...
'Position', [0.11, 0.17, 0.2, 0.05], ...
'Relief', 'default', ...
'SliderStep', [10/255, 10/255], ... // pas de 10
'Style', 'slider', ...
'Value', 0, ...
'Tag', 'slider_seuillage', ...
'Callback', 'slider_seuillage_callback(handles);');
//Pour Affichage de la valeur actuelle du slider dans le champ texte
handles.slider_value_text = uicontrol(f, ...
'Style', 'text', ...
'unit', 'normalized', ...
'FontSize', 12, ...
'FontWeight', 'bold', ...
'Background', [108/255 , 146/255, 204/255], ...
'Position', [0.32, 0.17, 0.03, 0.05], ...
'String', '0', ...
'ForegroundColor', [1, 0, 0]); //Texte en rouge
//Texte au-dessus du slider pour indiquer les instructions
handles.slider_instruction_text = uicontrol(f, ...
'Style', 'text', ...
'unit', 'normalized', ...
'FontSize', 14, ...
'FontWeight', 'bold', ...
'ForegroundColor', [1, 0, 0], ...
'Position', [0.105, 0.23, 0.222, 0.05], ...
'ForegroundColor', [0.7, 0, 0.7], ...
'Background', [98/255 , 152/255, 209/255], ...
'String', 'Choisissez le seuil pour le traitement');
fn_bout_aide(f);
endfunction
// fonction qui permet de reccuperer la valeur du spinner
function slider_seuillage_callback(handles)
global handles;
global valeur_seuil;
valeur_seuil = get(handles.slider_seuillage, 'Value'); // Recuperer la valeur du slider
set(handles.slider_value_text, 'String', msprintf("%d", valeur_seuil)); //Pour mettre à jour le champ texte
endfunction
//-------------------------------------------------------------------------------//
//Bouton qui sera appeler pour le menu traitement
global valeur_multiplication;
function btn_multiplication_image_callback(handles)
global f;
global handles;
global chemin_dossier_menu;
global valeur_multiplication;
delete("all");
chemin_img_menu= chemin_dossier_menu + filesep() + "menu_traitement_image2.png";
afficher_background_image(chemin_img_menu);
//Cree les boutons spécifiques
texte = "<html>Choisir<br>"+"Image";
handles.btn_choisir_image = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.05, 0.01, 0.15, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_choisir_image_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
texte = "<html>Afficher<br>"+"Image";
handles.btn_afficher_image = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.50, 0.01, 0.1, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_afficher_image_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
texte = "<html>Agrandir<br>"+"Image";
handles.btn_agrandir_image = uicontrol(f, 'unit', 'normalized', ...
'String',texte, ...
'Position', [0.61, 0.01, 0.1, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_agrandir_image_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');
texte = "<html>Histogramme<br>"+"Image";
handles.btn_histogramme = uicontrol(f, 'unit', 'normalized', ...
'String', texte, ...
'Position', [0.72, 0.01, 0.1, 0.1], ...
'Style', 'pushbutton', ...
'Callback', 'btn_histogramme_callback', ...
'Visible', 'on',...
'Background' , [38/255,64/255,94/255],...
'FontSize', 20,...
'ForegroundColor',[1, 1 ,1],..
'HorizontalAlignment', 'center');