Detection of cosmic filaments using the Candy model