00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00034 #include "image.h"
00035 #include "proto2D.h"
00036 #include "histo.h"
00037
00038 int main(int argc, char *argv[]){
00039
00040
00041
00042 imau1 bl0;
00043 imau1 mas;
00044
00045
00046 select_ima_t sel, selmas;
00047 histo_t hist;
00048
00049
00050 param par0, *ptp;
00051 char nommas[200];
00052 int l;
00053
00054
00055
00056
00057 param_debut(argc, argv, &par0);
00058 ptp = &par0;
00059 ptp = select_ima_lect(&sel, ptp, ">> image initiale :");
00060 ptp = histo_lect(&hist, ptp, ">> histograme :");
00061 lec_param(">> nom image masque type u1 (.ima|.ras), 0 si aucun masque :", ptp);
00062 strcpy(nommas, ptp->rep);
00063 ptp = ptp->next;
00064 if( hist.ngm >= 0){
00065 selmas = sel;
00066 l = strlen(nommas);
00067 do
00068 l--;
00069 while(nommas[l] != '.' && l>0);
00070 if( l>0 ){
00071 strncpy(selmas.nom, nommas, l);
00072 selmas.nom[l] = '\0';
00073 strcpy(selmas.ext, nommas+l+1);
00074 }
00075 else{
00076 printf("\n>>mhistobpb_u1 ERREUR : nom image masque incomplet (extension?)\n");
00077 exit(1);
00078 }
00079 }
00080 param_fin(argc, argv, &par0);
00081
00082
00083
00084
00085 select_imau1_init(&sel, &bl0);
00086 if( hist.ngm >= 0){
00087 select_imau1_init(&selmas, &mas);
00088 }
00089 histou1_init(&hist, bl0, mas);
00090
00091
00092
00093 while( select_imau1_calc(&sel, &bl0) == 0){
00094 if( hist.ngm >= 0){
00095 if(select_imau1_calc(&selmas, &mas) != 0 ){
00096 printf("\n>>mhistobpb_u1 ERREUR : fin du masque avant fin image\n");
00097 break;
00098 }
00099 }
00100 histou1_calc(&hist, bl0, mas);
00101 }
00102
00103
00104 histo_ferm(&hist);
00105 }
00106