write snake algorithm and AI_scan for hysterese in ivCamera