Android Question OpenCV Setting Color Background


Licensed User
Hi all, does anyone know or is familiar enough with OpenCV, specifically i would like to know if it would be possible to change an image's background, let's say I take a picture and I want to only change the background's color to let's say Black.

Or is it possible to extract the desired objects from the image and super impose them onto another image with a black background, i know this may be a long shot, but i'm really not too familiar with OpenCV, just started playing around with it and it seems it has great potential.

I know this can be done using software such as Photoshop etc, what i'm looking for is a solution that can work programmatically.

Any thoughts?


Well-Known Member
Licensed User
The key here is to programatically identify what is foreground and what is a background for a given image.
For instance, If foreground is a person and background is a single color (Chroma key), it is easy to do it by getting contours and then performing some operations on the Mats that hold the image data.
If both foreground and background have complex or varying colors, other techniques might apply, but will depend on each case.
Upvote 0