Skip to content

Commit

Permalink
Removal of PQS, fixes to image links in the READMEs
Browse files Browse the repository at this point in the history
  • Loading branch information
nsprljan committed Apr 26, 2012
1 parent ad9f66f commit 92c009e
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 145 deletions.
Binary file removed QualityAssessment/Pqs.zip
Binary file not shown.
1 change: 0 additions & 1 deletion QualityAssessment/README.md
Expand Up @@ -9,7 +9,6 @@ Functions

- **iq_measures** - Image Quality Measures - various measures of reconstructed image quality
- **image_show** - Displays image, with additional parameters
- **pqs** - Script that runs software based on CIPIC PQS version 1 (Picture Quality Scale) image quality measure. Unzip the contents Pqs.zip into subdirectory .\Pqs to make the binary available to the script. The original CIPIC PQS version 1 software has been modified so there is support for different block size (switch -b).


Examples
Expand Down
139 changes: 74 additions & 65 deletions QualityAssessment/iq_measures.m
@@ -1,6 +1,6 @@
function [MSE,PSNR,AD,SC,NK,MD,LMSE,NAE,PQS]=iq_measures(A,B,disp)
function [MSE,PSNR,AD,SC,NK,MD,LMSE,NAE]=iq_measures(A,B,disp)
%Image Quality Measures - various measures of reconstructed image quality
%[MSE,PSNR,AD,SC,NK,MD,LMSE,NAE,PQS] = iq_measures(A,B,disp)
%[MSE,PSNR,AD,SC,NK,MD,LMSE,NAE] = iq_measures(A,B,disp)
%
%Input:
% A - array containing the original image or its filename
Expand All @@ -11,10 +11,11 @@
% if (disp ~= 'disp') results are not displayed
%
%Note:
% Number of specified outputs will defined what is actually computed.
% Number of specified outputs specifies what is actually computed.
% if (nargout == 2) only MSE and PSNR are computed
% if (nargout == 8) the PQS is not computed
% if (nargout == 9) all measures are computed
% if (nargout == 3) MSE, PSNR and AD are computed
% ...
% if (nargout == 8) all measures are computed
%
%Output:
% MSE - Mean Squared Error
Expand All @@ -25,10 +26,6 @@
% MD - Maximum Difference
% LMSE - Laplacian Mean Squared Error
% NAE - Normalized Absolute Error
% PQS - Picture Quality Scale
%
%Uses:
% pqs.m (for computation of PQS)
%
%Example:
% [MSE,PSNR]=iq_measures(A,B);
Expand All @@ -40,10 +37,10 @@
else
disp = strcmp(disp,'disp');
end;
if isstr(A)
if ischar(A)
A=imread(A);
end;
if isstr(B)
if ischar(B)
B=imread(B);
end;
if ~isa(A,'double')
Expand All @@ -52,13 +49,9 @@
if ~isa(B,'double')
B=double(B);
end;
if (nargout <= 2)
numout = 1;
elseif (nargout <= 8)
numout = 2;
else
numout = 3;
end;

numout = nargout;

clrcomp = size(A,3);
MSE = zeros(1,clrcomp);
PSNR = zeros(1,clrcomp);
Expand All @@ -68,59 +61,75 @@
MD = zeros(1,clrcomp);
LMSE = zeros(1,clrcomp);
NAE = zeros(1,clrcomp);
PQS = zeros(1,clrcomp);
for i=1:size(A,3)
if (disp && (clrcomp > 1)) fprintf('Component %d\n',i);end;
[MSE(i),PSNR(i),AD(i),SC(i),NK(i),MD(i),LMSE(i),NAE(i),PQS(i)]=measureQ(A(:,:,i),B(:,:,i),disp,numout);
[MSE(i),PSNR(i),AD(i),SC(i),NK(i),MD(i),LMSE(i),NAE(i)]=measureQ(A(:,:,i),B(:,:,i),disp,numout);
end;

function [MSE,PSNR,AD,SC,NK,MD,LMSE,NAE,PQS]=measureQ(A,B,disp,numout)
x=size(A,2);
y=size(A,1);
function [MSE,PSNR,AD,SC,NK,MD,LMSE,NAE]=measureQ(A,B,disp,numout)
PSNR=0;
AD=0;
SC=0;
NK=0;
MD=0;
LMSE=0;
NAE=0;

R=A-B;
Pk=sum(sum(A.^2));
MSE=sum(sum(R.^2))/(x*y); % MSE
if disp~=0 fprintf('MSE (Mean Squared Error) = %f\n',MSE);end;
% PSNR
if MSE>0
PSNR=10*log10(255^2/MSE);
else
PSNR=Inf;

% MSE
MSE=sum(sum(R.^2))/(size(A,1)*size(A,2)); % MSE
if (disp~=0) fprintf('MSE (Mean Squared Error) = %f\n',MSE);end;

if (numout > 1)
% PSNR
if MSE>0
PSNR=10*log10(255^2/MSE);
else
PSNR=Inf;
end;
if (disp~=0) fprintf('PSNR (Peak Signal / Noise Ratio) = %f dB\n',PSNR);end;
end;

if (numout > 2)
% AD
AD=sum(sum(R))/(size(A,1)*size(A,2)); % AD
if disp~=0 fprintf('AD (Average Difference) = %f\n',AD);end;
end;

if (numout > 3)
% SC
Bs = sum(sum(B.^2));
if (Bs == 0)
SC = Inf;
else
SC=Pk/sum(sum(B.^2));
end;
if disp~=0 fprintf('SC (Structural Content) = %f\n',SC);end;
end;

if (numout > 4)
% NK
NK=sum(sum(A.*B))/Pk;
if disp~=0 fprintf('NK (Normalised Cross-Correlation) = %f\n',NK);end;
end;

if (numout > 5)
% MD
MD=max(max(abs(R))); % MD
if disp~=0 fprintf('MD (Maximum Difference) = %f\n',MD);end;
end;

if (numout > 6)
% LMSE
OP=4*del2(A);
LMSE=sum(sum((OP-4*del2(B)).^2))/sum(sum(OP.^2));
if disp~=0 fprintf('LMSE (Laplacian Mean Squared Error) = %f\n',LMSE);end;
end;
if disp~=0 fprintf('PSNR (Peak Signal / Noise Ratio) = %f dB\n',PSNR);end;

if numout>1
AD=sum(sum(R))/(x*y); % AD
if disp~=0 fprintf('AD (Average Difference) = %f\n',AD);end;
Bs = sum(sum(B.^2));
if (Bs == 0)
SC = Inf;
else
SC=Pk/sum(sum(B.^2)); % SC
end;
if disp~=0 fprintf('SC (Structural Content) = %f\n',SC);end;
NK=sum(sum(A.*B))/Pk; % NK
if disp~=0 fprintf('NK (Normalised Cross-Correlation) = %f\n',NK);end;
MD=max(max(abs(R))); % MD
if disp~=0 fprintf('MD (Maximum Difference) = %f\n',MD);end;
% LMSE
OP=4*del2(A);
LMSE=sum(sum((OP-4*del2(B)).^2))/sum(sum(OP.^2));
if disp~=0 fprintf('LMSE (Laplacian Mean Squared Error) = %f\n',LMSE);end;
NAE=sum(sum(abs(R)))/sum(sum(abs(A))); % NAE
if disp~=0 fprintf('NAE (Normalised Absolute Error) = %f\n',NAE);end;
else
AD=0;
SC=0;
NK=0;
MD=0;
LMSE=0;
NAE=0;
if (numout > 7)
% NAE
NAE=sum(sum(abs(R)))/sum(sum(abs(A)));
if disp~=0 fprintf('NAE (Normalised Absolute Error) = %f\n',NAE);end;
end;
if (numout>2)&(x==y)
% PQS
PQS=pqs(A,B,x);
if disp~=0 fprintf('PQS (Picture Quality Scale) = %f\n',PQS);end;
else
PQS=0;
end;
70 changes: 0 additions & 70 deletions QualityAssessment/pqs.m

This file was deleted.

14 changes: 7 additions & 7 deletions Wavelet/README.md
Expand Up @@ -114,29 +114,29 @@ Analysis and synthesis filter taps, orthogonality test, Perfect Recostruction (P

>> scaling_fun('CDF_9x7',5,'d','plot');

![9x7 wavelet scaling function](https://github.com/nsprljan/Matlab/raw/master/Wavelet/CDF_9x7_scaling_analysis.png)
![9x7 wavelet scaling function](https://github.com/nsprljan/ImageCodingResearchTools/raw/master/Wavelet/CDF_9x7_scaling_analysis.png)

### Wavelet filter taps ###
Low pass filter taps, (scaling function with 0 iterations) with **scaling\_fun**:

>> scaling_fun('LeGall_5x3',0,'d');

![5x3 wavelet h0 taps](https://github.com/nsprljan/Matlab/raw/master/Wavelet/LeGall_5x3_h0.png)
![5x3 wavelet h0 taps](https://github.com/nsprljan/ImageCodingResearchTools/raw/master/Wavelet/LeGall_5x3_h0.png)

### Frequency and phase characteristic ###
With **wavelet\_char**:

>> wavelet_char('CDF_9x7','CDF_9x7','d','plot');

![9x7 wavelet frequency characteristic](https://github.com/nsprljan/Matlab/raw/master/Wavelet/wavelet_9x7_char_freq.png)
![9x7 wavelet phase characteristic](https://github.com/nsprljan/Matlab/raw/master/Wavelet/wavelet_9x7_char_phase.png)
![9x7 wavelet frequency characteristic](https://github.com/nsprljan/ImageCodingResearchTools/raw/master/Wavelet/wavelet_9x7_char_freq.png)
![9x7 wavelet phase characteristic](https://github.com/nsprljan/ImageCodingResearchTools/raw/master/Wavelet/wavelet_9x7_char_phase.png)

### 2D wavelet ###
As a tensor product of 1D wavelets, with **wavelet2D**:

>> wavelet2D('LeGall_5x3',5,'d','l','l');

![2D wavelet](https://github.com/nsprljan/Matlab/raw/master/Wavelet/2Dwavelet.png)
![2D wavelet](https://github.com/nsprljan/ImageCodingResearchTools/raw/master/Wavelet/2Dwavelet.png)

### Wavelet packet decomposition ###

Expand All @@ -147,10 +147,10 @@ As a tensor product of 1D wavelets, with **wavelet2D**:

Wavelet packet subband tree:

![Wavelet packet subband tree](https://github.com/nsprljan/Matlab/raw/master/Wavelet/wavelet_packet_subband_tree.png)
![Wavelet packet subband tree](https://github.com/nsprljan/ImageCodingResearchTools/raw/master/Wavelet/wavelet_packet_subband_tree.png)

Wavelet packet transform coefficients:

![Wavelet packet transform coefficients](https://github.com/nsprljan/Matlab/raw/master/Wavelet/Lena_transform_coefficients.jpg)
![Wavelet packet transform coefficients](https://github.com/nsprljan/ImageCodingResearchTools/raw/master/Wavelet/Lena_transform_coefficients.jpg)


4 changes: 2 additions & 2 deletions ZerotreeCoding/README.md
@@ -1,7 +1,7 @@
Zerotree Coding Toolbox
=======================

Image compression based on wavelets, using zerotrees of wavelet coefficients. Uses [Wavelet](https://github.com/nsprljan/Matlab/tree/master/Wavelet) and [Quality Assessment](https://github.com/nsprljan/Matlab/tree/master/QualityAssessment) toolboxes. The SPIHT binaries required for function spspiht.m can be downloaded from the SPIHT image compression homepage, see below.
Image compression based on wavelets, using zerotrees of wavelet coefficients. Uses [Wavelet](https://github.com/nsprljan/ImageCodingResearchTools/tree/master/Wavelet) and [Quality Assessment](https://github.com/nsprljan/ImageCodingResearchTools/tree/master/QualityAssessment) toolboxes. The SPIHT binaries required for function spspiht.m can be downloaded from the SPIHT image compression homepage, see below.


Functions
Expand All @@ -21,7 +21,7 @@ Examples
--------
SPIHT algorithm flow-chart:

![SPIHT algorithm flow-chart](https://github.com/nsprljan/Matlab/raw/master/ZerotreeCoding/SPIHT_flowchart.png)
![SPIHT algorithm flow-chart](https://github.com/nsprljan/ImageCodingResearchTools/raw/master/ZerotreeCoding/SPIHT_flowchart.png)

**spiht_wpackets** with dyadic DWT, as in the original SPIHT:

Expand Down

0 comments on commit 92c009e

Please sign in to comment.