- #1

- 65

- 0

gaussImage: Filters a image with a gaussian filter

gaussPyramid: Uses gaussImage to filter the same image several times with different std.

diffOfGaussians: Uses gaussPyramid to compute the difference between consecutive filtered images

findDogMaximas: Finds local maximas in a image, by setting it to minus it also finds minimum

dogDetector: Finds extreme points from all layers of filtered images and stores them in a 3xN vector.

findDogmaximas takes about 15 min to run and dogDetector takes over 1 hour!

findDogmaximas has a vector that changes size for every loop iteration since I don't know how many extreme potins that exists in an Image.

Computer specifications:

Lenovo Laptop

i7-3632QM Processor

CPU 2.2 GHz

8 GB RAM

64-bits operativesystem

Code:

Code:

```
function maxima = findDogMaximas(dogLower,dogMiddle,dogHigher)
maxima=[];
nrofmaxima=0;
[M ,N]=size(dogMiddle);
count_middle=0;
count_lower=0;
count_higher=0;
for j=2:1:M-1
for k=2:1:N-1 for x=-1:1:1
for z=-1:1:1
if dogMiddle(j+x,k+z)<dogMiddle
count_middle=count_middle+1;
end
if dogLower(j+x,k+z)<dogLower
count_lower=count_lower+1;
end
if dogHigher(j+x,k+z)<dogHigher
count_higher=count_higher+1;
end
end
end
sum=count_middle+count_lower+count_higher;
if sum<26
nrofmaxima=nrofmaxima+1;
maxima(1,nrofmaxima)=j;
maxima(2,nrofmaxima)=k;
end
end
end
end
```

Code:

```
function detected = dogDetector(im)
tic
k=2.^(1/3);
stds=zeros(1,9);
for x=1:1:9
stds(1,x)=k^(x-1);
end
stds=1.6.*stds;
DoG=diffOfGaussians(im,stds);
n=length(DoG);
detected=[];
for i=2:1:n-1
dogLower=DoG{i-1};
dogMiddle=DoG{i};
dogHigher=DoG{i+1};
maxima=findDogMaximas(dogLower,dogMiddle,dogHigher);
minima=findDogMaximas(-dogLower,-dogMiddle,-dogHigher);
dog_stdsi=[maxima minima];
dog_stdsi(3,:)=stds(i);
detected=[detected dog_stdsi];
end
toc
end
```