资源简介
SHINEtoolbox是MATLAB的脚本程序,应用于处理视觉刺激,可消除刺激图像的低阶属性差异。
代码片段和文件信息
% average = avgHist(imagesmask)
%
% Averages the histograms across a set of grayscale images
%
% INPUT:
% (1) images: a cell (1xN or Nx1) that contains N source image matrices
% Example 1:
% images = cell(31);
% images{1} = pic1;
% images{2} = pic2;
% images{3} = pic3;
% Example 2:
% [imagesN] = readImages(pathnameimformat);
% (2) mask: optional; can be a single matrix (of the same size as the
% pictures) or a cell of N matrices; mask contains ones where the
% histograms are obtained (e.g. foreground) and zeros elsewhere
%
% OUTPUT:
% (1) average: average histogram (vector)
% ------------------------------------------------------------------------
% SHINE toolbox May 2010
% (c) Verena Willenbockel Javid Sadr Daniel Fiset Greg O. Horne
% Frederic Gosselin James W. Tanaka
% ------------------------------------------------------------------------
% Permission to use copy or modify this software and its documentation
% for educational and research purposes only and without fee is hereby
% granted provided that this copyright notice and the original authors‘
% names appear on all copies and supporting documentation. This program
% shall not be used rewritten or adapted as the basis of a commercial
% software or hardware product without first obtaining permission of the
% authors. The authors make no representations about the suitability of
% this software for any purpose. It is provided “as is“ without express
% or implied warranty.
%
% Please refer to the following paper:
% Willenbockel V. Sadr J. Fiset D. Horne G. O. Gosselin F.
% Tanaka J. W. (2010). Controlling low-level image properties: The
% SHINE toolbox. Behavior Research Methods 42 671-684.
%
% Kindly report any suggestions or corrections to verena.vw@gmail.com
% ------------------------------------------------------------------------
function average = avgHist(imagesmask)
if iscell(images)== 0
error(‘The input must be a cell of image matrices.‘)
elseif min(size(images)>1)
error(‘The input cell must be of size 1 x numim or numim x 1.‘)
end
if nargin > 1
if iscell(mask) == 0
m = mask;
elseif max(size(mask))~=max(size(images)) || min(size(mask))~=min(size(images))
error(‘The size of the input cells must be equal.‘)
end
end
numim = max(size(images));
pixels = 0;
for im = 1:numim
if ndims(images{im}) == 3
images{im} = rgb2gray(images{im});
end
im1 = images{im};
if nargin > 1
if iscell(mask) == 1
m = mask{im};
end
if sum(size(m)~=size(im1)) > 0
error(‘The size of the mask must equal the size of the image.‘)
elseif numel(m(m==1))==0
error(‘The mask(s) must contain some ones.‘)
end
counts = imhist(im1(m==1));
else
counts = imhist(im1);
end
pixels = pixels+counts;
end
a
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2010-11-30 13:54 SHINEtoolbox\
文件 3033 2010-11-26 11:17 SHINEtoolbox\avgHist.m
文件 1602 2010-11-26 11:17 SHINEtoolbox\getRMSE.m
文件 1886 2010-11-26 11:17 SHINEtoolbox\hist2list.m
文件 4480 2010-11-26 11:18 SHINEtoolbox\histMatch.m
文件 3677 2010-11-26 11:18 SHINEtoolbox\imstats.m
文件 5137 2010-11-26 11:18 SHINEtoolbox\lumMatch.m
文件 2607 2010-11-26 11:18 SHINEtoolbox\match.m
文件 2460 2010-11-26 11:19 SHINEtoolbox\readImages.m
文件 2973 2010-11-26 11:19 SHINEtoolbox\rescale.m
文件 2700 2010-11-29 15:22 SHINEtoolbox\separate.m
文件 3846 2010-11-30 13:25 SHINEtoolbox\sfMatch.m
文件 2300 2010-11-30 11:59 SHINEtoolbox\sfPlot.m
文件 14411 2010-11-26 11:19 SHINEtoolbox\SHINE.m
文件 3258 2010-11-26 11:20 SHINEtoolbox\specMatch.m
文件 1911 2010-11-29 16:11 SHINEtoolbox\spectrumPlot.m
文件 5726 2010-11-26 11:11 SHINEtoolbox\ssim_index.m
文件 2006 2010-11-26 11:11 SHINEtoolbox\ssim_sens.m
文件 3111 2010-11-26 11:21 SHINEtoolbox\tarhist.m
目录 0 2010-11-30 13:54 SHINEtoolbox\SHINE_TEMPLATE\
目录 0 2010-11-30 13:54 SHINEtoolbox\SHINE_OUTPUT\
目录 0 2010-11-30 13:54 SHINEtoolbox\SHINE_INPUT\
文件 78436 2010-11-26 11:11 SHINEtoolbox\SHINE_INPUT\scene1.tif
文件 78972 2010-11-26 11:11 SHINEtoolbox\SHINE_INPUT\scene2.tif
目录 0 2010-11-30 13:54 SHINEtoolbox\SHINE_INPUT\More sample images\
文件 74192 2010-11-26 11:11 SHINEtoolbox\SHINE_INPUT\More sample images\Car41.tif
文件 73960 2010-11-26 11:11 SHINEtoolbox\SHINE_INPUT\More sample images\chair20.tif
文件 73984 2010-11-26 11:11 SHINEtoolbox\SHINE_INPUT\More sample images\face14a.tif
评论
共有 条评论