Wednesday, 29 February 2012

Corner Detection



As the hough transform uses polar co-ordinates, the corners of the table if filtered correctly can be discovered by finding hough line 90 degrees apart. Using matrices the co-ordinates of the intersection of the two lines can be discovered.








To account for filtering errors the degrees between each line will be checked 5 degrees either side of 90 so range from 85 to 95 degrees of separation between each line.

Different Directions

One of the aims for the project was for the program to test a variety of different directions.  In order to do this I ran a loop for the program to test 10 different angles (adding pi/5) each time.


There is a delay of 1 second while the program sends the ball in each direction.

Creation of the User Interface

The Application requires user interface to link them between the functions.

The first screen displayed would be a 'splash screen' which would be loaded for a few seconds with the application name.

The Android developer page has several layouts pre-defined that can be used by any developer.

http://developer.android.com/resources/tutorials/views/index.html

The best looking with the functionality required was the Tab-Layout view, it would be made with 3 Tabs

1st Tab would be displayed after the splash screen and would contain the Instructions

2nd Tab - Contains Image Capture and File Sending Algorithm

3rd Tab - Basic Web View to View Web Output, this would be very basic so that the user can only view one web page. All other options would be disabled to the user

Chris

Monday, 27 February 2012

Passing between Image Analysis and Physics Engine

2-D arrays need to be passed between the Image Processing and Physics engine. Functions were placed in both parts to allow the passing of the 2-D arrays.

Chris

Wednesday, 22 February 2012

Hough Transform Fix

A fix was found for the hough transform by Essex university. The accumulator was correct but the drawing of the hough lines were off set so the new algorithm is array[x][y] instead of array[x][centre-y-1]

http://vase.essex.ac.uk/software/HoughTransform/HoughLine.java.html

GUI Update

The File Upload program works with the Image stored in the server folders.

Modifications were then made to the JSP pages so that the image sent from the phone was analysed by the image process algorithm.

During testing of the application, a problem was discovered in the timing of the camera.
If the timer is interrupted before the timer has finished, the application crashes. Work needs to be done on the exception catching within the Application

Chris

Monday, 20 February 2012

Physics Engine - ball direction

As the cue is obtained using polar coordinates, I decided that the simulation of the table should use polar coordinates (angle and magnitude) rather than x and y coordinates.  This should make it simpler to link the sections together.

Wednesday, 15 February 2012

Ball Directions

The ball directions are controlled by vectors:
   balls[n].velocity.set(xvector, y vector)


It is possible to set these vectors to control the speed and direction of the balls.  Only the velocity of the cue ball needs to be set, the other balls will have a velocity of zero until the cue ball collides with them.

Revised Image Analysis

When testing different images under different lighting conditions, the original filtering technique (RGB) left too much noise in the image so the table and ball could not be discovered. It was decided to use two different filters one for the table and one for the ball. The technique used will be the hue, saturation and value (HSV) colour map.

Saturday, 11 February 2012

Removing the Mouse Handlers

The mouse clicks and drags have controlled where and when the balls are placed on the table so far.  By removing the mouse handlers, it is possible to make the program set up the balls and table automatically.

The function to set up the table with the balls on it needs to be called from the main function in the BallPanel class

Friday, 10 February 2012

PHP Research

Problem was narrowed down to the Server side script

PHP.net ->Site for PHP developers

On the site, there is a page which explains how to handle Post method uploads and this resource was extensively used to learn how the PHP file works

Chris

Monday, 6 February 2012

Continued Work on PHP file

In order to discover the problem with the FIle Upload program, the Android Developer website was looked at to find how the android code works.

Code makes use of the HTTP post method which is part of the API

"The post method is used to request that the origin server accept the entity enclosed in the request" - Android Developer Page

The code takes the following steps:

-First a connection needs to be made to the Server

- Post Method Request Mage

- Data then sent to the Server until no data left

- Data then sent to server

-  Connection then Closed

Friday, 3 February 2012

Setting Ball Positions

So far, the balls appear when the mouse is clicked and, previously, only appeared where the mouse was clicked.  However I've now changed it so that the ball positions are set by the user:

balls[n].position.set(xcoordinate, ycoordinate);


The next stage will be to remove the mouse handlers so that the balls appear when the program is run rather than just when the mouse is clicked.