forked from CosmoStat/octave_image_processing_example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate_data.m
More file actions
49 lines (43 loc) · 1.11 KB
/
Copy pathgenerate_data.m
File metadata and controls
49 lines (43 loc) · 1.11 KB
1
%% Regenration des variables%chargement imagecanards=imread('canards.png');#conversion en niveaux de grisim=double(rgb2gray(canards));save("canards.mat",'im')%Initialisation de la graine pour le generateur de nombres aleatoiresseed_number=2020;rand("seed",seed_number);randn("seed",seed_number);%Ajout de bruit blanc GaussianSignalToNoiseRatio=5e2; #Rapport Signal a Bruitsigma=norm(double(im))/SignalToNoiseRatio;im_b=im+sigma*randn(size(im));save("canards_gauss.mat",'im_b');%Ajout de bruit selratio = 4e-1; %ratio de pixel bruitesbruit_sel = rand(size(im))<ratio;max_type = double(intmax(class(canards))); %get the maximum of data typeim_sel=im+bruit_sel*max_type;save("canards_sel.mat",'im_sel');%Ajout de bruit selbruit_poivre = rand(size(im))>ratio;im_poivre=im.*bruit_poivre;save("canards_poivre.mat",'im_poivre')#affichagefigure(1)subplot(221)colormap('gray')imagesc(im)title('Originale')subplot(222)colormap('gray')imagesc(im_b)title('Bruit Gaussien')subplot(223)colormap('gray')imagesc(im_sel)title('Bruit Sel')subplot(224)colormap('gray')imagesc(im_poivre)title('Bruit Poivre')