Git Product home page Git Product logo

opmodecamera's Introduction

OpModeCamera

UPDATED on 10/30/16 to cleanly teardown the camera in LinearOpModes consistent with the newly improved LinearOpMode format which no longer throws exceptions.

UPDATED on 9/15/16 to cleanly teardown the camera in LinearOpModes, rotate the returned images so (0,0) corresponds to the bottom left of the preview window, and clean up some imports.

UPDATED on 9/5/16 to organize files into packages for easier installation and support.

UPDATED on 9/1/16 to support the 2016/17 FTC SDK code structure

Basic FTC OpMode Functionality for using the front facing camera on the ZTE Speed phone for FTC.

DetectColor.java and LinearDetectColor.java show examples of OpModes using the camera functionality.

To use this to make your own custom OpModes, just extend OpModeCamera or LinearOpModeCamera as shown in the examples and change the code that uses the RGB pixels to perform your own image processing functions. You can use all of the normal SDK functions as well (motors, servos, sensors, gamepads, etc.).

To install (as of 9/15/16):

  • Put the for_camera_opmodes folder in the FtcRobotController java folder.
  • Put the sample_camera_opmodes folder in the TeamCode java folder.
  • Add the code in AndroidManifestCameraExtras.xml to your AndroidManifest.xml (in the FtcRobotController manifests folder) right above the "<application" line.
  • Add the code in activity_ftc_controller_camera_extras.xml to your activity_ftc_controller.xml (in the FtcRobotController res/layout folder) right before the last < /RelativeLayout > line.
  • Add the code in FtcRobotControllerActivityCameraExtras to your FtcRobotControllerActivity.java right after the variables are defined in the class. Import android.hardware.Camera in this class file also. You may need to import other class files too as suggested by Android Studio.

The files DetectColor.java and LinearDetectColor.java show how to use/extend the OpModeCamera and LinearOpModeCamera classes to access the RGB image values from the camera. These OpModes put a camera preview window on the RobotController screen and report back to the DriverStation telemetry whether red, green, or blue is the color most seen by the camera at a given time.

Many thanks to FTC_Team5648 who provided much of the core code in this example in an FTC forum thread titled "How to use the camera as a sensor" on 9/17/15!

opmodecamera's People

Contributors

cheer4ftc avatar antgo avatar

Watchers

James Cloos 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.