Back to articles
How Background Removal Actually Works Under the Hood

How Background Removal Actually Works Under the Hood

via Dev.to TutorialMichael Lip

I used to think background removal was a simple image processing task -- detect edges, find the boundary of the subject, cut everything outside. Then I tried to implement it from scratch and realized why tools like Photoshop charge what they do. Edge detection alone can't distinguish a person's hair from a similarly-colored background. Traditional image processing can't tell the difference between a subject and an object of the same color behind them. Real background removal requires understanding what's in the image, and that requires machine learning. Here's how it actually works, from the traditional approaches to the neural network models running in modern tools. The traditional approach: color-based segmentation The simplest background removal technique assumes the background is a uniform color -- typically green or blue. This is chroma keying, the technology behind every green screen. import cv2 import numpy as np def chroma_key ( image , lower_green , upper_green ): hsv = cv2 .

Continue reading on Dev.to Tutorial

Opens in a new tab

Read Full Article
3 views

Related Articles