Wednesday, December 30, 2009

Week 14 Day 3

Today I have discovered the bug just after debugging and finding the cause for the whole afternoon. The cause was simply due to an uninitialized variable that controls the aspect ratio. I have discover it by isolating all methods does not involve the rotation of the cube. Thereafter when I still failed to find the cause, I decided to check the value of each of the variables, and all however, seems reasonably fine.

It was only when I narrow down on 2 suspected variables, tested them and realised the variable just after them was not initialized, I intialized it and it worked fine.

Although I have managed to solve this error, but was upset over the large amount of time spend on discovering just a simple error

Week 14 Day 2

Today I have worked on fixing an error that was discovered after merging the code. The rubic cube's right face will turn into different colours in the process when the cube is being rotated. I commented out different portions of the code and currently still unable to find the cause of it.

Grabbed an old working copy of the rubic cube, and as I observed, all common methods were the same, nothing was missing and yet there was still the multi-colour problem.

Monday, December 28, 2009

Week 14 Day 1

Today I have worked on merging victor's code and my code. Thereafter due to my Napfa test, I have left work to take my Napfa test at school.

Although I have failed in 2.4km run, pull up (did only 3 out of 6) and standing board jump (210 out of 216), I am gald that the school is providing a training opportunity for final year students every saturday.

Sunday, December 27, 2009

Week 13 Day 4

Today is Christmas eve, hohoho! Santa Clause is com~ing to town...

I worked with the merging of my codes and victors code, and used a special tool called SourceMerge by Tortoise SVN to make merging easier. Although the combining of codes were successful, but there were still compilation errors, and it took me a while to notice and realize that it was due to some variables that have the same name and they have conflicted.

Fixed the error and now everything is compiled successfully

Wednesday, December 23, 2009

Week 13 Day 3

Today I have finished up with the save and load file function, and tested it. I have also created 2 settings file for the camera of the Macintosh and the sony video camera, and saved the working settings.

Tuesday, December 22, 2009

Week 13 Day 2

Today I fixed the memory bug that was discovered yesterday, and it was due to the fact that when initalizing the rubic cube, the program will "hang" for 2-3 seconds, and during that time, the thread gets to run first before the main method have the chance to initialize an IplImage variable, and hence this resulted in the thread modifying an uninitialized variable.

The problem was fixed by implementing an if-else to only allow the program to proceed to process image if the variable required was not null.

I have also implemented proper positioning for the windows of the rubic cube application (the rubic cube windows won`t stack on each other now), and also the exit function which will exit the program.

Currently I am working on the save and load functions for the min and max hue, saturation and value for each color, and will complete that by tmr

Monday, December 21, 2009

Week 13 Day 1

Today I have successfully fixed the memory issue by making 2 IplImages variable gobal and hence preventing them from being needed to be declared in the thread.

Another changes I made that fix the memory leak would be changing one of my method in the loop of a thread, from taking in parameters to not taking in any parameters (just using and modifying the variables globally.

However, I encountered a setback. While I was using the "Leak" performance tool to check for leak again, it crashed around 3 seconds after the application has launched. I take a look at the debugger and saw this :

2009-12-21 16:08:37.962 3DTestApp[4067:7903] *** _NSAutoreleaseNoPool(): Object 0x10ebe0 of class NSCFNumber autoreleased with no pool in place - just leaking

Stack: (0x91edff4f 0x91dec432 0x941ad394 0x94282218 0x94281b32 0x94528023 0x942813ef 0x94280dc6 0x94489ef4 0x944882ab 0x9350e13d 0x9350d57b 0x9350d3e0 0x93529e29 0x93529bce 0x935292a8 0x935290e4 0x5743e2)

3DTestApp(4067,0xa0310720) malloc: *** error for object 0xffffffff: Non-aligned pointer being freed

I did a search and realised that this has got to do with objective C and the solution for Objective C was to use a class called NSAutoreleasePool, which I tried and when implemented it gives lots of syntax errors with the codes, when there were no syntax errors in C++. I have posted this question on various forums, and seeking for answers to it now.

http://stackoverflow.com/questions/1938777/class-nscfnumber-autoreleased-with-no-pool-in-place-just-leaking

Sunday, December 20, 2009

Week 12 Day 5

Today was a day for community work at Hort Park, and the entire workforce from IHPC was having a great time interacting with the children from Touch Young Arrows. Chittanya, Victor and me presented "Jumping CornStarch" to the kids, and they were like "WOW, I want to play! I want to play!", laughed straight away when I heard this, but it reminds me of my childhood, the times when I was obessed with Digivice, a pet (or monster) keeping device game from the popular cartoon, Digimon.

I must admit when at first I saw Kevin, Chittanya testing out the CornStarch experiment at the Pantry, I was not surprised of how it jumps as I know the science behind it. But seeing on this day how much fun, joy and knowledge it brings to the children, I must say the experiment is of great value and learning to the children.

The day passed fast and soon the children were at IHPC watching 3D movies and playing games using LightDraw. It was interesting seeing them playing the puzzle games and pinball using lasers, and we were so focused on how they were playing that many of us were telling them where to point.

In the blink of an eye, it was the closing ceremony of the ReachOut 2009 event, and I was standing in the training room as they were giving out presents, one by one, to each of the children. Some of the presents were so big that the children have trouble carrying it, and I was also surprised to learn that these gifts were the gifts the children have previously written on their wish list. This means that if the children request something expensive, IHPC will also buy? WOW how I wish I was them haha.

The end of the day ends with the Children returning home by bus happily. A joyful and meaningful day indeed, hope IHPC will have more of these events in the future.

==============Reflection=============
This week saw me being involved in integrating multi-threading to the rubic cube, and it was my first time doing multi threading for a 3D application. Although there are many errors I have encountered on the way, I have found programming in 3D not as hard as I initially thought.

This week's reach out was the most meaningful event that occurred throughout my internship. The whole IHPC workforce brought joy and gifts for over 60 of the children from Touch Young Arrows, and it was a great experience interacting with the children, seeing how interested they are in science, and their enthusiaism.

Week 12 Day 4

Today I worked on solving the memory leaks by placing all of the variables (integers booleans) outside of the method that runs during threading. Despite the time spend in this, it does not solve the memory leak.

From the Leak Performance tool, there wasn`t any variable names provided, only method names, and I could only narrow down to one of my method, ProcessImage, as the cause of the leak. To ensure that this information was correct, I commented out the method that is suspected to produce memory leaks, and indeed, the Leak Performance tool shows the memory being stablized thereafter.

Wednesday, December 16, 2009

Week 12 Day 3

Today I checked the codes and realized the application crashed yestereday due to a missing declaration for an IplImage variable before it was being used by another method.

After I run the application, I realised that the cube is still very slow in its turining.

After some trying, I swapped the processing of the rubic cube with the position of the codes that copy the captured image from the camera to another variable, but realised it is still the same.

I then decided to try putting the reading of the image from the camera and the processing of the image into the one separate thread, letting the main thread do the 3D drawing. This fixed the problem and now the cube draws at an acceptable speed.

However, I am now having memory leaks in the application. I used a tool called Leak and realised that during the runtime, the program can take up to 1.5gb and still growing amount of ram before it crashed. Could not find the loophole in the code today, and I will attempt to work on this tomorrow.

Tuesday, December 15, 2009

Week 12 Day 2

Today I worked on implementing the showing of the rubic cube and the motion tracker screen to show after the user select "start program" in the menu. Due to the infinite loop caused by glut_mainloop, it caused the threads to crash. When I tried to put that method into the main method, I wasn`t aware that it was a method that doesn`t return (or continue) and as a result codes below it were not executed.

After seeking guidance from Ming Hong, I realised that I could actually put the processing and updating of the camera frames in the display method that would be run by the glut_main loop, and leave the main method to execute the glut_main loop. I tried implementing it however got a crash. Will look into this error and fix it tomorrow.

Monday, December 14, 2009

Week 12 Day 1

Start of a fresh week again. Today I worked on implementing calibration and main menu in the multi-threaded version of the Rubic Cube application.

I have also discovered that why using the negotiation method I implemented on Friday, it will result in the camera waiting for the program to be ready and vice versa, hence defeating the purpose of multi-threading. Hence, I will be trying out a method whereby the program will instead store a copy of the fram being captured to another variable, and the processing of colours will then use that variable for controling the rubic cube.

Friday, December 11, 2009

Week 11 Day 5

Glad its a Friday again : )

Today I switch my programming task with my partner, and currently I will be working on the multi threading feature of the rubic cube instead. One interesting thing I found out was that C++ does not allow reading from camera in threads other than the main thread. As such, what I am implementing now would be to place the reading of the camera frame in a infinite loop (till the user press 'q' for quit) in the main method, and it is working successfully.

In order for the reading of the camera to a frame to work successfully in a loop with other threads sharing the frame, I have to implement variables to ensure that when the frame is captured, the other threads will read the frame before allowing the frame to be replaced with a new frame.

Today was also the day where Kevin would be leaving Singapore and returning on January. Manage to see Kevin for the last time this year at 3pm, but didn`t manage to say much. If you are reading this, I would wish you to say thanks for your guidance and advice all along, it is because of you that our internship was a great and fun one ! Haha, and I will ensure when you come back to January, my presentation will be 200 times better than how I presented previously.


==========Reflection of the week ===============

This week seems to pass quickly as most of the time was spend on programming. However, I have learned and implemented turning of the rubic cubes, gained knowledge of problems when multi threading is used for reading a frame from camera, and also on my weakness and strengths in presentations.

Probably I have realised in many things I do, I still do the same old mistakes, and that was due to lack of practice. Certainly I believe I can improve on these, and I will be attempting from now on to change these

Thursday, December 10, 2009

Week 11 Day 4

Continuing from yesterday's assignment, I have realised that due to the cube being drawn once and the buffer being swap only once for every round, this caused my snapTo90Angle method to only allow the top most layer to turn back to 90 degrees.

As such, I now have to limit the user to only move a particular surface in only a partricular direction.

Howeer, despite most of the rotation working smoothly now, I found out that there is a serious problem with the bottom and top layer right and left rotation, which caused some cubes to go missing suddenly.

Today I have also fixed the insufficient memory crash by moving all images declaration to the outside of the draw rubic method, and into the global declaration part

Wednesday, December 9, 2009

Week 11 Day 3

Today we presented to Ming Hong and Kevin on what we have learned since the days we came to IHPC, and I have accumulated a list of feedbacks :

- Talk slower
- Don`t beat around the bush
- Ensure content is relevant
- Ensure content is correct
- Skip through forgotten items, not pause at them


While for the speed wise, I still remember the embarrasing moment when our school was having Japanese Exchange (where students from Japan came to visit TP) and I was presenting a speech. I was so nervous and anxious that I talked like a bullet train, and my Course Manager, who happen to be seating at the first row have to signal to me to slow down.

The rest of the day was spend on continuing the improvements for the rubic cube application. Currently I realised that if the cube is rotated halfway in a specific direction, and another rotation is applied to it, some cubes will go missing or the whole plane of that cube will split up.
To prevent this, I am writing codes to make the cube turn to a 90 degree position before another rotation of another direction will be taking place

Tuesday, December 8, 2009

Week 11 Day 2

Today I used the Sony Video camera to test the current rubic cube application, and I realised that the turning of the rubic cube will not show any lagness when using the Sony Video Camera. I tested the finger detection and it worked fine.

With regards to the turning of the cube, initially I programmed it to rotate a full 90 degrees so long as it detects a finger moving downwards. However, it could not function well as the limit of the distance for the cube to start rotating does not seems to work smoothly with my experiement.

After some advice, I decided to programme the rubic cube to turn in accordance of how much distance the finger moves across that particular plane or surface, and it worked well.

The last improvements of the day was snapping the rubic cube planes to a full 90 degrees in the event when the user does not move the distance required to do a complete 90 degrees rotation.

I encountered some calculations error where the program shows that the rotation is a complete 90 degrees, but in actual fact the rubic cube planes are somewhat not a complete turn.

After much advice, I realised this was due to modulus with negative numbers, which produces unexpected numbers. It now works fine.

Monday, December 7, 2009

Week 11 Day 1

Fresh new start of a new week today! Spend the entire day on integrating the colortracker application with the rubic cube application. Apparently I copied the camera detection logic and put it into a method, and call that method whenever the drawcube method was called.

However, I realised this caused severe lagness in the turning of the cube. After advice from my supervisor, I realised that it was due to the frame rate being set to 1000 max. I changed it to 25 and the laginess is reduced, but not as perfect.

After much consideration, I came up with 2 ideas. One was to call the camera detection method in a different thread, and the other was to call the camera detection method only every half the maximum frame.

I tried the 2nd method, and the cube now draws quite smoothly. I then proceed to draw a small rectangle to indicate the position of the detected fingers. However, as much as I try, I still did not mnage to get the application to draw the rectangle out. Will continue to check this on tomorrow.

Sunday, December 6, 2009

Week 10 Day 5

Today I have finished on implementing and getting the cube to function. I have learned that the animation comes before swapping of each stored points for rotation, if not we will see the result of the rotation first followed by the rotation animation.

Besides that, for a rotation to be perfect, rounding off errors need to be prevented, or else some cubes on certain parts of the rubic cube may suddenly go missing. This is due to the fact that if there are rounding off errors, one cube may touch the other cube upon rotation, and this may cause the cube to intersect with another cube, hence the cube may only appear partially or even disappear completely.

I will be starting on integrating this rubic cube application into our initial holotouch application next week, and hopefully when this is done, we will have a presentable application.


===========Reflection==================

I have spend the entire of this week into coding with OpenGL. Similar to my coding experience of asp.net, where we learn the drawbacks and advantages of these technologies only while we are developing for it, I have also learned the pros and cons of OpenGL programming, and have completed a rubic cube with the help of MingHong(supervisor).

Indeed learning something new takes time, but it helps to open up another dimension. For me, I have been developing web applications for mostly simplifying paperwork, and OpenGL has allowed me to also program visual applications.

Wednesday, December 2, 2009

Week 10 Day 4

Currently I am on the last part of storing the points onto the vector, and today, Ming Hong explained on how to calculate the changes and make modifications to the points upon rotation.

The formula was an equation of cosine and sine, which although seems complicated, but he assued us it will not be as hard.

As such, I am currently finishing up the last part of storing these points to prepare for the rotation.

Week 10 Day 2

Today I am still working on the storing of the points, continuing from what I did yesterday.

Will post any updates when its done

Week 10 Day 1

Today is the start of Week 10, 10 more weeks to the end of my SIP.

Continuing from last week, I implemented translation to the entire rubic cube, and it worked well.

Currently I will be continuing on the storing of all points into a vector containing a struct,which contains more variables and structs.

Week 9 Day 5

Upon continuing on yesterday's problem, I realised a problem with the rotation. The rotation of the rubic cube was not based upon the centre, but based upon the left top most cube.

This caused the cube to rotate around the top left point instead. I tried to change the x,y and z of the rotation and also putting the codes to draw the uppermost middle and centre cube first, but it doesn`t help in anyway.

Finally, I asked Ming Hong and realized the problem was due to the cube being drawn below the origin, which was not shown in the 3d view. I could do 2 things :
-Change the coordinates for all the cubes so that the uppermost middle and centre cube is at the origin (0,0,0)
-Use glTranslate to move the 3 cubesets that I have created to the appropriate position.

I am currently working on the second solution, and hopefully it solves the issue.

=================Reflection=============

Time passes fast, and today counts the last day of Week 9 that I have worked in IHPC. This week saw me coding on OpenGL for the first time in my life. I have now more understanding of how software like games and CAD draws 3D images on the screen and what OpenGL can do.

It has been a week of coding in C++ on OpenGL, which is new to me, but definitely very useful for the development of the HoloTouch project. I have now thought of various projects that I can make use of OpenGL with, and I am planning to code them after my SIP

Week 9 Day 4

Currently after much thinking on yesterday's problem regarding vertical and horizontal rotation, I have decided to create a method that handles each separate rotation, and calling them together when the needs arrive.

Upon coding for rotation in the other direction, I realise that due to the way the cubes were drawn in my codes, there will be a bit of problem with the rotation of the other side, unless I were to redraw the cube upon every rotation.

As such, I have created a struct that stores a vector that stores yet another struct that stores each details of the individual points declared in my code.

Declaring the struct and vector was easy, but not the storing of the points into it.

Week 9 Day 3

Today I have managed to make the rubic cube appear correctly without them going out of shape. However, I realised they now tend to seep through one other ( can see the beneath layer while the cube is rotating, the top sometimes become semi transparent).

Increasing the color for each of the cubes doesn`t seems to work, and currently my approach was to space it out with a little bit gap again so this does not occur.

Spend the rest of the day thinking and analyzing on how to rotate the cube (each layers) vertically and horizontally together, and currently still in the process of looking for an answer

Sunday, November 29, 2009

Week 9 Day 2

Today I have started on coding for the HoloTouch project. For now I would need to create a 3D model of a rubic cube in OpenGL, with ability to rotate and turn.

I started off with learning how to create a 3D cube from a tutorial, and using what I have learned, I duplicate the codes for creating the cubes, making more and more appearing.

However, I have realised that some of the cubes seems to go out of shape when I attempt to positon them close together. Although this can be fixed by creating a small gap between them, but I am trying to find a solution for them to have no gap and yet able to appear correctly

Monday, November 23, 2009

Week 9 Day 1

Start of a fresh new week. Today I have completed on improving the color tracker, and it is now really for showcase. Hopefully future audiences will be amazed by its ability to track fingers.

Today was spend mostly on bug fixing and code enhancement. Also watched Mr.Kevin and Mr.Ming Hong present this morning. It was simply atonishing, and I have alot to learn from the way they present themselves, talk about the product, as well as interact with the audiences.

Week 8 Day 5

Yes! Its Friday finally. Feels so much like this week have been mostly studying about svd for me, other than working on the color tracker application.

Nevertheless, I have learned something not taught in my diploma course (Matrices is only taught to Gaming Diploma students), and that will definitely be useful in the course of HoloTouch Project.

Though I am abit worried about the time available for creating the rubic cube (suppose to submit today), but I think learning has to take place step by step. If not, misunderstanding of concepts occur, and will result in possible delay.

Though studying svd was somewhat boring, it proves to be a useful concept to learn.


=====Reflection of the week=====
In this week, I have read and studied on Singular Value Decomposition, and its use in not only graphic or Human Computer Interactions, but also in Search Engine, Sales and many other marketing areas.

Simply I was atonished about how much these businesses uses Matrix. Matrix though it seems simple, but its concept does takes time to understand.

Though I do have a bit of struggle coping with understanding Matrix, but preserverance has helped me to undeerstand the complex concept of Matrix.

During the process, I have learned on how small things, which we mostly are ignorant of, can be so useful in our lives.

Week 8 Day 4

Today I worked on examples of OpenGL for the entire afternoon, and switched back to create a "manual calibration" mode for colour tracker for the rest of the day. I was gald to hear that color tracker (or our hardwork) will be finally shown to the audiences.

Surely, I will need to spend time on it to make sure audience will get inspired by it, and not just treat it as some usual boring applications. Hopefully when the manual calibration mode is done, I shall start on changing the way the application manages its color range.

Week 8 Day 3

Today I have managed to finish the entire course on Singular Value Decomposition, and proceed to OpenGL programming. Did a couple of single examples such as Pyramid and Triangle rotating and turning, fairly interesting.

Still, there are many examples to try, and many more to learn.

But nevertheless, this is the start of a new invention, inspiration as well as opportunities

Week 8 Day 2

Day 2 of the studying week, well feels like I am back in poly doing my problem-based learning. Today I had spent couple of hours to understand difficult terms like Identity Matrix, abnormal matrix and many others, and finished 3 tutorials. 2 more to go tomorrow before reaching the ending point

Week 8 Day 1

Its a brand new week ahead. This week I started on learning tutorials on doing SVD calculations.

There are many of these great ones online, but due to being new to Matrices, it took me almost half a day to learn finish and fully understand the first chapter of the tutorial, still 5 more to go.

Basically matrices are 2 or more values stored together in a set, and we are learning it as it can be used to store coordinates of our hands during the development of the "steoro" version of HoloTouch.

Tuesday, November 17, 2009

Week 7 Day 5

Reached the end of Week 7, feels like in the blink of an eye still.

After the color tracker has once again been tested and presented, it is being put aside and we were to study on 2 things :

1) Matrix Multiplication
2) Single Value Decomposition

Our goal now was to study these 2 topics and apply them into the later part where we were to program with 3D graphics

The end of the week was fast, and soon it will be the start of week 8. Hopefully I can complete the studying of SVD and Matrix Multiplication by either tuesday or wednesday


===Reflection====

This entire week saw me programming with the camera to detect colors, as well as to write codes to ignore conflicting colors in the background. Although I was abit tired from the vigorous testing needed, but at the end I have successfully written a workable and tested code.

This brings me back to my memories of my assignment days, were debugging feel tiring to me, but still, I have manage to complete a working assignment in time that is enhanced.

The principle that I can learn through this process is perserverance and prevention of procrastination. Procrastination is the tendency to postpone certain task due to mood, and it was said by Adam Khoo as the No.1 Killer of Succcess. From all of my experience, I would totally agree with Adam Khoo.

Thursday, November 12, 2009

Week 7 Day 4

Today I have completed measuring the HSV values for Red, Green, Blue and Yellow, and I am now progressing towards the calibrating process, where the application will also detect the surroundings, and according to the surrounding's average HSV values, it will decide upon the range for detecting the 4 colors.

I have finished the part on the setting of values, and now progressing towards manual calibrating, where users will need to lift each finger, and move it around a small rectangle, for the program to detect the HSV for each finger's color

Wednesday, November 11, 2009

Week 7 Day 3

Today I spend the day doing a portion to cater to auto detection of the 4 colors.
This was due to the fact that if we do not do this, we will have to find out the values for each color each day, as the color range detection values changes from day to day (which I am not sure why).

Completed the portion on detecting the environment's highest HSV and lowest HSV, and currently progressing towards comparing the environment's HSV to compare to a hard coded HSV, and then add the different to the pre-defined color range

Tuesday, November 10, 2009

Week 7 Day 2

Today I and Victor have started on motion detection, and the process was fun.

This is because in our trial tests, we manage to move a graphical rectangle with our hands, and it really seems as we are moving it with our physical hands!

This was somewhat something interesting from the days of coding we have done on HoloTouch

Another interesting thing I discovered today was that in C/C++, when an exception happens, there will not be any error messages, the program will continue on normally, but the method or code will just skip. I was greatly shocked by this, as it means that I may have not even discovered exceptions that may have caused by my codes throughout all my assignments at IHPC.

Indeed C/C++ is a powerful langauge, but I think this is one of its weak point.

Monday, November 9, 2009

Week 7 Day 1

Today we finished on the detection for 4 fingers (different colors), and we are now working towards making the application able to detect motion, and move a square around,and resizing it according to various hand gestures.

However, today was spend on bug fixing and improvements as bugs occurred during our presentation to our supervisor

Saturday, November 7, 2009

Week 6 day 5

TGIF!

Glad its a Friday once again, and today, I and my colleague registered and tested more colors in the application. We tested it with a coloured gloves (with different colors for each finger), and it worked perfectly.

The rest of the entire day we were thinking of ways for motion detection

Week 6 Day 4

After various tries on my code and logic, I decided to temporarily put away my codes, and help my colleague, Victor, in his implementation, which is showing more successful results for blue detection.

I studied a bit on HSV colors detection and found it to be quite unique. HSV uses an angle for its Hue, rather than a value from 0-255, and it has 2 other values for identifying its Saturation and Value, which I feel, helps to counter the detecting of blue as black, which happened to LAB.

The rest of the day was actually spend on testing of color ranges, fixing and refactoring of codes, and showing our supervisor of our current progress.

After our supervisor left, we tried to register our skin color as a detection color, and was glad it worked well. However,we give up the idea of using skin color as a means for detection of hands, as the solution have quite a number of constraints

Week 6 Day 3

Today I realised that block detection apparently failed for blue color. As the LAB's value for dark blue color is very close to the values for black, the application would sometimes regconize black as blue, which results in it detecting irrevelant objects in the surrounding as a block.

I have added codes to allow my program to ignore the environment's default LAB values, and it does provide a little improvement on the block detection for blue, but that was still not sufficient to allow blue block detection to work completely

Next, I expanded the range for block detection, and put a tighter limit for the initial detection point. This does helps in block detection for red, green and yellow, but blue is now not even detected.

For the rest of the days, I tried on expanding and changing the range for block detection of blue, which apparently still doesn`t work as it detects the surround's dark black as blue

Tuesday, November 3, 2009

Week 6 Day 2

Progressed on the assignment, now the application is able to do block detection, but failed in green and blue color

Monday, November 2, 2009

Week 6 Day 1

Start of a brand new week! Today was a great day at IHPC, made great progress on the assignment. The application now can detect 4 colours, and ignore any of these lighter colors detected in the background.

My goal ahead now is to learn on block detection, and how to identify motion

Week 5 Day 5

Yep, its Friday again, 2 days of full sleep and rest before the usual 9-5 pm day comes again.
Just began to use Macintosh and realize it isn`t as easy as Windows . Imagine a machine with shortcut keys different from Windows (even the simple copy and paste), no start menu, no mspaint, no Aero Snap, and whose mouse is somewhat not as sensitive as the normal mouse that comes with your PC desktops or laptops.

Well, it does takes a bit of time to adjust, and though I am still having some trouble with little stuffs such as failing to remember how to switch between applications, and how to add a new tab to safari, and sometimes missing the completely-easy-to-use Windows 7, using Macintosh allows me to learn yet another OS, and be more "platform-independent" when working in the IT industry.

Reflection :

Yep, its been another week, and I have completed two assignments, now started to work on the real "Hollow Touch" project itself. Up to today, my application is only able to detect and identify one color out of the 4 colours.

Despite this, I have learned more on OpenCV and its potential in the world of movies and design. Though it will take time for me to learn OpenCV sufficiently to complete this project, I believe that with passion and dedication, this will be a fun and interesting assignment for me, and OpenCV will be definitely useful in aiding me on creating applications related to Human Computer Interaction in the future.

Thursday, October 29, 2009

Week 5 Day 4

Today I finally get started on the Hollow Touch project, and cameras, tripods were setup.  Programming will now be on Macintosh, using C++, and our first assignment will be to set up a program capable of identifying different fingers on our hand.

This assignment will involve wearing a gloves with different colors for fingertips, middle bone of the fingers to allow the detection of fingers.  However, I am still fascinated on how Microsoft is able to detect our bones and use it in project Natal. Through this project, I am sure that many boundless potential and possibilities will be unleashed, and the future of hologram will no longer be a far-away idea.

So here I am, creating another similar technology called Hollow Touch, unleashing potential and changing the future of Stereo and 3D entertainment

Wednesday, October 28, 2009

Week 5 Day 3

Today I spend much of the day improving the application to make it more user friendly and more easier to use. However, I have also realized that the application may not be able to run on Windows Xp, Vista, or any version lower than Windows 7, unless .netframework 3.5 is downloaded and installed

Feeling sick today, will stop here to take a rest. More details tomorrow : )

Tuesday, October 27, 2009

Week 5 Day 2

Great day today, finished fixing some bugs and improved certain features that makes the UI more better and user friendly

Monday, October 26, 2009

Week 5 Day 1

The start of Week 5 saw me working on the last bit of XML writer for Lightdraw before embarking on the Hollow Touch project. I have now been more familar with C++ and have more understanding on its potential.

Friday, October 23, 2009

Week 4 Day 5

Time passes, and it is now one full month that I have been in IHPC. Thinking of it as a whole, I have learnt about Linux. its distribution, the core of Lightdraw, programming in Linux, and programming in C++.

I have also gradually learn to pace myself to cater to the workload given, and learn more on the importance of punctuality, as well as personal dynamics in the workplace

Reflection for this week :
This entire week I have been continuing and completing the work given to us last week, and we are glad that we had managed to finish it on the date we stated. I have learned on the use of arraylists and vector in C++, the customizing of the panel class, as well as FileIO and XML reading.

Though I have learned xml reading and writing in school, however the approach used in C++ is completely different. I am also glad that I have managed to control some of my busiest day this week, and didn`t mess up things, which I am gald of. However there is more to learn, and I am glad this learning opportunity have been given to me

Thursday, October 22, 2009

Wek 4 Day 4

Finished up with the data integration, and data are now saved to vector upon immediate change. Gald that we are left with the last part, XML writing

Wednesday, October 21, 2009

Week 4 Day 3

Finally begin on the last part of development, data integration for various forms and XML file saving. Today was an exciting day as the release of Windws 7 is just 24 hours from today. Finally, Windows 7 is going to be released to the public, and to laptops and computers sold around the world.

Its great to see how Windows 7 will bring joy, excitment and efficiency to families, businesses and normal users like us, and also, how it brings out our potential to the fullest.

With great anticipation, I will be looking forward to Windows 7 Launch Tomorrow

Tuesday, October 20, 2009

Day 2 Week 4

Today was the most enjoyable day of the week! Finally found the solution to my coding problem yesterday regarding casting, and everything worked well since. I have since completed 70% of my GUI portion, and just more to go,before I will finally code up the data management portion

Monday, October 19, 2009

Week 4 Day 1

Today's morning was spend on discussing about the GUI and XML loading and writing, and the way it should be programmed, and my progress on the project heightened with the finishing of the InteractionPanelList and InteractionPanel class.

However, there will still be more to do, such as testing, integration with my colleague's code and improvements to the existing code structure to make it suitable for distributing

Week 3 Day 5

Cried out TGIF once I got off from bed today, glad its finally Friday!

Today was spend on continuing on programming the GUI. Succeeded in adding in buttons and textboxes programmically, and realised something:

To set the location of a control (textbox or button), we must assign a Point object to the Location property of that control. Doing textbox1.Location.X::set(2) will not work. It took me a few tries to realise this.

I was also thankful today as a C++ MVP answered some of my programming problems with references and pointers in the msdn forums. He was so detailed that he even taught me step by step how to solve it, and I was so glad that it worked.

Reflection of the week :

This week saw the end of my previous week project and the start of programming a GUI application in Windows 7, Visual Studio. Although I am familar with the drag and drop, and certain features of CLR, such as the Control class and the Form class, I am still unable to complete an application in a short time due to the language differences.

Each language is unique, and although CLR makes it simpler, and Visual Studio makes coding more enjoyable, it is the core of the language that we must know in order to allow us to finish a great project in that particular language.

Thursday, October 15, 2009

Week 3 Day 4

Today was still about coding on the GUI xml writer. I have came to realise how lucky I was in the old days where I was coding Windows Applications in C#. In C++, many things are not specially catered to help in easier coding, unlike in C#, where everything is made easier for everyone.

However, although coding in C++ is not simple and easy, it has allowed me to specialise in an additional language that I otherwise, would not have any opportunity to learn

Wednesday, October 14, 2009

Week 3 Day 3 @ IHPC

Today we have finished up on XMLReader, and started coding an XML writer. When I heard I was going to be coding in Windows and Visual Studio, sheer excitment rings in my head!

Missed coding in Visual Studio after a few weeks of coding in Linux, and of course missed Windows 7 also.

Not feeling well today, and I guess this will be my post for the day, will post more things tomorrow : D

Tuesday, October 13, 2009

Week 3 Day 2

Yep, today we continued from yesterday's assignment, and I found out that TinyXML libraries cannot work. As such, I switched on to LibXML (xml parsing), and things went on smoothly. Today not only did I learn about steps to take in trouble shooting libraries or codings in C++, I also learned about how spaces or new lines can interfere with XML parsers, and how to bypass them.

Basically the bypass can be done through a while loop (indefinite loop as we do not know how many new lines or space we have), and followed by a code to assign the next node into the current node variable. This simple code will help to bypass spaces and newlines

Monday, October 12, 2009

Start of Week 3!!

Time passes, and it is the 3rd week (3/4 month) I am working at IHPC, and I can feel I am slowly adapting to the working world environment.

Today we started on our project of XML parsing (reading and writing). One of my learning points today was compatibility across platforms. C#, Java and Visual Basic, unfortunately, are under the .NET framework and therefore are not cross-platfrom compatible, unless you were to install a special application on Linux and Mac (called Mono). The language that I learn and know to be cross platform is Flash and Actionscript.

Indeed, in the business world, although many things are made cross-platform through an application (eg. Mono), but more of the focus is on allowing the application to be cross platfrom without requiring the user to install additional software

Thursday, October 8, 2009

Week 2 Day 5

Today most of the time was spent on implementing new features, such as text showing the ID of the laser, and also some bug fix to the existing application( previously it recognize the new laser's ID as one more than its actual ID when 2 laser beams are shown.

It was due to the fact that my existing vector had actually stored lasers that are alive and not alive, and the coordinates vector only stored lasers that are alive. It was resolved by declaring another vector to store only the ID of lasers that are alive

Another thing I learned would be string concatenation in C++. While in C# and Java we could just use string s = "id : " + idNum; In C++ this will not work. We have to use an Osstring to store the entire concatenated string, and then convert it to a char array(char string) type.

Reflection of the week :

Time flies and its the end of my 2nd week at IHPC. I have learned deeper into svn, open cv, and programming with cameras and lasers, which I had never done before in my polytechnic education.

This week was interesting as we touch on programming, and learned more on C++. All along I have heard C++ is a powerful language used to program games, applications, and even Operating Systems, and only when programming using it, I realise it is indeed true.

This week also had me learning more about time management as I have to rush over to Microsoft and discuss events at 6.30pm, while managing my work in IHPC. Time was indeed a bit tight for me, but nevertheless, I struggled a bit, managed to made it.

Indeed in the working world, time will be tight, and the temptation to procrastinate would be great. Adam Khoo once said," Procrastination is the ultimate killer of success", yet in some aspects of my life, I am still procrastinating on.

Indeed next week time will be tight as I will need to take care of 2 events next week, and also quite alot of work at IHPC

Week 2 Day 4

Continuing from yesterday's codes, today's morning and afternoon were left with finishing up the "X over laser" application, and solving some syntax errors after finishing the codes.

However, when we try out the finished application, it start to draw many crosses, even though no lasers were shown, and the position of the lasers being drawn are critically weird. As the Lightdraw application is suppose to return only a range of x and y coordinates between 0-1 in range, the application appears to retrieve data of 1,000 and above. The mysterious point was that we put a code to display an output to console whenever a packet is being received, and this allows us to see that no packet was actually received when no laser is shone, and this points me to the question : where does all the weird values comes from?

One answer from my internet research would be they are uninitialized values.

With the help of Ming Hong, we used a Vector instead to store the data received, and it worked perfectly well, with no weird values received. I also found out that I was all along using the wrong way to pass an array or object into a method.

The correct was actually :
passInArray (& myArray);

and not :

passInArray (myArray);

Furthermore, I have also came to know how to use Vector today

Time flies, and tomorrow would be the end of my 2nd week in IHPC, and yet it feels so much like my first day at IHPC. The amount of data (opps, I mean knowledge) I gained is definitely more than what any of my subjects would have covered, and I am gald that I am given this opportunity to have this internship at IHPC

Wednesday, October 7, 2009

Week 2 Day 3

Today we were tasked with creating an application that would mark an "X" over the spot of the laser used in lightdraw, and modifying the application that I did yesterday, I have managed to create the "X" mark over the laser spot

While moving the algorithm to the actual lightdraw application, I manage to see and play with the source code of LightDraw. The entire code for Lightdraw was quite complex, and fortunately thanks to Ming Hong's help in explaining about some parts of the code, I was able to understand and thus discover about some syntax that I have never seen before.

After some trials, the algorithm worked, however it only manage to show only one cross (for only 1 laser pointer) now. Besides, the cross also would not disappear even after the laser pointer is no longer shining on the surface. Ming Hong guide us about this, and we would need to make use of the "alive" messages in order to solve this.

Overall, today have been an exciting day working with codes and laser pointers, and learning more into how LightDraw was developed

Tuesday, October 6, 2009

Week 2 Day 2

Today was one of the most interesting day of all my programming days.


For first, I have managed to code up a C++ application that displays what the video camera see.


Next, simply just 2 lines of codes were added to include a "press c to capture" function. For these 2 features, I realise there wasn`t much coding that needs to be done. All the methods to do up these features were provided by OpenCV libraries, and all I need to do was to code up the while loop (to loop the capturing of image), and some variables.


As according to tradition, I captured an image of my SIP-team mate, victor, doing coding, which I believe would be the first few photos in this pictureless blog so far.









After lunch, we moved on to the last tasks which was to create a circle enclosing the area which is the brightest. I spent about an hour googling on contours and some RGB stuffs, only to find out that all that were irrelevant, and only one method, cvMinMaxLoc was needed. This method does not return objects, but it takes in memory address of 5 things, the converted single-channel (or colour) image, min(darkest) value, max(brightest) value, min(darkest) location and max(brightest) location (or spot), and write data to the variables at this memory address.

Thereafter, we used cvCircle to draw a small red circle with its centre point at the "max(brightest) location". The program worked out fine, and when we shine a laser light on a dark surface, it just feel great to see that the application is able to circle out the laser pointer's lightspot on the dark surface.

Next, we then moved on to removing the red circle when the laser pointer is not shining. First, we identified the brightness of the laser pointer's light spot on the wall, and was surprised it was the max value (255). After setting up an "if" statement to only draw the circle when the brightest spot is 255, the red circle now disappears whenever the laser pointer is not shinning, and reappears upon the laser pointer begin shone on the wall.

Monday, October 5, 2009

Week 2 Day 1

Today I have hands on on SVN and CVS, and even though I have used them during my major project, there were many things which I did not know in the past.

For instance the creation of repository, and the importing of files into it. During my major project days, we used assembla.com 's repository. Assembla created a repository for us when we create an account, and as such most of the time we used svn and cvs were regarding commiting, updating or reverting. The friendly tortoise client did the command line commands for us, so much so that we don`t even notice what goes on behind it.

To first create a repository, a directory will need to be created in either svn/ or srv/svn/. Thereafter, permission and rights will need to be set using the chown command, and chmod command. After they are granted, a console command, svnadmin create will need to be entered to create an entry in the repository of the current system, and lastly, users will need to be added in to the 's password configuration file. Assuming that svn and ssh has been installed and started, we can now import in files using svn file:///

During the next half of the day, time was spending on re-installing Fedora, and reconfigurating it to prepare for our actual work. The problems re-occurred reminded me of my first experience with them, and I was able to solve them more faster than when I initially faced them. However and unfortunately, due to a lack of understanding of svn, alot of time was spent on tracing and trying to solve the problem than doing actual work, and soon after Kevin show us the solution, the problem was due to the simple fact of missing the simple step of setting permission.

I would certainly feel the day have been wasted by my lack of knowledge in Linux components and my forgetfulness, and certainly I would have learned and achieved more things back today if I remain calmer and thought more carefully. As such, my goal for tomorrow would be to learn at least 4 main things, and finish up on the things Ming Hong have given me

Friday, October 2, 2009

Wee1 Day 5 @ IHPC

Today I learned about what's behind the magic when we run ./configure and make / make install. Apparently, ./configure examines the system and determine if the system is suitable for installing the respective software.

In the event where the system does, ./configure would then compile a script that would compile and install the program specifically to suit the environment of the current system. Thats where we would run "make", which compiles the source codes in the installation packages into a executables. "make install" is then run to install the respective executives or libraries into the system.

In the afternoon, we also learned about programming CV library. Created an application that draws rectangles and circles on a dark background. I have also found an application in the "samples" directory of OpenCV that can detect faces in photos! Thats something very cool! Imagine if we could even enhance the application to patch up pimples or eye bags in photos, would that save designer a lot of time? Apparently I looked through the source code, but am still unable to comprehend the code, but determined to learn it by Sunday, and possibly modify the application to work with larger photos (currently it can`t even run with pictures larger than 500 px by 500 px)

During the afternoon, me and Vic also watached "Pirates of the Silicon Valley", and found out various discoveries :
1) Steve Jobs set up Apple earlier than Microsoft was being set up
2) DOS was not created by Bill Gates, but bought from another programmer instead, and improved by Bill Gates
3) The starting point that result in Bill Gates prospering was his partnership with IBM
4) Both Bill Gates and Steve Jobs already came together to help each other in the past, not only just in recent times

Certainly there are many other points brought forward by the movie which could be untrue, butI would check them out over the few days and post them when I am certain they are true.

This week was the week I learned the most, as compared to any days I spent in my school. Although there were many difficulties, but with the help of Ming Hong and Kevin, I made it through, and learned many things I had never even thought before


Reflections:

Indeed life in SIP is different from life in school. No more waking up late and no more late nights out. These, even though initially I worried that I might not be used to switching over, but I am now able to. As compared to the life before, I can feel I am now more heatlhier and on schedule than before. Thus, I would consider this a great improvement to my life.

Through the first week of my SIP, I learned about Linux, its origins, its distributions, and how to install programs in it, its terminal commands. We have also learned the concept of ftp, ssh and remote desktop, and the actual use of it. Other than this, we also learned Console output and FileIO in C++. OpenCV library was one of the most fascinating libraries I have came to know. LightDraw was developed 2 years ago using the same OpenCV library I am learning about now.

In the past, I have always taught that high level programs like LightDraw were developed using new and advanced languages, such as ActionScript 2.0, and now, I am just simply fascinated it was developed just using the C programming language.......and just with OpenCV library.

This has taught me in life that we should not neglect the ability of simple things to create miracles. LightDraw was something big and extraordinary,but it was not developed using C#, not Java, not C++, but just C.

Hope everyone have a nice weekend ahead :)

Thursday, October 1, 2009

Day 4 of the first week

Yay, finally got started with C++ programming, and found that there is actually very little differences between C++ and C#, or even between other programming languages. The only differences is only the way we write it. For example, in C#, we wrote System.Out.Println("something");

In C++,its including the iostream header, followed by : cout << "something" ;

The whole code will therefore look something like this :
#include
int main()
{
cout << "something";
return 0;
}


Also with FileIO, in C++ is fairly simple :
ofstream outfile ("test.txt");
outfile << "This is the text I want to write to this file, followed by a new line character" << "\n";
outfile.close();

Yep, unbelievable, just 3 lines only!

Also learned about pointers, and that there is no ArrayList in C++ (in C#, ArrayList allow us to store, sort, remove any tye of object).

Next we moved on to OpenCV library. Unfortunately, the newly release version 2 (released just yesterday) caused many problems while installing, and eventually it took up the whole of the day. However, reading Lup Peng's blog, Open CV library seems to be able to do wonders of modifying images, and creating even special effects in them.

If only I could remote to my IHPC's computer now.....and start on discovering the magic of OpenCV...

Wednesday, September 30, 2009

Week 1 Day 3

Today I learned quite a number of stuff. To begin with, I now know that for Linux, its founder only created the Linux Kernel, and the rest of its components have totally nothing to do with its founder.

There are so many distributions (or type) of Linux, not because of the development team, but because of distribution people who put together the different components of Linux (such as Messenger for Linux, FireFox for Linux) , and they called their combination names. An example would be Ubuntu and Fedora.

Currently, the most popular Linux OS is Ubuntu, not because it has a nice name, but because the person who combined the components to form Ubuntu focuses more on making it work well, rather than being concerned about the availability of the source code for its components.

Another key learning point today would be the use of FTP,SSH service and Remote Desktop in Linux. Indeed Linux doesn`t like me, encountered many failure while trying to install and run Remote Desktop. At last Kelvin came to my help, and another GUI Remote Desktop service, called vino, was installed and used, and I was gald it finally managed to work. The Remote Desktop service installed in Linux can not only be used to Remote Windows Desktop, but also MAC desktop, and this is what Windows Remote Desktop is currently unable to do

Terminal commands (or Command Prompt commands) in Linux were also taught to us today. Although some common ones such as cd, mkdir are common to me as they exists in windows, there are many that I have never see before, such as ls, killtask, vi. I am also taught regarding the Linux's structure for its folder, and how is it different from Window's structure.

The last learning point of today would be GNOME and KDE in Linux. GNOME and KDE are developed by 2 different groups, and they are responsible for the display interfaces in Linux. GNOME focuses more on stability whereas KDE focuses more on Special effects, such as transparency. Although KDE does look much better, but it is not as stable, and not too compatible with certain programs too.

For instance, if another machine were to Remote to a computer running Linux using KDE, the Client connecting to the Linux PC running will see some weird colours effect, that is not seen on the actual PC

The day passed so quick that it was like a blink of the eyes, and tomorrow I will be getting started on learning more about C! Feeling excited!!

Monday, September 28, 2009

Week 1 Day 2

Today was the second day at work, learned about jhow Project Hollow Touch is going to be implemented, and can`t wait to work on that.

Currently the plans for my internship are as follows :
- Now till Mid October -->learning basic stuffs
- Mid Oct till Mid Nov -->LightDraw project enhancement
- Mid Nov till Mid Jan -->Project Hollow Touch
- Mid Jan till Mid Feb --> 2 Applications for Hollow Touch

Now I am still trying out on Fedora, so far installation was successful, Firewall working, Media Player working, Web Browser working.

Currently there are problems with the FTP service ( by proftpd ), which I am still not able to solve by the end of today. Although I have found a solution, which is to use PureFtpd instead, but I wanted to know and understand why ProFtpd failed to work, and hence spend much of the time trying to understand what is wrong with it.

Today we were shown how Graphics were made into Studio images when there are 2 different images (each being seen by each eyes). We were also taught regarding the flickering effect on the Studio Glasses, and how does it help each of the eyes to see different images. When Kelvin explained to me the use of 3D cameras to capture a dimension called depth, I was surprised. I had never known that there is such type of camera, and it actually uses infra red to measure the distance

Our first assignment will be to create an application that allows our hands to interact with Studio objects on the screen, and when its being pushed, it will move according to the direction of the initial action

Sunday, September 27, 2009

First Post - First Day of the week

Hello IHPC ! Its my first time using MAC to blog. Today was my first day of work at IHPC, and the demos of LightDraw blow my mind away. However, it leaves me with one question, how is it able to differentiate between 2 different lasers, with the same amount of light being shone, without confusing one for another.

After the demo, we were asked to review Lup Peng's blog at IHPC. Their development process seems interesting, but there are some parts that I couldn`t understand well due to the technical terms used. Nevertheless, it was interesting reading about their experience developing the LightDraw project, which was initially a gaming project, and slowly evolved to LightDraw. The blog actually provided me with what I will be doing throughout my intern, and reading it was thus preparing myself and getting the overview of the work to be done.

Thereafter, we were also tasked to research on Linux OS, and select 2 versions that suits what we will be doing. When I saw the list of Linux OS available, I was surprised as I initially only knew about Red Hat Linux OS, and thought that it was the only OS available for linux.

We researched for almost 30 minutes, and was pondering on 32 bit and 64 bit architecture, when Kelvin give us a lesson on the differences and their advantages. Sincerely speaking, if now I were to ask any of my friends which is better, most will certainly says 64 bit, because "it has more bits". It was only today I found out of the advantages and disadvantages of 64 bit. It is able to support > 4gb of memory, however, if the application developed does not use much data type of size 64 bits, there won`t be any differences in terms of speed and performance.

Thanks Dr.Kelvin and Dr.Ming Hong for your guidance

My favorite task was when it comes down to setting up desktops and installing the OS. I haven`t done it for a long long time since my Secondary School days, and I terribly missed assembling PCs, setting up computers and installing OS in them.

Can`t wait for tomorrow to setup the PCs and install Linux OS! Feeling excited once again!