MATLAB: Finding the mean of a group of images

filterimageimage processingmean

Hello everyone,
So I am trying to find the mean of a group of images so I can compare their mean before and after the filter.
for l = 1:numel(bmpFiles)
%applying the filter
bflt_img1{l} = bfilter2(img1{l},w,sigma);
%finding the average of the images
I0 = imread(img1{l});
sumImage = double (I0)
grayImage = imread(img1{l+1});
sumImage = sumImage + double(grayImage);
meanImage = sumImage / numel(bmpFiles);
end
However, I get this error message:
Error using imread>parse_inputs (line 504)
The file name or URL argument must be a character vector or string scalar.
Error in imread (line 342)
[source, fmt_s, extraArgs, was_cached_fmt_used] = parse_inputs(cached_fmt, varargin{:});
Error in bil1_MH (line 21)
I0 = imread(img1{l});
Is there a problem with using img1{L} as a format to refer to the image?
Thanks in advance.

Best Answer

bfilter2() is not part of MATLAB, so we do not know what it does. There is a File Exchange contribution https://www.mathworks.com/matlabcentral/fileexchange/12191-bilateral-filtering but it would give an error if img1{l} were not floating point. Either you are using a different bfilter2() or else img1{l} is floating point.
If img1{l} is floating point, that would explain the error message when you tried to imread() it. If you have already read the data into img1 then just
I0 = img1{l};
Related Question