Bonjour

j'ai un code MATLAB et je n'arrive pas à le traduire en code j'ai des problème merci pour m'aider j'ai besoin de code
insfre.m
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
clear all;
close all;
 
orig=imread('med.bmp');
 
 
% **************Division de l'image originale en blocs de 8*************
 
for i=1:256
    for j=1:256
        k=fix((i-1)/8);
        l=fix((j-1)/8);
        m=(k+1)+32*l;
        s=mod(i,8);
        d= mod(j,8);
        if s==0,
            s=8;
        end
        if d==0,
            d=8;
        end
        v(s,d,m)=orig(i,j);
    end
end
 
% ************** TCD de la matrice blocs originale*************
 
for m=1:1024
    ti(:,:,m)=round(dct2(v(:,:,m)));
    ti(8,8,m)=0;
    s=0;
    for i=1:8
        for j=1:8
 
            s=s+(ti(i,j,m)/4);
        end
    end
    ti(8,8,m)=s/78;
    tinv(:,:,m)=round(idct2(ti(:,:,m)));
 
end
 %**************** Affichage de la matrice résultat*************
for m=1:1024
 
    l=fix((m-1)/32);
    k=m-(32*l)-1;
 
    for s=1:8
        for d=1:8 
            i=(k*8)+s; 
            j=(l*8)+d;
            tatou2(i,j)=tinv(s,d,m);
        end
    end
end
figure(1);colormap(gray);
imagesc(tatou2)
imwrite(uint8(tatou2),'IM11tatouée.bmp','bmp');
 
 
%******************************PSNR*****************
 
orig=imread('med.bmp');
orig=double(orig);
tatou=imread('IM11tatouée.bmp');
tatou=double(tatou);
diff1=(orig-tatou).^2;
MSE1=sum(sum(diff1))/(256*256);
PSNRsans=10*log10((255^2)/MSE1)
detefre.m
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
clear all;
close all;
 
orig=imread('image tatouée.bmp');
 
% **************Division de l'image originale en blocs de 8*************
 
for i=1:256
    for j=1:256
        k=fix((i-1)/8);
        l=fix((j-1)/8);
        m=(k+1)+32*l;
        s=mod(i,8);
        d= mod(j,8);
        if s==0,
            s=8;
        end
        if d==0,
            d=8;
        end
        v(s,d,m)=orig(i,j);
    end
end
 
%***********************initialisation*************************
Ic(:,:,:,1)=v(:,:,:);
Ic(:,:,:,2)=v(:,:,:);
Ic(:,:,:,3)=v(:,:,:);
% ************** TCD de la matrice blocs originale*************
a=0;
for m=1:1024
    ti(:,:,m)=round(dct2(v(:,:,m)));
    s=0;
    for i=1:7
        for j=1:7
 
            s=s+(ti(i,j,m)/4);
        end
    end 
    s=s/78;
    diff=round(s-ti(8,8,m));
 
    for i=1:8
        for j=1:8
            if ((diff==0)|(diff==1)|(diff==-1))
                etatdubloc='bloc intact';
            else
                Ic(i,j,m,1)=0;
 
            end
        end
    end
    if (Ic(i,j,m,1)==0)
        a=a+1;
    end   
end
 
Nombredeblocs=a
%**************** Affichage de la matrice résultat*************
for m=1:1024
 
    l=fix((m-1)/32);
    k=m-(32*l)-1;
 
    for s=1:8
        for d=1:8 
            i=(k*8)+s; 
            j=(l*8)+d;
            tatou2(i,j,:)=Ic(s,d,m,:);
        end
    end
end
figure(6);colormap(gray);
imagesc(tatou2)