0
$\begingroup$

I have an image and I am trying to find its rows and columns.

A = imread('lena.jpg'); 
nrows = size(A,1)
ncols = size(A,2)

This is 3 dimensional matrix. Output of this 512 and 512. I know A is the matrix but how can I know value of for example A[211][312] ? I want to use convolution filter to the image, obtain new matrix and turn it into a picture like "lena with blur".

$\endgroup$
  • $\begingroup$ What do you mean by 3-dimensional ? Is it a color image? $\endgroup$ – Laurent Duval May 26 at 12:07
  • $\begingroup$ yes it is a color image $\endgroup$ – Oğuzhan Kırlar May 26 at 12:07
1
$\begingroup$

You can iterate for each channel:

data = double(imread('lena.jpg'));
data = data/255; % Potentially optional
dataFilt = zeros(size(data));
nChan = size(data,3);
kernelFilter = ones(11,11)/121;
for iChan = 1:nChan
      dataFilt(:,:,iChan) = filter2(kernelFilter,data(:,:,iChan));
end
subplot(1,2,1)
imagesc(data)
xlabel('Picture')
subplot(1,2,2)
imagesc(dataFilt)
xlabel('Picture with blur')
| improve this answer | |
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.