en fait le programme que je fait prend une image médicale, de taille 256x256x95 et calcul le produit de convolution entre le filtre bibi et l’image d’entrée.
et j’ai des érreur au niveau des types;
error C2440: ‘=’ : impossible de convertir de ‘float’ en ‘float ’
error C2296: '’ : non conforme, l’opérande gauche est du type ‘float *’
error C2440: ‘=’ : impossible de convertir de ‘float’ en ‘float *’
error C2440: ‘=’ : impossible de convertir de ‘float *’ en ‘float’
si vous voyez quelque chose de louche , faite moi par de vos suggestions;
merci encore pour votre aie
for( i = 0; i < x; ++i ) {unsigned int x = 256,y = 256,z =95, i, j, k;
float ****matrice = (float****)malloc( x * sizeof(float***) );
for( i = 0; i < x; ++i ) {
matrice[i] = (float***)malloc( y * sizeof(float**) );
for( j = 0; j < y; ++j ) {
matrice[i][j] = (float**)malloc( z * sizeof(float*) );
for( k = 0; k < z; ++k ) {
matrice[i][j][k] = (float*) malloc( sizeof(float) );
}
}
}
float ****tempo = (float****)malloc( x * sizeof(float***
matrice[i] = (float***)malloc( y * sizeof(float**) );
for( j = 0; j < y; ++j ) {
matrice[i][j] = (float**)malloc( z * sizeof(float*) );
for( k = 0; k < z; ++k ) {
matrice[i][j][k] = (float*) malloc( sizeof(float) );
}
}
}
int L=0;
ofstream fecrit("Att_modif_smooth.img", ios:: out | ios::binary);
float bibi[7][7] ={{0.0034 , 0.0073 , 0.0116 , 0.0135 , 0.0116 , 0.0073 , 0.0034}
,{0.0073 , 0.0158 , 0.0251 , 0.0293 , 0.0251 , 0.0158, 0.0073}
,{0.0116 , 0.0251, 0.0399, 0.0465 , 0.0399 , 0.0251 , 0.0116}
,{0.0135 , 0.0293 , 0.0465 , 0.0543 , 0.0465 , 0.0293 , 0.0135}
,{0.0116 , 0.0251 , 0.0399, 0.0465, 0.0399 , 0.0251 , 0.0116}
,{0.0073 , 0.0158, 0.0251 , 0.0293 , 0.0251 , 0.0158 , 0.0073}
,{0.0034 , 0.0073 , 0.0116 , 0.0135, 0.0116 , 0.0073 , 0.0034}};
// pour faciliter le calcul de convolution je place les données image dans une matrice 3D
for(int coupe = 0 ; coupe<95 ; coupe++)
{
for(int xxx = 0 ; xxx <256 ; xxx++)
{
for(int yyy = 0 ; yyy<256 ; yyy++)
{
matrice[xxx][yyy][coupe]=image[L]; //1ère erreur a cette ligne
L++;
}
}
};
//produit de convolution
for(int coupe =0; coupe<95 ; coupe++)
for (int jjj = 0; jjj < 256; jjj++)
for (int iii = 0; iii < 256; iii++)
{
float tmp = 0;
for (int y = 0; y <7; y++)
for (int x = 0; x < 7; x++)
tmp += matrice[j+ y][ i + x][coupe] * bibi[y][x]; //deuxième erreur
tempo[j][i][coupe] = tmp; //trosième érreur
}
//je retransfere lmage dans un tableau a une dimensions
L=0;
for(int coupe = 0 ; coupe<95 ; coupe++)
{
for(int xxx = 0 ; xxx <256 ; xxx++)
{
for(int yyy = 0 ; yyy<256 ; yyy++)
{
image[L]=tempo[xxx][yyy][coupe]; //quatrième érreur
L++;
}
}
};
//enregistrement des données
fecrit.write((char *)image,95*x_pixels*y_pixels*sizeof(float));
fecrit.close();
Edité le 14/08/2009 à 21:01