Image focal point detection algorithm