Giter Site home page Giter Site logo

per6-chen-dong-webcamarcade's Introduction

Webcam-Arcade

Games that involve image processing through the webcam.

Instructions

  • Compile using "javac -cp .:libs/* *.java" or "javac -cp .;libs/* *.java" on Windows machines
  • Run the program with "java -cp .:libs/* Driver" or "java -cp .;libs/* Driver"
    • It is expected for terminal to default to a no-operation implementation
  • Get a distinct color that you wish to track, preferably a light source and cover the entire square in the center. Press any button to begin tracking this color
    • You may press any key besides the following keys to track a new color
  • Switch between screens with the following keys:
    • Press S to enter the Setup Screen (Default Screen)
    • Press D to enter the Draw Screen
    • Press P to enter the Pong Screen

Drawing

  • Once you enter the draw screen, press any key besides 'z' and 'r' to draw a rectangle
  • Draw screen supports undo and redo. Press z to undo and r to redo

Pong

Classes, Algorithms, Data Structures, etc...

Hierarchy and Class Descriptions

Driver

  • Entrance to the program
  • Creates The WebcamPanel, SetupScreen, etc...
  • Has a stack of screens
    • peek() the top of the stack and pass down the method paintImage(), which is like a while loop (more like a thread that is constantly updated in the WebcamPanel)

Screen

  • Interface
  • Describes general methods that screens should have. Look into code for more info

SetupScreen

  • Records the color of the object to be tracked
  • Allows the user to test if the color is distinct enough before selecting a different screen

DrawScreen

  • Allows the user to draw
  • Contains a LinkedList of history of commands and a Stack of optional redo commands

PongScreen

  • Classic Pong game

Algorithms

Mean Shift Algorithm

  • Separate colors into RGB (red green blue)
  • Find the weighted mean of all the colors in a Rectangle, then move to that mean
    • The weight is given by w = e^(-k*Distance(colorTracked, colorPixel)^2)
    • Credits to cmsoft.com and its color tracking case study

Undo/Redo in DrawScreen

  • All commands are added to the end of the linkedlist (like a stack, but we need to iterate through the list to draw the rectangles)
  • Any undo commands are pushed onto a redo stack

per6-chen-dong-webcamarcade's People

Contributors

ezchen avatar junhaodong avatar

Watchers

James Cloos avatar Caspar Lant 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.