Subscripted assignment dimension mismatch.

3 Ansichten (letzte 30 Tage)
vetri veeran
vetri veeran am 15 Dez. 2014
Bearbeitet: Thorsten am 15 Dez. 2014
program code:
original_im=imread('Picture1.tif');
pad_org=padarray(original_im,[1 1],'both'); figure(3);imshow(pad_org);title('With Zero Padding Original Image at Boundary')
for i=1:size(pad_org,1)-2 for j=1:size(pad_org,2)-2 window=[1 2 1;2 4 2;1 2 1]; %% Matrix to store the value of 3 by 3 window win_inc=1;%%initial value of window matrix for k=1:size(window)/3 for l=1:size(window)/3 window(win_inc)=pad_org(i+k-1,j+l-1); win_inc=win_inc+1; end end mean=(1/9)*sum(window); new_image(i,j)=mean; end end new_image=uint8(new_image); figure(4);imshow(new_image);title('Image After Mean Filtering')
  1 Kommentar
Adam
Adam am 15 Dez. 2014
Please use the {} code formatting block so people can read your code more easily.
And please show complete error messages (with line number) and formulate a question rather than just posting code and expecting people to plough through it and work it all out for themselves!

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Thorsten
Thorsten am 15 Dez. 2014
Bearbeitet: Thorsten am 15 Dez. 2014
You can use
Im = blkproc(I, [3 3], 'mean2');

Community Treasure Hunt

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

Start Hunting!

Translated by