Friday, 18 March 2016

Summary of March 14th - Demonstrations of my application

On March 14th, I record some videos of my demonstration of my Apple APP.
Video 1: Demonstration of my APP when distance is 5 meters away

Video 2: Demonstration of my APP when distance is 10 meters away

Video 3: Demonstration of my APP when distance is 15 meters away

Video 3: Demonstration of my APP when distance is 20 meters away


Video 3: Demonstration of my APP when distance is 25 meters away


Video 3: Demonstration of my APP when distance is 28 meters away







Summary of March 9th – Add icon to my application

This link instructed me to add an icon to my application. 


I designed an icon myself and one of my friends helped me to figure it out using PS:
Figure 1: Icon of my application


Figure 2: Adding icons to Xcode library

Figure 3: Icon files

Summary of March 8th- Add function of display distance and modify the positation

This is the last Tuesday before bench. I had a short meeting with my supervisor. I gave a quick demo to my supervisor of how my App works. As well I showed my poster to my supervisor and he said that there are some blanks on the poster and it will be ugly. I decided to make more modifications. Also, my teacher advised me that it would be good to display the distance on the screen.
Display the distance:

Figure 1: Display distance


I add a line of code in the ViewController and add a text box in the View.
@interface ViewController (){

    AVAudioPlayer *alarm;
    __weak IBOutlet UILabel *displaydistance;

}


Figure 2: Modified edition of interface

Comments:
Here, Chris helped again. For more information, click the link below.

Summary of March 3rd – Xcode give alarm

Logbook noting:
Firstly, I downloaded three sample alarm musics in to computer and drop one of them into Xcode as my audio alarm.


Figure 1: Download alarm music from internet

Then I wrote the code shown below into Xcode:


 
Figure 2: Codes of setting music to be alarm voice



These lines of codes add an interface into my program and it prepares an mp3 file for this program. After this, the codes below will give alarm when necessary:

Figure 3: Give alarm if necessary
Comments:
The instruction of Chris online helped me a lot in the step.

Summary of March 2nd – Get pixel width of red blocks

Logbook noting:
Figure 1: Part of the codes of calculating pixel width

Figure 2: Part of the results of pixel width of a line


Figure 3: Part of results of pixel width in a line


Comments:
If you need the full codes, please email me and have a discussion. 

Summary of March 2nd – Problem: some of the red paper can’t be detected

Logbook noting:

3.2
There appear a problem when I keep on going to get pixel width of red blocks. Sometimes the App tells me there is no red colour in a picture even if I take a picture of a red paper. Or only a few red points are detected of a red paper. Just like this:
2016-03-01 22:33:42.090 watchahead[9093:3083668] There are 40 red colour points.
2016-03-01 22:33:51.591 watchahead[9093:3083668] Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.
2016-03-01 22:33:51.598 watchahead[9093:3083668] Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.
2016-03-01 22:33:58.669 watchahead[9093:3083668] the position of this red point is ( 5, 4)
2016-03-01 22:33:58.670 watchahead[9093:3083668] the position of this red point is ( 5, 5)
2016-03-01 22:33:58.671 watchahead[9093:3083668] the position of this red point is ( 5, 6)
2016-03-01 22:33:58.677 watchahead[9093:3083668] 
(
        63,
        76,
        44,
        255
    ),
        (
        61,
        62,
        55,
        255
  ),


The result of detecting red points in this picture is 3 which is definitely wrong. I tried several times and get similar answer. But if I change the angle of taking photo, the results go well. So I think it might be the reflection of white light who made those mistakes.


Summary of March 1st- Get RGB value of a picture

3.1
After I was able to take photos, I worked on getting RGB value of a picture.
I add these codes into the existed file.
This long block of codes is a function of Xcode. By restricting sampling point on each line and row, I can get certain number of pixel points’ RGB value. In my initial imagination, I can get total pixel points’ RGB value which is 1334*750. However in real test, even 250*250 will take a long time, so that it is difficult to process 1334*750 points in a short time. If the time is too long, this project will lose its value.


  float rowdimention = 250;
    float linedimention = 250;



Figure 1: Codes on get RGB value of a picture



Figure 2: Display an instruction if necessary 




After running these codes, it can print out RGB value of every single point of the picture! At the same time, it is able to count total red points in a picture. This is quite help to the next step, obtain the pixel width of red blocks in a picture.

Comments:
At that that time, I set the resolution to be 250 *250. In the later experiment, it is proved that this resolution is too low and I change it to be 625*425. At the beginning, I can’t get RGB of any points. I just tried to modify the codes to make it work.