How to filter the background of an image?

big field of study: Content-based image retrieval - Wikipedia

ditch Canny. that will only make things worse.

also forget about “filtering”. wrong approach. the only viable ways to do that would involve DL/AI.

instead of just using DL/AI for preprocessing, you should use DL/AI to get features describing the picture directly.