how to subtract a dynamic mask from an image
3 views (last 30 days)
Show older comments
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/227397/image.jpeg)
3 Comments
Image Analyst
on 4 Jul 2019
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.
Answers (1)
KSSV
on 4 Jul 2019
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 Comments
See Also
Categories
Find more on Author Block Masks in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!