3*3 kernal slide

조회 수: 2 (최근 30일)
ayesha abbassi
ayesha abbassi 2019년 1월 19일
답변: Image Analyst 2019년 1월 19일
I'm working on local tri directional quienry pattern (LTriDP) for 3*3 matrix it works fine but my kernal is not moving on next 3(overlapping window) matrix elements to calculate LTDP. need help how can my kernal move after calculating firts 3*3 here is the code below.
  댓글 수: 1
Walter Roberson
Walter Roberson 2019년 1월 19일
Goodness! Convert that long chain of if /else if /else if statements into if /elseif/ elseif, and then use the Smart Indent feature of the editor. Your indentation makes the code hard to follow.

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2019년 1월 19일
You need an outer double loop over rows and columns of the larger matrix, then inside that you need another double loop to go over the elements of your filter at a fixed location of the larger matrix. See attached code where I do a convolution "manually" with 4 for loops instead of using the conv2() function.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2019년 1월 19일
Why should it move? You loop i=1:3, j=1:3 and that is it.
You calculate [r ,c]=size(LTDP) but after that you never refer to r or c so at no point are you looping over the rows or columns of LTDP.
  댓글 수: 2
ayesha abbassi
ayesha abbassi 2019년 1월 19일
i=3; j=3 is the size of the kernal which it should traverse
Walter Roberson
Walter Roberson 2019년 1월 19일
Yes but you have no code to move the kernel. You would need one or more loops around the "for i" loop, moving the starting row and column.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by