optimized canny.c