Wednesday 30 November 2011

Next stages for the Physics Engine

The program needs to be evolved so it can:
  • Set up the table with the balls already on it
  • Detect if a ball enters a pocket and declare it a 'hit'
  • Use the position and angle of the cue
  • Maybe incorporate the strength of the hit
  • Maybe calculate the best shot and rank possible 'hit's
  • Pass information to the Server

Monday 28 November 2011

PHP accepting FIle

The code which is responsible for sending the file to the server sends the file to a PHP file

Apache Tomcat doesn't run PHP

Within the MAC OS X operating system, there is the Apache HTTP sevrer which does run PHP but not by default, it must be turned on within the operating System

The Code was tested and worked for sending the file from the Phone to the server but the file is not displayed on the server

More work needs to be done on the server side script for the file.

A screenshot of the file upload working is shown below:

Wednesday 23 November 2011

Progress on GUI

Due to Other Exam and Coursework Commitments progress on the GUI has been slowed, but this week is back on full speed.

I have been previously on the idea of a JSP form to upload an image manually, this has been created and has been taken one step further because now the uploaded image is passed into a prototype of the image analysis algorithm.

I have also found some open source code on how to send a file automatically from an android app, after fiddling with the code, it now sends a file to the server, but, so far, i havent been able to get the server side script to work which means the file isnt accepted, this is where i am spending most of my time in trying to get the image to send. I feel that this is an important part of the project.

Chris

Monday 21 November 2011

Integrating File Upload with the Image Processing

The idea of the file upload was that it could then be passed to the Image Processing Algorithm

The first idea was to change the filename in the algorithm to match the uploaded file but this proved too complicated.

So, everyfile which was uploaded to the server was named the same and it would be overwritten everytime a file was sent to the server.

The file was sent to the algorithm but no new files created, the permissions need looking into

Chris

Sunday 20 November 2011

Ball Detection

There were 2 possible ways of detecting the balls:

  1. Using the Hough Transform and 
  2. By searching for white pixels in own algorithm
The Hough method didn't work so option 2 is being used.  With correct filtering, the canny image will leave a circle for each ball.  As it is a circle, the radius should be constant..


A vertical search is run for a white pixel then it continues searching for the next white pixel, it calculates the distance between them and this gives the diameter.  


The search then moves to the centre of these two white pixels and searches left and right.  If these measurements are the same as the vertical diameter, then the centre point is established.

Tuesday 15 November 2011

Group Presentation

The group is set to make our presentation on 30th of November at 10:55 so now we are all concentrating on preparing our presentation and figuring out what we are going to say.

Grace

Hough Transform

This is used for finding straight lines in an image.  Instead of using Cartesian coordinates it uses polar coordinates to find straight lines on the image.


The Hough Transform can only be executed after the edge detector has been implemented.
Code by Edinburgh university was adapted for the relevant implementation.
http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm

http://homepages.inf.ed.ac.uk/rbf/HIPR2/flatjavasrc/Hough.java


In the first tests, the Hough lines were drawn incorrectly.  This could be due to the Hough matrix being wrong or the drawing of the Hough lines is wrong.

Monday 14 November 2011

Uploading File to Server

Code was found at http://reecon.wordpress.com/2010/04/25/uploading-files-to-http-server-using-post-android-sdk/

This code sends a file to a server using methods within the android sdk.

This could be integrated into the application so that when a photo was taken, the file was sent to the server.

Chris

Sunday 13 November 2011

Running of the application

The application takes an image after 5 seconds and stores it in the correct location at a file size idea for the server.


Problem
When the timer is started and the XML screen is 'quitted' either by going back to the menu or leaving the app, the app crashes after 5 seconds as the thread for the timer is not correctly stopped.


Done:

  • Background removal
  • Edge detection
  • Simple application to take an image after a timer

Friday 11 November 2011

Starting to develop the Physics Engine

The first stage in developing the Physics Engine from the collisions code found during the research was to remove any extrac functions such as the control panel, the ball scattering and the fact that the colour changes with the velocity.

Wednesday 9 November 2011

File Upload Problem

After research and work it was found that a File form cannot be autopopulated from a dynamic URL

This is due to security reasons in the JSP development. If it were allowed files could be taken from the users computer by the user just pressing a link.

Form has been returned to origanal state where the file is manually uploaded

Chris

Further research for the Physics Engine


Looking to expand on the previous model, through further research I found a different program in an article on Stack Overflow:

This uses round objects that collide with each other and the walls which can be adapted to suit the project specifications but needs a lot of work.

Tuesday 8 November 2011

Passing a Variable to a Form

The Form below is being populated using the dynamic URL, the form box has the form string





Using the Camera

The camera application already contained on the phone cannot have a timer to set automatically and then take an image.


A possible solution is to use a surface view with a camera preview.  Open source code can be found by the blogger Android-er which implements this:
http://android-er.blogspot.com/2010/12/add-overlay-on-camera-preview.html


This method does not affect the predefined camera settings and can easily be adapted to incorporate a timer and specific resolution settings.

Saturday 5 November 2011

Physics Engine Research

The blog http://beginwithjava.blogspot.co.uk/ has several simple collision tutorials that introduce java methods.  

This is a good tutorial:
and should help in the development of the physics engine.  It may be a good idea to produce a graphical representation of the pool game in order to ensure that it is behaving as predicted


This program contains a moving object (the green square) colliding with the walls of the window as well as the green square. 

Wednesday 2 November 2011

Physics Engine Prototype Review

It was only designed to be a basic program but it allowed straight collisions and didn't account for the walls of the pool table or whether the pockets were in a realistic position.

However, the program was able to receive values for the coordinates of the balls, cue, and pockets from the GUI, perform the calculations, and then inform the GUI section whether the shot will be a hit or a miss.