• Our Lab
    • About
    • Research Themes
    • Gallery
    • Exhibitions
    • Workshops >
      • Workshop Info
      • FAQ
    • Intern Diaries
  • Projects
    • Flagship Projects
    • Summer Projects
  • Publications
  • Our Team
    • Professor Incharge
    • Alumni >
      • Batch 2014
      • Batch 2016
      • Batch 2017
      • Batch 2018
      • Batch 2019
      • Batch 2020
      • Batch 2021
      • Batch 2022
    • Core Coordinators
    • Junior Year Coordinators
  • Contact
  • Spin-offs
    • Makxenia
    • AidBots
  • Intranet
IvLabs
  • Our Lab
    • About
    • Research Themes
    • Gallery
    • Exhibitions
    • Workshops >
      • Workshop Info
      • FAQ
    • Intern Diaries
  • Projects
    • Flagship Projects
    • Summer Projects
  • Publications
  • Our Team
    • Professor Incharge
    • Alumni >
      • Batch 2014
      • Batch 2016
      • Batch 2017
      • Batch 2018
      • Batch 2019
      • Batch 2020
      • Batch 2021
      • Batch 2022
    • Core Coordinators
    • Junior Year Coordinators
  • Contact
  • Spin-offs
    • Makxenia
    • AidBots
  • Intranet

Overview

Stylus controlled snake game is similar to classical snake game but differs in the way we control it which is done by a Stylus. A stylus refers to an object of any color that is first detected and then later can be used to control the motion of the snake.

Abstract

Picture
  • For the stylus, the camera feed is taken, Gaussian blur is applied, frames are converted from BGR to HSV, morphological transformations are applied to remove noise, then thresholded to find the required part of the stylus.

Approaches used for stylus detection

  • Using trackbars to find the HSV values of the stylus, then creating a mask that hides all HSV colors other than the color of the stylus. We use contours to detect the stylus and its centroid which will help in controlling the snake later in the game.

  • ​Applying HSV backpropagation: Taking a small region of 10 x 10 pixels, we capture the stylus in that region then, backpropagate the HSV values and taking the average of the 100 HSV values of the individual pixels, we use the average HSV value obtained for the stylus detection by making a mask and thus isolating the stylus from the background. With the mask created and using various edge detections like Canny edges, we use contours to detect the stylus and hence the centroid of the contours detected which will be the controller of the snake in the game.



  • Approaches used for in-game snake movements

  • Make a list and append 10 consecutive coordinates of stylus moving. Find the maximum difference of consecutive x coordinates in the list and if it is greater than 10(significant movement in that particular direction) then the snake is assigned that direction.

  • If the stylus moves more than 40 pixels, then using the starting and initial point, the slope ‘m’ is calculated and the next coordinate of the snake is determined using the parametric equation of line [(x-x1)/cosθ = (y-y1)/sinθ = r] from the current location of the snake as (x1,y1) and r as the current speed of the snake thus allowing dynamic movement of the snake in all directions.

  • If the stylus moves more than 40 pixels, then using the starting and initial point, the slope ‘m’ is calculated and the next coordinate of the snake is determined using the parametric equation of line [(x-x1)/cosθ = (y-y1)/sinθ = r] from the current location of the snake as (x1,y1) and r as the current speed of the snake thus allowing dynamic movement of the snake in all directions.

  • Divide the screen into 4 regions that demarcate the movement directions. The region in which the stylus is present is then detected and the snake moves according to the direction allotted to that specific region.



 video:- drive.google.com/file/d/1nCrvaIU630CwWT4bjs9g17-60CQr-s-b/view
Picture
Picture

Result

Picture

Tools and Libraries used

Picture
python
Picture
Picture

Our Team

Members

  1. Lovesh Goyal
  2. Aditya Jivoji
  3. Aditya Rudra
  4. Soumyadeep Ghosh
  5. Gunjan Paliwal
  6. Sneha Tabitha
  7. Prasenjeet Kapse
  8. Aaradhy Jain
Mentors

  1. Diksha Bagade
  2. Parees Pathak
  3. Sushlok Shah
  4. Bipasha Parui
  5. Karthik Raman
GitHub Repository
Powered by Create your own unique website with customizable templates.
  • Our Lab
    • About
    • Research Themes
    • Gallery
    • Exhibitions
    • Workshops >
      • Workshop Info
      • FAQ
    • Intern Diaries
  • Projects
    • Flagship Projects
    • Summer Projects
  • Publications
  • Our Team
    • Professor Incharge
    • Alumni >
      • Batch 2014
      • Batch 2016
      • Batch 2017
      • Batch 2018
      • Batch 2019
      • Batch 2020
      • Batch 2021
      • Batch 2022
    • Core Coordinators
    • Junior Year Coordinators
  • Contact
  • Spin-offs
    • Makxenia
    • AidBots
  • Intranet