Clear Filters
Clear Filters

i can't calculate psnr for below code......

2 views (last 30 days)
Nivetha m
Nivetha m on 4 Apr 2016
clc; clear all; close all; fontSize = 20; a=imread('C:\Users\shankar\Documents\MATLAB\measurement\ship.jpg'); subplot(2,2,1),imshow(a),title('original image', 'FontSize', fontSize), b=rgb2gray(a); subplot(2,2,2),imshow(b),title('GRAY image', 'FontSize', fontSize), [m n]=size(b); H=fspecial('laplacian'); b2=imfilter(a,H); subplot(2,2,3),imshow(b2),title('FILTER image', 'FontSize', fontSize),
squaredErrorImage = (double(b) - double(b2)) .^ 2; mse = sum(sum(squaredErrorImage)) / (m * n); RMSE = sqrt(mse); PSNR = 10 * log10( 256^2 / mse); mad = mean2(abs(double(b)-double(b2))); message = sprintf('The mean square error is %.2f.\nThe PSNR = %.2f.\n THE RMSE=%.2f.\n THE mad=%.2f',mse, PSNR,RMSE,mad); msgbox(message);

Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!