フィルターのクリア

calculating average

2 ビュー (過去 30 日間)
FIR
FIR 2012 年 3 月 5 日
I have 60 images in a folder ,i want to take average of those images and subtract the averaged image with other images please help
clc;
clear all
close all;
pathname ='F:\images
dirlist = dir( [pathname '*.jpg'] );
pickind='jpg';
for m2 = 1:length(dirlist)
R = imread([pathname, dirlist(m2).name]);
;
;
;
;
end
please tell how to process after reading that image

採用された回答

Andrew Newell
Andrew Newell 2012 年 3 月 5 日
Here is some code that might do the job. I am assuming that your image is truecolor, so the data have dimensions M x N x 3 for some M and N, and the colors are 24-bit, so the data type in R is uint8. If your images are different, you'll have to adjust the code:
n = length(dirlist);
R = imread([pathname, dirlist(1).name]);
RR = zeros([size(Rav) n]);
% Put the images into an M x N x 3 x 60 array
for m2 = 2:n
RR(:,:,:,m2) = imread([pathname, dirlist(m2).name]);
end
Rav = mean(RR,4); % average along the 4th dimension of the data
RR = bsxfun(@minus,RR,Rav); % subtract the average from each image
You can examine the kth image with
R = RR(:,:,:,k);
image(R)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by