Using AI to Prototype Affinity Photo’s Smart Background Erase Brush

I used AI to help prototype a smart background erase brush similar to the one in Affinity Photo. The idea was to create an eraser that understands the difference between the background and the subject instead of just deleting everything under the brush.

I tried a few different approaches based on my own ideas of how the brush might actually work, but none of them really panned out. So I decided to give AI a shot. We first built an example in C++ to test the concept and make sure the algorithm was actually working and wasn’t just a fluke. Once it was verified, I had AI write a tutorial explaining the algorithm and then gave that documentation to a different AI to implement it using Crystal and GLFW.

The actual algorithm is around 328 lines of crystal code.

Here is the result.

3 Likes