Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/JerrickLiu/Mask-generator

Various functions to generate masks for images and replace the background of images with some other image of your choosing
https://github.com/JerrickLiu/Mask-generator

Last synced: 3 months ago
JSON representation

Various functions to generate masks for images and replace the background of images with some other image of your choosing

Awesome Lists containing this project

README

        

# Mask generator
Various functions to generate masks for images and replace the background of images with a color or some other image of your choosing

## Usage and examples

All you need is Python's computer vision library OpenCV2 to run these functions. Specifiy the image folder where you want the mask applied to in the arguments and that's it.

Once done, the code first generates a mask for the image by thresholding. Certain values above a threshold turn to white pixels and other values below a threshold turn to black pixesl. Play around with the thresholding for your specific images.

Here are a few examples with a mask applied to an image of an apple then replacing all 0 valued pixels (black) to be a different color:

drawing

drawing

drawing