%
% read an image %%
img = imread('path_to_image'); %%any image
gray = rgb2gray((img));%%filter mask
prx= [1,0,1;-1,0,1;-1,0,1];[hk,wk]= size(prx);pad1 = ( wk-1) / 2;%%zero padding
image1 = padarray(gray,[pad1,pad1],'both');%%image1 = round(image1); %%I tried to convert it in logical and double but got the same error at roi line
[ih,iw] = size(image1);output = zeros(ih,iw);[rows,cols] = size(image1);for y=pad1:pad1+ih for x=pad1:pad1+iw roi = image1(y-pad1:y+pad1+1,x-pad1:x+pad1+1); %%error at this line()
k= roi.*prx; endend
Best Answer