Convolution Coding in Matlab

1 回表示 (過去 30 日間)
Matpar
Matpar 2019 年 10 月 18 日
コメント済み: Matpar 2019 年 10 月 21 日
HI Professionals,
I am back at it again, this time i am trying to figure out how to code convolution within matlab for 1D data
my data below;
I have variable f & g and I would like to perform convolution (f*g) placing the values into (h)
f = [10,50,60,10,20,40,30];
g =[1/3,1/3,1/3];
I am trying to code this process in matlab so that the (filter "g") slides over (f) and where there is no numbers
I must implement (padding) a zero (0).
it is challenging to understand how to code g sliding over f 1Dimensionally to get values of an object of interest in an image
This is an example image of what I am trying to code, for the variables defined at the top!(Please Ignore The Integers In the Image)
Thank you in advance for assisting me once more with my rediculous questions and experiments
Screenshot 2019-10-18 at 07.45.23.png

採用された回答

Andrei Bobrov
Andrei Bobrov 2019 年 10 月 18 日
h = conv(f,g,'valid')
  6 件のコメント
Matpar
Matpar 2019 年 10 月 21 日
Thanx Andrei,
Matpar
Matpar 2019 年 10 月 21 日
Hi Andrei,
I thinkI am doing something wrong, a humble request for you to guide me please!!my code!
I have an image but the system keep saying A and B must be vectors and i am not sure how to understand it!
please take a look!
im = imread('bird.jpg');
[r, c]=size(im);
im=zeros(r,c);
g=[1/3,1/3,1/3];
h = padarray(conv(im,g,'valid'),[0,numel(g)-1]);
disp(h);
bird.jpg

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Segmentation and Analysis についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by