Note that there are some explanatory texts on larger screens.

plurals
  1. POSome error with Adaptive median filter code
    primarykey
    data
    text
    <pre><code>%% Adaptive Median Filtering - The Code ip1 = imread ('lena.gif'); %% Undistorted image ip = imnoise (ip1,'salt &amp; pepper',0.25); %% Image corrupted with 'Salt and Pepper Noise' ip_median_filt1 = medfilt2(ip); %% Apply median filter to noisy image with window dimensions of 3x3 pixels ip_median_filt2 = medfilt2(ip,[4,4]); %% Apply median filter to noisy image with window dimensions of 4x4 pixels figure(1), clf; subplot (2, 1, 1), imshow (ip, []); subplot (2, 1, 2), imshow (ip_median_filt1, []); %% We now proceed with the adaptive median filtering of the noisy image and %% prove that the results are better than those of the standard median filter %% shown above %% Packing zeros around the edge pixels of the noisy input image so as to %% allow the facilitate the processing of edge-pixels of the image ip_edge = zeros (212,276); ip_convert = double (ip); %%%%%%%%%% there seems to be error on the following line ip_edge (11:202, 11:266) = ip_edge (11:202, 11:266) + ip_convert; smax=9; for i=11:202 for j=11:266 sx=3; sy=3; while ((sx&lt;=smax) &amp;&amp; (sy&lt;=smax)) ip_edge_min = ip_edge (i, j); ip_edge_max = ip_edge (i, j); ip_edge_median = median(median(ip_edge((i-floor(sx/2)):(i+floor(sx/2)),(j-floor(sy/2)):(j+floor(sy/2))))); for k= (i-floor (sx/2)) :( i+floor (sx/2)) for l= (j-floor (sy/2)) :( j+floor (sy/2)) if ip_edge (k, l) &lt; ip_edge_min ip_edge_min = ip_edge (k, l); end if ip_edge (k, l) &gt; ip_edge_max ip_edge_max = ip_edge (k, l); end End end A = ip_edge_median - ip_edge_min; B = ip_edge_median - ip_edge_max; if (A&gt;0) &amp;&amp; (B&lt;0) C = ip_edge (i, j) - ip_edge_min; D = ip_edge (I) - ip_edge_max; if (C&gt;0) &amp;&amp; (D&lt;0) pledge (i, j) = ip_edge (i, j); break else ip_edge (i, j) = ip_edge_median; break end else sx=sx+2; sy=sy+2; if (sx&gt;smax) &amp;&amp; (sy&gt;smax) ip_edge(i,j) = ip_edge(i,j); end end end end end end figure(2), clf; imshow(ip_edge,[]); </code></pre> <p>I am getting an error at the line with the %%%%%%%%%%: </p> <blockquote> <p>??? Error using ==> plus Matrix dimensions must agree. Error in ==> adaptive at 22 ip_edge (11:202, 11:266) = ip_edge (11:202, 11:266) + ip_convert;</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload