Other ways to detect edges?

I’ve tried to do this and seems like it could work, I can’t figure it out though… Do you have a tutorial or something similar I could take a look at?