Blob detection scaling correction in vignette
Opened this issue · 0 comments
Hi,
thanks for the great package!
Just a quick note on section 5 in the vignette (“blob detection”) on https://cran.rstudio.com/web/packages/imager/vignettes/gettingstarted.html. I think there is a small error in how the Hessian determinant is scaled:
#Compute determinant at scale "scale".
hessdet <- function(im,scale=1) isoblur(im,scale) %>% imhessian %$% { scale^2*(xx*yy - xy^2) }
#Note the scaling (scale^2) factor in the determinant
plot(hessdet(hub,1),main="Determinant of the Hessian at scale 1")
As far as I understand, the scale factor here is not defined as sigma^2, but as sigma (where sigma is the sd of the Gaussian blur), so the scaling of the hessian determinant should be with sigma^4, and not with sigma^2.
hessdet <- function(im,scale=1) isoblur(im, scale) %>% imhessian %$% { scale^4*(xx*yy - xy^2) }
I tested this out in practice, and only a scale^4 factor yields the expected behavior (e.g. recognizing roughly the same objects under image rescaling).
Best,
Fabian