필터 지우기
필터 지우기

how to subtract a dynamic mask from an image

조회 수: 6 (최근 30일)
Hanif Ullah
Hanif Ullah 2019년 7월 4일
댓글: Image Analyst 2019년 7월 4일
how to subtract a dynamic mask from an image. i m using the following code but its only working on static mask.
f=[12 30 120 220 120 130 140 150 120 220 120 120 90 80 70 80]
[r c]=size(f);
m=f(3:5)
f1 =[];
for i=1:r
for j=1:c
sub_result=abs(f(i,j)-m);
f1(i,j)=sum(sub_result(:));
end
end
  댓글 수: 3
Hanif Ullah
Hanif Ullah 2019년 7월 4일
dynamic mean that mask size is changing. like [3 4] is one mask and another mask size is [3 4 5] or may be bigger but less than original matric size.
Image Analyst
Image Analyst 2019년 7월 4일
I think you're going to have to do that manually. There is no built-in function that will scan a mask over a vector when the size and values of the mask change from element to elment as it moves over the vector to be filtered.

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

답변 (1개)

KSSV
KSSV 2019년 7월 4일
Are you looking for something like this?
I = [5 8 3 4 6 7 9 3] ;
M = [3 4] ;
M = repmat(M,1,length(I)/length(M)) ;
iwant = I-M
  댓글 수: 3
KSSV
KSSV 2019년 7월 4일
Why loop when you can achieve this?
Hanif Ullah
Hanif Ullah 2019년 7월 4일
actually repmat subtracting block by block. I want that mask subtract shift/move pixel by pixel using loop

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

카테고리

Help CenterFile Exchange에서 Author Block Masks에 대해 자세히 알아보기

제품


릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by