-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoutput_gLoG_blob_centers.m
34 lines (27 loc) · 1.12 KB
/
output_gLoG_blob_centers.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function output_gLoG_blob_centers(maximaLoc, outputImg, label, outputPath)
[yy,xx] = find(maximaLoc>0);
imgH = size(outputImg,1);
imgW = size(outputImg,2);
for i=1:length(yy)
if (yy(i)>3)&&(yy(i)<imgH-3)&&(xx(i)>3)&&(xx(i)<imgW-3)
outputImg(yy(i)-3:yy(i)+3, xx(i), 1) = 0;
outputImg(yy(i), xx(i)-3:xx(i)+3, 1) = 0;
outputImg(yy(i)-3:yy(i)+3, xx(i), 2) = 255;
outputImg(yy(i), xx(i)-3:xx(i)+3, 2) = 255;
outputImg(yy(i)-3:yy(i)+3, xx(i), 3) = 0;
outputImg(yy(i), xx(i)-3:xx(i)+3, 3) = 0;
end
end
if strcmp(label, 'bright')==1
outputFileName = [outputPath,'_blobCenters_bright.tif'];
imwrite(uint8(outputImg), outputFileName, 'tif');
outputFileName = [outputPath,'_blobCenters_bright.mat'];
coord = [yy xx];
save(outputFileName, 'coord', '-mat');
elseif strcmp(label, 'dark')==1
outputFileName = [outputPath,'_blobCenters_dark.tif'];
imwrite(uint8(outputImg), outputFileName, 'tif');
outputFileName = [outputPath,'_blobCenters_dark.mat'];
coord = [yy xx];
save(outputFileName, 'coord', '-mat');
end