Giter VIP home page Giter VIP logo

chromacam's Introduction

ChromaCam

Using Raspberry Pi and CSI camera module to do green screen. With this program you can do greeen screen images. Taking out the background and replacing them with a different background.

Using the following libraries within Python

import sys import pygame from pygame import locals from picamera import PiCamera from time import sleep, time import subprocess import os import shlex import glob import tweepy

Also, needs ImageMagick install as it does the removing of the back. It's the convert commands you see in the code. ImageMagick is in the repository on the Raspberry Pi so just sudo apt install imagemagick - will install it.

Copy code to folder /home/pi/chromaCam Create subfolder

sourcebg - storage for possible background images background - where background images are stored at the required resolution

Also, needed an overlap_640.png (assuming resolution is 640x480) that is added to the image when it is tweeted. This file is in the /home/pi/chromaCam folder

With these 2 sub folders you can start with images at any resolution and store them in sourcegb. When the code starts it copies the images and resizes them putting them in the background folder.

Use keys left/right to change the background and enter to take a picture and tweet it. Alternative if you have a gamepad attached can use the gamepad I use a small Bluetooth gamepad as it's hardly visible in the persons hand and means the person can control the background the final picture themself.

#The way it works is Begin by getting the value for the background from the top right corner. This is the colour to be removed so usually is a green Then save an image file and using ImageMagick remove the green identified previously. With different light and shade the green will not always be the same, so there is a variable called fuzzpercent that sets how close to the selected colour the green needs to be. From experience 20% is a good setting. Anything else and the lighting needs to be very even. Anything more and people start losing their shirt and faces. It's worth playing with fuzzpercent if you are not removing all the green (make it bigger) or removing part of the person in front (make it smaller)

chromacam's People

Contributors

winkleink avatar

Watchers

Jeff avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.