MATLAB Answers

Convolution of an image.

4 views (last 30 days)
The Eagle
The Eagle on 30 May 2020
Answered: Image Analyst on 30 May 2020
I've done this code to convolve an image but I keep on getting this error.
Undefined function or variable 'convolve'
This is my code: (I'm using R2015a)
clc;
clear all;
close all;
RGB = imread('C:\Users\zahab\Downloads\Patrick.jpg');
subplot(1,2,1);
imshow(RGB);
I = rgb2gray(RGB);
M=[
0,0,-1,0,0;
0,-1,-2,-1,0;
-1,-2,16,-2,-1;
0,-1,-2,-1,0;
0,0,-1,0,0;
];
buffer = convolve(I,M);
subplot(1,2,2);
imshow(buffer);.

  0 Comments

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 30 May 2020
I think you want
buffer = conv2(double(I),M, 'same');
imshow(buffer, []);

  0 Comments

Sign in to comment.


Translated by