seleucia
seleucia

Reputation: 1056

Matlab smoothing

How can apply user-defined mask as a vector e.g. [1 1 1].

img=imread('xxx.jpg');
mask=[1,1,1];
f=conv2(img,mask);

"Undefined function 'conv2' for input arguments of type 'double' and attributes 'full 3d real'."

Upvotes: 0

Views: 105

Answers (2)

mat_rix12
mat_rix12

Reputation: 1

if you want to apply a mask to your image you can try to use the following example:

                Im2 =rgb2gray (fr);                   
                fr=Im2.*uint8(mask); 

Upvotes: 0

lakshmen
lakshmen

Reputation: 29064

Color images are 3 dimensional arrays (x,y,color). conv2 is only defined for 2-dimensions, so it won't work directly on a 3-dimensional array.

You can use an n-dimensional convolution, convn() instead of conv2(). Another possibility is to take each color separately and do a conv2()

Upvotes: 1

Related Questions