真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

psnrjava代碼 psm代碼

求M文件,直接求圖像的峰值信噪比(無論灰度和彩色)

close all

創(chuàng)新互聯(lián)成立與2013年,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項目成都網(wǎng)站制作、網(wǎng)站建設(shè)網(wǎng)站策劃,項目實施與項目整合能力。我們以讓每一個夢想脫穎而出為使命,1280元習(xí)水做網(wǎng)站,已為上家服務(wù),為習(xí)水各地企業(yè)和個人服務(wù),聯(lián)系電話:028-86922220

clear all

I=imread('lena.bmp');

J=imnoise(I,'gaussian',0.01,0.005);

A=imread('lena.bmp');

[M,N]=size(A);

B = imread('J.bmp');

a=double(A);

b=double(B);

sum=0;

for i=1:M;

for j=1:N;

sum=sum+(a(i,j)-b(i,j))^2;

end;

end;

mseValue=sum/(M*N);

psnrValue=10*log10(255^2/mseValue);

disp(['輸入數(shù)據(jù)的MSE為:',num2str(mseValue)]);

disp(['輸入數(shù)據(jù)的PSNR為:',num2str(psnrValue)]);

輸入數(shù)據(jù)的MSE為:7915.4387

輸入數(shù)據(jù)的PSNR為:9.1461

以上是MATLAB程序 及其輸出結(jié)果 M文件可為

function PSNR = PSNR(A,B)

[M,N]=size(A);

x=double(A);

y=double(B);

sum=0;

for i=1:M;

for j=1:N;

sum=sum+(x(i,j)-y(i,j))^2;

end;

end;

mseValue=sum/(M*N);

psnrValue=10*log10(255^2/mseValue);

disp(['輸入數(shù)據(jù)的MSE為:',num2str(mseValue)]);

disp(['輸入數(shù)據(jù)的PSNR為:',num2str(psnrValue)]);

數(shù)字音頻水印——峰值信噪比PSNR與信噪比SNR的問題。求告之!求代碼!

峰值信噪比PSNR

(1)PSNR?(Peak?signal-to-noise?ratio)

常用于圖像壓縮等領(lǐng)域中,壓縮前與壓縮后,圖像劣化程度的客觀評價。

評價結(jié)果以dB(對比分貝)為單位來表示。2個圖像間,PSNR值越大,趨于無劣化,劣化程度較大時,PSNR值趨于0dB。

不知道你是灰度圖像水印還是彩色圖像水印,還是音頻轉(zhuǎn)成的二維矩陣,我就簡單的用灰度水印圖像介紹一下;

PSNR的公式是:

、

如上圖MSE是原始和編碼后圖像的之間的均方誤差,n表示每個像素的比特數(shù),公式的具體解釋和證明去自己找資料吧。

看你代碼的形式,應(yīng)該是matlab

其中n表示的比特數(shù)為8比特

function?[PSNR,?MSE]?=?psnr(X,?Y)

%?計算峰值信噪比PSNR、均方根誤差MSE

%?如果輸入Y為空,則視為X與其本身來計算PSNR、MSE

if?nargin2

D?=?X;

else

if?any(size(X)~=size(Y))

? error('The?input?size?is?not?equal?to?each?other!');

end

D?=?X-Y;

end

MSE?=?sum(D(:).*D(:))/prod(size(X));

PSNR?=?10*log10(255^2/MSE);

以下個人觀點:我做實驗的時候不太喜歡用PSNR,實驗結(jié)果顯示,PSNR?的分?jǐn)?shù)無法和人眼看到的視覺品質(zhì)完全一致,有可能?PSNR?較高者看起來反而比PSNR?較低者差,語音水印的品質(zhì)也很成問題,不建議用PSNR,除非你的算法和PSNR很合得來,可以作為參考參數(shù)。

下班了,待續(xù)...

求基于BP神經(jīng)網(wǎng)絡(luò)的圖像復(fù)原代碼,著急用,幫幫我

function Solar_SAE

tic;

n = 300;

m=20;

train_x = [];

test_x = [];

for i = 1:n

%filename = strcat(['D:\Program Files\MATLAB\R2012a\work\DeepLearn\Solar_SAE\64_64_3train\' num2str(i,'%03d') '.bmp']);

%filename = strcat(['E:\matlab\work\c0\TrainImage' num2str(i,'%03d') '.bmp']);

filename = strcat(['E:\image restoration\3-(' num2str(i) ')-4.jpg']);

b = imread(filename);

%c = rgb2gray(b);

c=b;

[ImageRow ImageCol] = size(c);

c = reshape(c,[1,ImageRow*ImageCol]);

train_x = [train_x;c];

end

for i = 1:m

%filename = strcat(['D:\Program Files\MATLAB\R2012a\work\DeepLearn\Solar_SAE\64_64_3test\' num2str(i,'%03d') '.bmp']);

%filename = strcat(['E:\matlab\work\c0\TestImage' num2str(i+100,'%03d') '-1.bmp']);

filename = strcat(['E:\image restoration\3-(' num2str(i+100) ').jpg']);

b = imread(filename);

%c = rgb2gray(b);

c=b;

[ImageRow ImageCol] = size(c);

c = reshape(c,[1,ImageRow*ImageCol]);

test_x = [test_x;c];

end

train_x = double(train_x)/255;

test_x = double(test_x)/255;

%train_y = double(train_y);

%test_y = double(test_y);

% Setup and train a stacked denoising autoencoder (SDAE)

rng(0);

%sae = saesetup([4096 500 200 50]);

%sae.ae{1}.activation_function = 'sigm';

%sae.ae{1}.learningRate = 0.5;

%sae.ae{1}.inputZeroMaskedFraction = 0.0;

%sae.ae{2}.activation_function = 'sigm';

%sae.ae{2}.learningRate = 0.5

%%sae.ae{2}.inputZeroMaskedFraction = 0.0;

%sae.ae{3}.activation_function = 'sigm';

%sae.ae{3}.learningRate = 0.5;

%sae.ae{3}.inputZeroMaskedFraction = 0.0;

%sae.ae{4}.activation_function = 'sigm';

%sae.ae{4}.learningRate = 0.5;

%sae.ae{4}.inputZeroMaskedFraction = 0.0;

%opts.numepochs = 10;

%opts.batchsize = 50;

%sae = saetrain(sae, train_x, opts);

%visualize(sae.ae{1}.W{1}(:,2:end)');

% Use the SDAE to initialize a FFNN

nn = nnsetup([4096 1500 500 200 50 200 500 1500 4096]);

nn.activation_function = 'sigm';

nn.learningRate = 0.03;

nn.output = 'linear'; % output unit 'sigm' (=logistic), 'softmax' and 'linear'

%add pretrained weights

%nn.W{1} = sae.ae{1}.W{1};

%nn.W{2} = sae.ae{2}.W{1};

%nn.W{3} = sae.ae{3}.W{1};

%nn.W{4} = sae.ae{3}.W{2};

%nn.W{5} = sae.ae{2}.W{2};

%nn.W{6} = sae.ae{1}.W{2};

%nn.W{7} = sae.ae{2}.W{2};

%nn.W{8} = sae.ae{1}.W{2};

% Train the FFNN

opts.numepochs = 30;

opts.batchsize = 150;

tx = test_x(14,:);

nn1 = nnff(nn,tx,tx);

ty1 = reshape(nn1.a{9},64,64);

nn = nntrain(nn, train_x, train_x, opts);

toc;

tic;

nn2 = nnff(nn,tx,tx);

toc;

tic;

ty2 = reshape(nn2.a{9},64,64);

tx = reshape(tx,64,64);

tz = tx - ty2;

tz = im2bw(tz,0.1);

%imshow(tx);

%figure,imshow(ty2);

%figure,imshow(tz);

ty = cat(2,tx,ty2,tz);

montage(ty);

filename3 = strcat(['E:\image restoration\3.jpg']);

e=imread(filename3);

f= rgb2gray(e);

f=imresize(f,[64,64]);

%imshow(ty2);

f=double (f)/255;

[PSNR, MSE] = psnr(ty2,f)

imwrite(ty2,'E:\image restoration\bptest.jpg','jpg');

toc;

%visualize(ty);

%[er, bad] = nntest(nn, tx, tx);

%assert(er 0.1, 'Too big error');


名稱欄目:psnrjava代碼 psm代碼
文章位置:http://weahome.cn/article/dojpooi.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部