Giter VIP home page Giter VIP logo

ahmetozlu / real_time_circle_detection_android Goto Github PK

View Code? Open in Web Editor NEW
44.0 4.0 15.0 80.6 MB

Real time circle detection and tracking by Hough Circle Transform with OpenCV on Android OS.

Home Page: https://www.youtube.com/watch?v=eWxtt1411Xs

License: MIT License

Java 100.00%
opencv realtime circle-detection hough-circles android-os android circle-detector circle-detection-algorithm image-processing

real_time_circle_detection_android's Introduction

Real Time Circle Detection and Tracking for Android

This repository focuses on real time circle detection with OpenCV on Android OS. Please contact if you need professional object detection & tracking & counting projects on Android devices with the super high accuracy!


What does this program do?

  1. Gets the camera frames and turn each frame to gray.
  2. Applies the Hough Circle Transform to the grayed image.
  3. Turn each frame to RGB and display the detected circle in a window.

Theory

Hough Circle Transform was used for circle detection in this project. It works in a roughly analogous way to the Hough Line Transform.

The flow diagram of this application;

OnCameraFrame method which is located at MainActivity.java;

public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {
        Mat input = inputFrame.gray();
        Mat circles = new Mat();
        Imgproc.blur(input, input, new Size(7, 7), new Point(2, 2));
        Imgproc.HoughCircles(input, circles, Imgproc.CV_HOUGH_GRADIENT, 2, 100, 100, 90, 0, 1000);

        Log.i(TAG, String.valueOf("size: " + circles.cols()) + ", " + String.valueOf(circles.rows()));

        if (circles.cols() > 0) {
            for (int x=0; x < Math.min(circles.cols(), 5); x++ ) {
                double circleVec[] = circles.get(0, x);

                if (circleVec == null) {
                    break;
                }

                Point center = new Point((int) circleVec[0], (int) circleVec[1]);
                int radius = (int) circleVec[2];

                Imgproc.circle(input, center, 3, new Scalar(255, 255, 255), 5);
                Imgproc.circle(input, center, radius, new Scalar(255, 255, 255), 2);
            }
        }

        circles.release();
        input.release();
        return inputFrame.rgba();
}

Project Demo

Installation

Dependencies:

How to build and run this source?

  1. Clone project by using Android Studio
  2. Select and build module CircleDetection

Citation

If you use this code for your publications, please cite it as:

@ONLINE{vdtc,
    author = "Ahmet Özlü",
    title  = "Real Time Circle Detection and Tracking for Android OS",
    year   = "2017",
    url    = "https://github.com/ahmetozlu/real_time_circle_detection_android"
}

Author

Ahmet Özlü

License

This system is available under the MIT license. See the LICENSE file for more info.

real_time_circle_detection_android's People

Contributors

ahmetozlu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

real_time_circle_detection_android's Issues

I can not detect all the circles with Android Camera

Hello,

I need to detect circles taken with their positions X Y, I want to use this data to compare them with the original image to retrieve an ID. It's like the principle of QR Code.

I want to create a system like Snapcode (snapchat)

We want scan like this picture https://ibb.co/gMkEJd with the Android Camera

Cordially,

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.