0

I am asked to use conv2 to do the convolution of the red component of an image and a rectangle function but I get an error and I don't know how to handle it.

img = imread('test.png');
RED = img(:,:,1);
RECT = ones(10,1) / 10;

J= conv2(double(RED), RECT);

imagesc(J)

The error says Subscript indices must either be real positive integers or logicals.

Thanks

ferrou
  • 11
  • 1
  • 1
    P1 is not defined. Create a [MCVE] – Sardar Usama Nov 06 '17 at 20:39
  • 2
    Based on what little you showed us, I'm guessing you named a variable `imread`, `double`, or `conv2`. Type `clear imread double conv2` and retry your code. – gnovice Nov 06 '17 at 20:41
  • P1 is RECT, forgot to correct it. Thank you gnovice, in my notebook I named conv2 the calculation of a 1D convolution and I didn't notice.. – ferrou Nov 06 '17 at 20:51

0 Answers0