Tristan Ursell
August 2018
autocorrmat = imageautocorr(im_stack)
autocorrmat = imageautocorr(mat_data)
autocorrmat = imageautocorr('im_stack.tif')
autocorrmat = imageautocorr('im_stack.tif','load')
autocorrmat = imageautocorr('directory_path')
autocorrmat = imageautocorr('directory_path','load')
This script calculates the image autocorrelation for a (presumed) ordered time series of images. The input data also need not be images, per se, it could also be any type of ordered, correlated data.
'autocorrmat' is an autocorrelation matrix giving the normalized correlation coefficients (-1 <= c <= 1) between any two time points of the data.
'im_stack' is assumed to be a an image stack, that is, images of size M x N with Z such images, such that size(im_stack) = M x N x Z. These would already be loaded into memory.
'mat_data' is a matrix of data M x N where each column is a time point with data of length M.
'im_stack.tif' is stacked TIFF, like 'im_stack', but not loaded into memory. In this mode, the script will 'imread' each image from the stack and perform the autocorrelation without loading in the full stack. This can be useful if the image data is very large. Using the option 'load', will load the stack into memory, and proceed as if it were a stack in memory. In this mode the input is treated as a full path and file name, and as such, you can enter a full path and file name here, e.g. using fullfile(path1,file1). NOTE: Reading images into memory one-by-one will be a much slower computation than loading ('load') into memory.
'directory_path' is a directory containing *only* image files. The script will examine all files in the current directory and read them in as images, thus if you have a folder with (e.g. TIFFs, BMPs, PNGs, JPEGs, etc) that have sequential file names like:
mypic_001.png
mypic_002.png
mypic_003.png
...
this is the option you want. The option 'load', will load those files into memory for processing. NOTE: Reading images into memory one-by-one will be a much slower computation than loading ('load') into memory.
%EX:
%first create a set of correlated data
im_stack=zeros(256,256,256);
im_stack(:,:,1)=normrnd(0,1,[256,256]);
for i=2:256
im_stack(:,:,i)=im_stack(:,:,i-1)*cos(i*pi/50)+normrnd(0,1,[256,256])*sin(i*pi/250);
end
autocorrmat = imageautocorr(im_stack);
figure;
subplot(1,2,1)
imagesc(autocorrmat)
axis equal tight
xlabel('Frame')
ylabel('Frame')
colorbar
subplot(1,2,2)
for i=1:256
imagesc(im_stack(:,:,i))
axis equal tight
xlabel('X')
ylabel('Y')
title(['Frame ' num2str(i)])
pause(0.1)
end
引用格式
Tristan Ursell (2024). imageautocorr -- Autocorrelation of time-ordered data (https://www.mathworks.com/matlabcentral/fileexchange/68402-imageautocorr-autocorrelation-of-time-ordered-data), MATLAB Central File Exchange. 检索来源 .
MATLAB 版本兼容性
平台兼容性
Windows macOS Linux类别
- Image Processing and Computer Vision > Image Processing Toolbox > Image Filtering and Enhancement > Morphological Operations >
标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!版本 | 已发布 | 发行说明 | |
---|---|---|---|
1.0.0 |