Sum modified laplacian operator

ML(p, q) =| 2I(p, q) − I(p − 1, q) − I(p + 1, q) | + | 2I(p, q) − I(p, q − 1) − I(p, q + 1) | (2.2.6) where, I(p,q) denotes the pixel value located at the position (p,q).
My Image I is of size 256x256. To implement the above line, I am getting a zero index error as I have choosen p=1:256 and q=1:256. How to avoid getting a zero index error?

답변 (1개)

KSSV
KSSV 2020년 10월 22일
편집: KSSV 2020년 10월 22일

0 개 추천

for p = 2:255
for q = 2:255
% do what you want
end
end

댓글 수: 4

Psk
Psk 2020년 10월 22일
Then the resulting matrix that i will get won't be a 256x256 matrix
KSSV
KSSV 2020년 10월 22일
You intialize it as 256*256....for the first and last index (1 and 256) you can use only the which has (p,q) and (p+1,q+1) negelcting p-1, q-1.
Or you resize your 256*256 image into a 258*258 using imresize or interp2.
Psk
Psk 2020년 10월 22일
But in that case that will be a deviation from the original formula. That is if i don't use (p-1) and q-1 for first and last index.
KSSV
KSSV 2020년 10월 22일
Then you resize your image into 258*258..

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

카테고리

도움말 센터File Exchange에서 Read, Write, and Modify Image에 대해 자세히 알아보기

질문:

Psk
2020년 10월 22일

댓글:

2020년 10월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by