Skip to content

Latest commit

 

History

History
36 lines (27 loc) · 1.84 KB

README.md

File metadata and controls

36 lines (27 loc) · 1.84 KB

Challenge 6

The challenge for this week was to create a GUI application that can detect circles from a webcam (preferably in real time).

Methodology

To do this I had to use the GPU to manipulate the webcam image in a reasonably fast time. Unfortunately, Java has very little support for running stuff on the GPU and so I decided to use an OpenCL wrapper called JOCL. My implementation runs just about in real-time, but it would be nice if I could optimise it a bit more (Edit: was incorrectly clearing the GPU buffers and as such was losing about 10ms per image).

To detect circles I used the Sobel Operator to create an image that captures the "gradient" of any point. This gradient is then used in a Hough Transform to create a voting space where each pixel "votes" on the most likely space the circle origin would be in. We then extract the highest voted spot and draw a target around it.

As for the webcam I used this very nice module from Bartosz Firyn which works for most webcams. I then just call the animation function every time a new image is given by the webcam. All the GPU code is written in C and is compiled when the program is run.

Overview

  • CircleDetector which contains the code for running OpenCL code and initialising everything.
  • Animation which is run every time the webcam gets a new image and runs the algorithms in CircleDetector.

Images

image image image