forked from scienstanford/iqmetrics
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reference Metrics downloaded from the web by Wen Lu
- Loading branch information
1 parent
15ccf7d
commit 376b563
Showing
2,511 changed files
with
220,581 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
%Written by Dr. Prashan Premaratne - University of Wollongong - 1 May 2006 | ||
%num specifies the number of Iterations for the Arnold Transform | ||
function newim = arnold(im,num) | ||
[rown,coln]=size(im); | ||
figure(1) | ||
for inc=1:num | ||
for row=1:rown | ||
for col=1:coln | ||
|
||
nrowp = row; | ||
ncolp=col; | ||
for ite=1:inc | ||
newcord =[1 1;1 2]*[nrowp ncolp]'; | ||
nrowp=newcord(1); | ||
ncolp=newcord(2); | ||
end | ||
newim(row,col)=im((mod(nrowp,rown)+1),(mod(ncolp,coln)+1)); | ||
|
||
end | ||
end | ||
|
||
end | ||
imshow(newim) | ||
figure(2) | ||
[irown,icoln]=size(newim); | ||
for inc=1:num | ||
for irow=1:irown | ||
for icol=1:icoln | ||
|
||
inrowp = irow; | ||
incolp=icol; | ||
for ite=1:inc | ||
inewcord =[2 -1;-1 1]*[inrowp incolp]'; | ||
inrowp=inewcord(1); | ||
incolp=inewcord(2); | ||
end | ||
iminverse(irow,icol)=newim((mod(inrowp,irown)+1),(mod(incolp,icoln)+1)); | ||
|
||
end | ||
end | ||
imshow(iminverse) | ||
end | ||
%out=iminverse; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Copyright (c) 2012, Prashan Premaratne | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are | ||
met: | ||
|
||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in | ||
the documentation and/or other materials provided with the distribution | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
function XYZ = lab2xyz(LAB) | ||
|
||
%LAB2XYZ converts an image from CIE-L*a*b* format to XYZ | ||
% | ||
%XYZ = lab2xyz(LAB) | ||
% | ||
%Input parameter: L*a*b* must be an image having 3 channels, i.e. a 3D array. | ||
% The first (L) channel must have values in the range 0..100; the second | ||
% and third (a* and b*) channels must have values in the range -128 to | ||
% 127. | ||
%Output parameter: XYZ would be an image of the same dimension. | ||
% | ||
%The XYZ format is often used as an intermediate format for conversion from | ||
%RGB to L*a*b* and vice versa. | ||
% | ||
%Example: To convert an image in RGB format to L*a*b* format, one can | ||
%combine the calling to the rgb2xyz and xyz2lab functions: | ||
% rgbim = imread('yourImage.png'); % image in RGB format | ||
% labim = xyz2lab(rgb2xyz(rgbim)); | ||
%The output labim has the following ranges of values: | ||
% - first channel L* 0..100 | ||
% - the second channel a* -128..127 | ||
% - the third channel b* -128..127 | ||
% | ||
%Other software packages, e.g. OpenCV, often applies a normalisation | ||
%process so that images in the L*a*b* format can be stored as 3-channel | ||
%greyscale images. The normalisation adopted by OpenCV is: | ||
% - the first channel L* is rescaled to the range 0..255. This can be done | ||
% easily by multiplying by 255 and dividing by 100. | ||
% - the second channel a* and third channel b* are added by 128 to bring | ||
% the range from -128..127 to 0..255. | ||
% | ||
%When comparing the pixel values of an L*a*b* image produced by the Matlab | ||
%function here and those from OpenCV, ensure that the above normalisation | ||
%procedure is taken into account. | ||
% | ||
%Also noted that images that are read from disk into OpenCV have their | ||
%channels specified in reverse order in the data structure. So, to compare | ||
%the Matlab function here with those in OpenCV, use the following OpenCV | ||
%functions: | ||
% source_rgb_image = cvLoadImage('yourImage.png', 1); | ||
% // make sure that the 3rd parameter is CV_BGR2Lab and not CV_RGB2Lab | ||
% cvCvtColor(source_rgb_image, destination_lab_image, CV_BGR2Lab); | ||
% // the resultant L*a*b* image is created within the program (i.e. not | ||
% // read from disk), so the channels are in the right order: | ||
% cvCvtPixToPlane(destination_lab_image, l_channel, a_channel, b_channel, | ||
% 0); | ||
% | ||
%References: | ||
%* http://www.easyrgb.com/index.php?X=MATH | ||
%* http://en.wikipedia.org/wiki/SRGB_color_space | ||
% | ||
%SEE ALSO | ||
% xyz2lab, xyz2rgb, rgb2xyz | ||
% | ||
%Feb 2010 | ||
% | ||
%Copyright Du Huynh | ||
%School of Computer Science and Software Engineering | ||
%The University of Western Australia | ||
|
||
|
||
XYZ = zeros(size(LAB)); | ||
|
||
XYZ(:,:,2) = ( LAB(:,:,1) + 16 ) / 116; | ||
XYZ(:,:,1) = LAB(:,:,2) / 500 + XYZ(:,:,2); | ||
XYZ(:,:,3) = XYZ(:,:,2) - LAB(:,:,3) / 200; | ||
|
||
index1 = find(XYZ.^3 > 0.008856); | ||
index2 = find(XYZ.^3 <= 0.008856); | ||
|
||
XYZ(index1) = XYZ(index1).^3; | ||
XYZ(index2) = ( XYZ(index2) - 16 / 116 ) / 7.787; | ||
|
||
ref_XYZ = [95.047; 100.000; 108.883]; | ||
for i=1:3 | ||
XYZ(:,:,i) = XYZ(:,:,i) * ref_XYZ(i); | ||
end | ||
end | ||
|
||
%Observer= 2?¡ã, Illuminant= D65 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
function XYZ = rgb2xyz(RGB) | ||
|
||
%RGB2XYZ converts an image from RGB format to XYZ | ||
% | ||
%XYZ = rgb2xyz(RGB) | ||
% | ||
%Output parameter: RGB must be an image having 3 channels, i.e. a 3D array. | ||
% Each channel of RGB should be in the range 0..255. | ||
%Input parameter: XYZ would be an image of the same dimension. | ||
% | ||
%Example: To convert an image in RGB format to L*a*b* format, one can | ||
%combine the calling to the rgb2xyz and xyz2lab functions: | ||
% rgbim = imread('yourImage.png'); % image in RGB format | ||
% labim = xyz2lab(rgb2xyz(rgbim)); | ||
%The output labim has the following ranges of values: | ||
% - first channel L* 0..100 | ||
% - the second channel a* -128..127 | ||
% - the third channel b -128..127 | ||
% | ||
%Other software packages, e.g. OpenCV, often applies a normalisation | ||
%process so that images in the L*a*b* format can be stored as 3-channel | ||
%greyscale images. The normalisation adopted by OpenCV is: | ||
% - the first channel L* is rescaled to the range 0..255. This can be done | ||
% easily by multiplying by 255 and dividing by 100. | ||
% - the second channel a* and third channel b* are added by 128 to bring | ||
% the range from -128..127 to 0..255. | ||
% | ||
%When comparing the pixel values of an L*a*b* image produced by the Matlab | ||
%function here and those from OpenCV, ensure that the above normalisation | ||
%procedure is taken into account. | ||
% | ||
%Also noted that images that are read from disk into OpenCV have their | ||
%channels specified in reverse order in the data structure. So, to compare | ||
%the Matlab function here with those in OpenCV, use the following OpenCV | ||
%functions: | ||
% source_rgb_image = cvLoadImage('yourImage.png', 1); | ||
% // make sure that the 3rd parameter is CV_BGR2Lab and not CV_RGB2Lab | ||
% cvCvtColor(source_rgb_image, destination_lab_image, CV_BGR2Lab); | ||
% // the resultant L*a*b* image is created within the program (i.e. not | ||
% // read from disk), so the channels are in the right order: | ||
% cvCvtPixToPlane(destination_lab_image, l_channel, a_channel, b_channel, | ||
% 0); | ||
% | ||
%References: | ||
%* http://www.easyrgb.com/index.php?X=MATH | ||
%* http://en.wikipedia.org/wiki/SRGB_color_space | ||
% | ||
%SEE ALSO | ||
% xyz2rgb, xyz2lab, lab2xyz | ||
% | ||
%Feb 2010 | ||
% | ||
%Copyright Du Huynh | ||
%School of Computer Science and Software Engineering | ||
%The University of Western Australia | ||
|
||
RGB = RGB/255; | ||
|
||
index1 = find(RGB > 0.04045); | ||
index2 = find(RGB <= 0.04045); | ||
RGB(index1) = ((RGB(index1) + 0.055) / 1.055).^2.4; | ||
RGB(index2) = RGB(index2) / 12.92; | ||
|
||
%Observer. = 2?¡ã, Illuminant = D65 | ||
XYZ = zeros(size(RGB)); | ||
M = [ | ||
0.4124 0.3576 0.1805; | ||
0.2126 0.7152 0.0722; | ||
0.0193 0.1192 0.9505 | ||
]; | ||
|
||
for i=1:3 | ||
XYZ(:,:,i) = RGB(:,:,1)*M(i,1) + RGB(:,:,2)*M(i,2) + RGB(:,:,3)*M(i,3); | ||
end | ||
|
||
XYZ = XYZ*100; | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
% RGB2XYZ | ||
clear all | ||
addpath(genpath('D:\tools\matlab\workspace\iset-4.449\iset-4.0')); | ||
RGB = imread('E:\2012\Error Map\TID\I03.bmp'); | ||
RGB1 = double(imread('E:\2012\Error Map\TID\I03.bmp')); | ||
|
||
XYZ1 = rgb2xyz(RGB1); | ||
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
|
||
X1 = XYZ1(:,:,1); | ||
X3= Arnold(X1,1,0); | ||
[m,n] = size(X1); | ||
% x1 = X1-20; % 0.1~1 | ||
x1 = X1+randn([m,n])*5; % the different x can influence the result of SSIM | ||
Y1 = XYZ1(:,:,2); | ||
Y3 = Y1/100; | ||
%y1 = Y1+randn([m,n])*200; | ||
%y1 = Y1-60; | ||
Z1 = XYZ1(:,:,3); | ||
% z1 = Z1+randn([m,n])*100; % <120 | ||
z1 = Z1+10; | ||
XYZ2(:,:,1)=X3; | ||
XYZ2(:,:,2)=Y1; | ||
XYZ2(:,:,3)=Z1; | ||
|
||
plot(X1,X3,'k-'); | ||
|
||
|
||
|
||
% %%%%%%%%%%%%%%%%%%%%%%%%%% | ||
% CIE Lab space | ||
% | ||
% lab1 = xyz2lab(XYZ1); | ||
% L1 = lab1(:,:,1); | ||
% [m,n] = size(L1); | ||
% %l1 = L1+randn([m,n])*200; | ||
% %l1 = L1+20; | ||
% a1 = lab1(:,:,2); | ||
% | ||
% A1 = a1+randn([m,n])*200; | ||
% %A1 = a1+20; | ||
% b1 = lab1(:,:,3); | ||
% % B1 = b1+randn([m,n])*20; % <200 | ||
% B1 = b1+60; % < 32 | ||
% | ||
% lab2(:,:,1)=L1; | ||
% lab2(:,:,2)=a1; | ||
% lab2(:,:,3)=B1; | ||
% | ||
% XYZ2= lab2xyz(lab2); | ||
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
|
||
|
||
RGB2 =xyz2rgb(XYZ2); | ||
|
||
XYZ3 = rgb2xyz(RGB2); | ||
|
||
X2 = XYZ3(:,:,1); | ||
Y2 = XYZ3(:,:,2); | ||
Z2 = XYZ3(:,:,3); | ||
|
||
[PSNRY,error_mapY] = PeakSignaltoNoiseRatio(Y1, Y2); | ||
[mssimY, ssim_mapY] = SSIM_FR(Y1, Y2); | ||
[PSNRX,error_mapX] = PeakSignaltoNoiseRatio(X1, X2); | ||
[mssimX, ssim_mapX] = SSIM_FR(X1, X2); | ||
[PSNRZ,error_mapZ] = PeakSignaltoNoiseRatio(Z1, Z2); | ||
[mssimZ, ssim_mapZ] = SSIM_FR(Z1, Z2); | ||
|
||
% plot(X1,X2,Y1,Y2,Z1,Z2); | ||
% figure(1); | ||
% plot(Y1,Y2,'r-'); | ||
% xlabel('Y1'); | ||
% ylabel('Y2'); | ||
% figure(2); | ||
% plot(X1,X2,'c-'); | ||
% xlabel('X1'); | ||
% ylabel('X2'); | ||
% figure(3); | ||
% plot(Z1,Z2,'k-'); | ||
% xlabel('Z1'); | ||
% ylabel('Z2'); | ||
% hold on; | ||
|
||
|
||
% figure; | ||
% plot(Y1,Y2,'-k'); | ||
% xlabel('Y1'); | ||
% ylabel('Y2'); | ||
% figure; | ||
% plot(X1,X2,'ok'); | ||
% xlabel('X1'); | ||
% ylabel('X2'); | ||
% figure; | ||
% plot(Z1,Z2,'--k'); | ||
% xlabel('Z1'); | ||
% ylabel('Z2'); | ||
|
||
|
||
|
||
RGB5=uint8(RGB2); | ||
figure, imshow(RGB5); | ||
title(''); | ||
% imwrite(RGB2,'C:\Users\mr\Desktop\color distortion\XYZ\y_20.bmp'); | ||
RGB3 = RGB2GRAY(RGB1/255); | ||
RGB4 = RGB2GRAY(RGB2/255); | ||
% figure, imshow(RGB3); | ||
% figure, imshow(RGB4); | ||
% [mssim1, ssim_map] = SSIM_FR(RGB3, L1); | ||
[mssim, ssim_map] = SSIM_FR(RGB3, RGB4); | ||
[PSNR,error_map] = PeakSignaltoNoiseRatio(RGB3, RGB4); | ||
% plot(RGB3, RGB4,'k-'); | ||
% xlabel(''); | ||
% ylabel('RGB3/RGB4') | ||
plot(Y3,RGB3,'k-'); | ||
xlabel(''); | ||
ylabel('Y1/RGB') |
Oops, something went wrong.