📄 scieerror.m
字号:
function [aveError, maxError, minError]=scieError(originalTIFF, compJPEG)%% [aveError, maxError]=scieError(originalTIFF, compJPEG)%% scieError returns the average (aveError), maximum (maxError) and% minimum error between the originalTIFF (a filename) and the% compressed JPEG (also a filename). The error is in CIELAB error% units, and is corrected for spacial viewing on a 72 DPI monitor at% 18 inches.%% load original[rOrig gOrig bOrig]=tiffread(originalTIFF);% load compressed version[rComp gComp bComp]=jpgread(compJPEG);% samples per degree at 18 inches, 72 DPI monitorsampPerDeg = 23;% Load in spectral power distributions of a sample monitor.% (these can be obtained from Wandell's S-CIELAB package)% wavelength: a vector describing the wavelengths of the cone% sensitivities (370:73))% displaySPD: a 361x3 matrix of the spectral power distributions% of the red, green, and blue primaries%load displaySPD% Cone information also from Wandell % We usually compute with respect to the human cone estimates from% Smith and Pokorny (19XX). These are represented in the file named% SmithPokornyCones.mat %% The file contains the following variables:% % wavelength: a vector describing the wavelengths of the cone% sensitivities (370:73))% cones: a 361 x 3 matrix matrix describing the cone% sensitivities at the corresponding wavelengths%load SmithPokornyCones% Now, we can compute the 3 x 3 transformation that maps the linear% intensity of the display r,g,b signals into the cone absorptions% (l,m,s). rgb2lms = cones'* displaySPD;% Load in gamma correction info - also from Wandell's S-CIELAB package%% The file displayGamma.mat contains the variables% scieGamma: is a look-up table that maps % framebuffer values -> relative linear display intensity% where the maximum display intensity is 1.0.%% scieInvGamma: is the inverse of gamma and maps% relative lin. disp. intensity -> frame-buffer value% This table has been interpolated to 1024 intensity levels.%load displayGamma% Set the whitepoint to that of the monitor (should be image dependent% though)rgbWhite = [1 1 1]';whitepoint = rgb2lms* rgbWhite;% Convert the RGB data to LMS.img = [ rOrig gOrig bOrig];imgRGB = dac2rgb(img,scieGamma);origLMS = changeColorSpace(imgRGB,rgb2lms);img = [ rComp gComp bComp];imgRGB = dac2rgb(img,scieGamma);compLMS = changeColorSpace(imgRGB,rgb2lms);% Specify the color spaceimageformat = 'lms';% Run the scielab function.errorImage = scielab(sampPerDeg, origLMS, compLMS, whitepoint, imageformat);aveError=sum(sum(errorImage))/length(errorImage(:));maxError=max(max(errorImage));minError=min(min(errorImage));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -