hi,
I am trying to process the attached image: my aim is to select the spots (brighter spots for example) seen in the image manually and filter them out using a circular mask. I use ginput to select the spots. I can filter a single spot easily however i cannot make my code so that I can place the multiple masks. I try to this with loop and it did not work. I would appreciate any suggestion how to mask more than one spots.
this is the code for single spot masking
clear all close all
pwd
dp=imread('012_02.tif'); dp=dp([2:126],[2:126]);
X=-62:1:62 %mesh size in X Y=-62:1:62 %mesh size in Y %grid for mask [x y]=meshgrid(X,Y); % for Camera
figure('Name', 'Center of Ronchi'); set(gcf, 'Position', get(0,'Screensize')); imshow(dp); prompt = 'select the center of Ronchi and click ENTER'; [pos]=ginput; [rows columns] = size(pos) r=row
o(1)=subplot(1,2,1); imshow(dp,'parent',o(1)); title('total');
hold(imgca,'on') plot(imgca,pos(:,1), pos(:,2), 'ro') hold(imgca,'off')
o(2)=subplot(1,2,2); imshow(dp,'parent',o(2));title('filtered');
hold(imgca,'on') plot(imgca,pos(:,1), pos(:,2), 'ro') hold(imgca,'off')
if pos(1)>max(X); xoff=x+(max(X)-pos(1)); else xoff=x+(-max(X)+pos(1)); end if pos(2)>max(Y) yoff=y+(max(Y)-pos(2)); else yoff=y+(-max(Y)+pos(2)); end
Dsize=5 %size of a mask
Diff_select = ((xoff).^2+(yoff).^2 < Dsize.^2) %mask centered on the selected spot
Detector1=double(dp).*Diff_select; %Masked image
imshow(Detector1);
I tried to do looping without success.
for i = 1 :r
if pos(i,1)>max(X); xoff=x+(max(X)-pos(i,1)); else xoff(i)=-pos(i,1); end
if pos(i,2)>max(Y) yoff=y+(max(Y)-pos(i,2)); else yoff(i)=pos(i,2); end
end