Hi All
I get questions once in a while about this blog and just to let you know that I have ceased to update the blog. It will be left here to help others who may one day walk along the path of OpenCV and OSX and hopefully some of my past experiences can help you solve your problems and/or inspire you.
Happy New Year!
Thank you, and congratulations to Kevin :)
Wednesday, December 31, 2008
Monday, September 15, 2008
Setting up Lightdraw
JL hinted me on this before he got enlisted - the set up behind the Lightdraw application. Look at how easy and convenient it is!
Tuesday, March 18, 2008
Lighting the next draw...
Lightdraw has progressed for quite a bit since we last left IHPC. The project is in good hands with Kevin, Cheng Teng and Situ Yi at the forefront of its development.
Over the past few days, Lightdraw has received quite a bit of attention. Let's see where Lightdraw has gone:
Polytechnic Student Research Programme , Best Project Award Presentation Ceremony
I have received no official description about this event, so let me put it in simple terms: The PSRP is a program where all five polytechnics will choose their top two research projects and have the students to present them at the Award Presentation Ceremony. Lightdraw was selected to represent Temasek Polytechnic for the year 2008. In this year, only three polytechnics participated, namely, Ngee Ann Polytechnic, Singapore Polytechnic and Temasek Polytechnic.
The guest of honor for this event is Mr Boon Swan Foo, Executive Chairman for Exploit Technologies Pte Ltd, Chairman for Technology Transfer Network and Managing Director of Agency of Science, Technology and Research (A*STAR).
Below are two pictures taken from the invitation book, with Lightdraw highlighted with a red rectangle overlay (in the second picture).


This event was also covered by Channel News Asia and was mentioned during the news broadcast as well as on its website (http://www.channelnewsasia.com/stories/singaporelocalnews/view/334218/1/.html). If the link does not work, you can refer to the picture below of a scanned printed version.

Temasek Informatics & IT School Project Show 2008 + Lianhe Wanbao
Lightdraw was also showcased at Temasek Informatics & IT School's Project Show. It was categorized under the "IT @ Work" category (the other two were IT @ Play and IT @ Home). This is the first project in the booklet given to all guest and industry partners who attended the Project Show. For this demonstration, we were given an enclosed room to set up and show Lightdraw. Some of the more exciting challenges in doing this were:
Below is a project write up of Lightdraw, in the booklet given to all guests.

On the same morning as the Project Show, a reporter from Lianhe Wanbao (a chinese newspaper) had a short phone interview with us. An article about Lightdraw came out the very same day in the evening copy of Lianhe Wanbao. The scanned version is below:

V-Camp
I was informed that Lightdraw Game: Whackapeng, was used in this community event. The kids who came down to IHPC had a great time playing the simple game of encircling two game pieces (or what they call "pengs") with ordinary everyday devices, such as torchlights and hand phones.
Lightdraw Video II
ASTAR Institute of High Performance Computing released a second video of Lightdraw onto YouTube on March 13, 2008. As of this blog post, it has gathered 28 views so far. The second video (or first public video) consists of newer video footage such as Whackapeng and Laser Window Manipulation. It also retained some previous functionality footage from the first cut. Without further ado, here is the video:
This is Lightdraw's 15 minutes (or more?) of fame. Hopefully, there will be much more in the future to increase the awareness of the existence of such a cool project.
Over the past few days, Lightdraw has received quite a bit of attention. Let's see where Lightdraw has gone:
Polytechnic Student Research Programme , Best Project Award Presentation Ceremony
I have received no official description about this event, so let me put it in simple terms: The PSRP is a program where all five polytechnics will choose their top two research projects and have the students to present them at the Award Presentation Ceremony. Lightdraw was selected to represent Temasek Polytechnic for the year 2008. In this year, only three polytechnics participated, namely, Ngee Ann Polytechnic, Singapore Polytechnic and Temasek Polytechnic.
The guest of honor for this event is Mr Boon Swan Foo, Executive Chairman for Exploit Technologies Pte Ltd, Chairman for Technology Transfer Network and Managing Director of Agency of Science, Technology and Research (A*STAR).
Below are two pictures taken from the invitation book, with Lightdraw highlighted with a red rectangle overlay (in the second picture).


This event was also covered by Channel News Asia and was mentioned during the news broadcast as well as on its website (http://www.channelnewsasia.com/stories/singaporelocalnews/view/334218/1/.html). If the link does not work, you can refer to the picture below of a scanned printed version.
Temasek Informatics & IT School Project Show 2008 + Lianhe Wanbao
Lightdraw was also showcased at Temasek Informatics & IT School's Project Show. It was categorized under the "IT @ Work" category (the other two were IT @ Play and IT @ Home). This is the first project in the booklet given to all guest and industry partners who attended the Project Show. For this demonstration, we were given an enclosed room to set up and show Lightdraw. Some of the more exciting challenges in doing this were:
- Wall Reflection - As the room walls were white, they tend to reflect an awful amount of light
- Webcam Compatibility - We had difficulty in finding the right camera to use for Lightdraw on Ubuntu
Below is a project write up of Lightdraw, in the booklet given to all guests.

On the same morning as the Project Show, a reporter from Lianhe Wanbao (a chinese newspaper) had a short phone interview with us. An article about Lightdraw came out the very same day in the evening copy of Lianhe Wanbao. The scanned version is below:

V-Camp
I was informed that Lightdraw Game: Whackapeng, was used in this community event. The kids who came down to IHPC had a great time playing the simple game of encircling two game pieces (or what they call "pengs") with ordinary everyday devices, such as torchlights and hand phones.
Lightdraw Video II
ASTAR Institute of High Performance Computing released a second video of Lightdraw onto YouTube on March 13, 2008. As of this blog post, it has gathered 28 views so far. The second video (or first public video) consists of newer video footage such as Whackapeng and Laser Window Manipulation. It also retained some previous functionality footage from the first cut. Without further ado, here is the video:
This is Lightdraw's 15 minutes (or more?) of fame. Hopefully, there will be much more in the future to increase the awareness of the existence of such a cool project.
Tuesday, February 5, 2008
Week 16 (4 Feb - 8 Feb)
Monday, 4 February 2008
We have been informed of a final presentation tomorrow to the Visualization department of AC, as well as anyone interested to attend.
We started working on the slides in the afternoon, as well as on the new Lightdraw video - but we discovered, though quite late into the recording, that the software used to record the video has expired its trial period. We tried to use another freeware program, but it seemed to hang whenever it started to encode the video.
Tuesday, 5 February 2008
In the morning was our presentation to the visualization group in the AC department. After which, was lunch at a nice French restaurant around Holland Village, attended by Harold, Bernard, Cheng Teng, Situ Yi and Kevin.
After lunch, its clearing time. Cleared up room, desktop and laptop that I used for the past 16 weeks. Finally finished the report rewriting and hopefully it is better than what I had written previously. Although I know that it is nowhere near perfect, but I am determined to keep on reading and learning from other reports, extending my vocabulary and correcting my grammar to strive for perfection.
Also handed in my February Time Sheet and RFID pass to HR. Within a short time span, 16 weeks in IHPC have passed and this marks the end of my internship stint here. Within these period, many things have happened and compared to the time when we first walked in the doors of IHPC, we are now leaving it being much wiser and knowledgeable. All this is possible to everyone at IHPC who have made this internship much more enriching and entertaining. I truly enjoyed working at IHPC for my internship.
Our paths have criss-crossed and traveled parallel to each other's for the past 16 weeks. But now, our paths gradually diverge.
Till our paths cross again!
Other than that, I will definitely miss the COVE and the Wii times.
Wednesday, 6 February 2008
New Year's Eve, there is no work today.
Thursday, 7 February 2008
Chinese New Year! Today is a public holiday and thus, there is no work.
Friday, 8 February 2008
Chinese New Year! Today is a public holiday and thus, there is no work.
Reflection of the Week:
The end of 16 weeks is pretty fast.
As long as we live and learn with an open mind and accept everyone for who they are, stay humble and learn from others, we will pick up many things beneficial to us, both hard and soft skills. It makes us realize how fast life is passing us by and how to make full use of it.
Working in a research environment has helped me gain and hone my problem solving skills as well. To quote Dr Eng: "There's always a line between industry projects and research projects. In research, you never stop asking yourself 'can't I do better than this?' that's how breakthrough in research is achieved."
He has hit the nail right on its head. We always get too caught up with the specifications and datelines that we fail to venture out of the normal line of work and ask ourselves: what can I do to make this function perform better? How can I make the data in the database reusable across many applications? And other questions that help lead the way to innovative and effective ways of performing the same tasks.
Trying and developing new things that are out of the ordinary and common path is no doubt challenging and exciting. I really hope to see the real full fledged version of Lightdraw in action one day. :)
We have been informed of a final presentation tomorrow to the Visualization department of AC, as well as anyone interested to attend.
We started working on the slides in the afternoon, as well as on the new Lightdraw video - but we discovered, though quite late into the recording, that the software used to record the video has expired its trial period. We tried to use another freeware program, but it seemed to hang whenever it started to encode the video.
Tuesday, 5 February 2008
In the morning was our presentation to the visualization group in the AC department. After which, was lunch at a nice French restaurant around Holland Village, attended by Harold, Bernard, Cheng Teng, Situ Yi and Kevin.
After lunch, its clearing time. Cleared up room, desktop and laptop that I used for the past 16 weeks. Finally finished the report rewriting and hopefully it is better than what I had written previously. Although I know that it is nowhere near perfect, but I am determined to keep on reading and learning from other reports, extending my vocabulary and correcting my grammar to strive for perfection.
Also handed in my February Time Sheet and RFID pass to HR. Within a short time span, 16 weeks in IHPC have passed and this marks the end of my internship stint here. Within these period, many things have happened and compared to the time when we first walked in the doors of IHPC, we are now leaving it being much wiser and knowledgeable. All this is possible to everyone at IHPC who have made this internship much more enriching and entertaining. I truly enjoyed working at IHPC for my internship.
Our paths have criss-crossed and traveled parallel to each other's for the past 16 weeks. But now, our paths gradually diverge.
Till our paths cross again!
Other than that, I will definitely miss the COVE and the Wii times.
Wednesday, 6 February 2008
New Year's Eve, there is no work today.
Thursday, 7 February 2008
Chinese New Year! Today is a public holiday and thus, there is no work.
Friday, 8 February 2008
Chinese New Year! Today is a public holiday and thus, there is no work.
Reflection of the Week:
The end of 16 weeks is pretty fast.
As long as we live and learn with an open mind and accept everyone for who they are, stay humble and learn from others, we will pick up many things beneficial to us, both hard and soft skills. It makes us realize how fast life is passing us by and how to make full use of it.
Working in a research environment has helped me gain and hone my problem solving skills as well. To quote Dr Eng: "There's always a line between industry projects and research projects. In research, you never stop asking yourself 'can't I do better than this?' that's how breakthrough in research is achieved."
He has hit the nail right on its head. We always get too caught up with the specifications and datelines that we fail to venture out of the normal line of work and ask ourselves: what can I do to make this function perform better? How can I make the data in the database reusable across many applications? And other questions that help lead the way to innovative and effective ways of performing the same tasks.
Trying and developing new things that are out of the ordinary and common path is no doubt challenging and exciting. I really hope to see the real full fledged version of Lightdraw in action one day. :)
If whatever is fun isn't tiring, would we ever stop doing it?
The lesser the routine, the more the life.
Monday, January 28, 2008
Week 15 (28 Jan - 1 Feb)
Monday, 28 January 2008
Morning was spent dedicated to adding methods to our class diagram for the Lightdraw controller and DisplayManager. The libraries were left alone for the time being as they are the easiest to do (as the Lightdraw controller would just pass on calls to it).
Another thing that was discussed was how to allow a developer to make use of the plug-in architecture to write his/her own menu and add it to the Lightdraw package.
In the afternoon, focused on improving vertex detection by enforcing the light to be within a certain range from the initial point instead of just any where in the square (think resize range + draw implementation) and helped JL to improve the original Lightdraw code to implement the similar feature in it.
Tuesday, 29 January 2008
Mucked around with creating a custom structuring element in an attempt to apply a structuring element to the morphological thinning. Learnt quite a few new things like how structuring elements work, how its grid size works, etc.
I also found something new today: 509 Error is a "bandwidth exceeded" error returned from the server.
Anyway, just side track a bit, I found this very interesting post on the yahoo group. Please note that this is not posted by me, and the author is at the bottom of the post.
Wednesday, 30 January 2008
The learning point for today is to spend some time to write proper reports. Why do I say so?
It was something that Kevin said that made me thinking back to my mid semester presentation on Lightdraw and a lecture in school (I think it was SSM) ponder about it.
There are already many developers out in the industry working for years now and given their technical skills, they make excellent developers for various projects. However, why do some of them get stuck in the development sector, being unable to move on to more important jobs like a project manager or a sales engineer?
Well, I believe that the answer has got to do with reports and presentations. Someone once said - "A good software system is nothing if no one wants to use it". Which is pretty true - if the sales and marketing team or project manager is unable to convince (potential) stakeholders on investing or using the software system, it will just be another white elephant (no pun intended) shelved away.
Reports and presentations are important to bring across the messages and ideas which one might have. It also has the power to convince the listener on why he should invest his time and money into the project or system. I guess we cannot run away from the fact that our IT systems will be used by business and thus need a solid business plan to accompany it.
Kind of reminds me on Imagine Cup last year, where although the software system may be the best there may be, without being able to articulate our advantages across will mean nothing to the judges.
And now, its back to my report.
Thursday, 31 January 2008
Nothing much to talk about for today for no actual development work took place. It is more about the report and OO design of Lightdraw. For the OO Design, we contemplated of having signals and slots structures managed by an event handler, and the discussion of whether we needed it or not.
Friday, 1 February 2008
Today is spent in school at the career fair.
Oh well.
Reflection of the Week:
I was at career fair on Friday and took a look around at the various booths of potential employers as well as the booths of universities. I also attended various talks about potential job applications from employers, such as PA, CAAS and Thatz, and University talks by NUS, SMU and NTU.
I also met one of my previous math tuition friends, Charlene. And we recalled the last time that we were back at our tutor's place being referenced by the format (school name) (secondary level) (boy or girl) (any other info e.g. tall). The arriving in our school uniforms every afternoon with our other barang2 at 2.30pm or 4pm and doing our questions through the afternoon silently, only asking our tutor when we needed help.
Later that day over dinner, I was amazed with how fast time flies. I can still remember myself at orientation back in 2005, the first time meeting my care person, my Alice project (first project in polytechnic) and JPetWorld. In fact, all the way back to my maths tuition teacher's house (even before polytechnic days) - pouring over the questions and working out the answers absentmindedly.
3 years later, I'm now at the end of my polytechnic education, thinking of which university to apply for. What happened during these 3 years? Well, the answer to that would include the juggling of my various commitments, projects, events, getting to know more people over time and making new friends across TP's 5 faculties, and many others. It is very shocking, daunting yet exciting that in May, we would graduate from a place we called school (or for some, home) for the last 3 years and move out into a broader playing field full of opportunities and new experiences.
Time waits for no man. It is what we make out of it.
Morning was spent dedicated to adding methods to our class diagram for the Lightdraw controller and DisplayManager. The libraries were left alone for the time being as they are the easiest to do (as the Lightdraw controller would just pass on calls to it).
Another thing that was discussed was how to allow a developer to make use of the plug-in architecture to write his/her own menu and add it to the Lightdraw package.
In the afternoon, focused on improving vertex detection by enforcing the light to be within a certain range from the initial point instead of just any where in the square (think resize range + draw implementation) and helped JL to improve the original Lightdraw code to implement the similar feature in it.
Tuesday, 29 January 2008
Mucked around with creating a custom structuring element in an attempt to apply a structuring element to the morphological thinning. Learnt quite a few new things like how structuring elements work, how its grid size works, etc.
I also found something new today: 509 Error is a "bandwidth exceeded" error returned from the server.
Anyway, just side track a bit, I found this very interesting post on the yahoo group. Please note that this is not posted by me, and the author is at the bottom of the post.
You can use "cvGetSeqElem" function..
This is my simple example of finding center point of contour.
------------------------
CvPoint pt[CLENGTH_MAX],center={0,0},ptk={0,0};
cont_no = cvFindContours( segbw, storage, &contour, sizeof
(CvContour),CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);
for( ; contour != 0; contour = contour->h_next )
{
CvSeq* result = contour;
for(i=0; itotal; i++)
{
pt[i] = *(CvPoint*)cvGetSeqElem( result, i );
//printf("%d %d : %d\n", pt[i].x, pt[i].y, result->total);
center.x += pt[i].x;
center.y += pt[i].y;
}
center.x /= result->total;
center.y /= result->total;
:
:
}
------------------------
Good Luck!
Tommy Kim.
Wednesday, 30 January 2008
The learning point for today is to spend some time to write proper reports. Why do I say so?
It was something that Kevin said that made me thinking back to my mid semester presentation on Lightdraw and a lecture in school (I think it was SSM) ponder about it.
There are already many developers out in the industry working for years now and given their technical skills, they make excellent developers for various projects. However, why do some of them get stuck in the development sector, being unable to move on to more important jobs like a project manager or a sales engineer?
Well, I believe that the answer has got to do with reports and presentations. Someone once said - "A good software system is nothing if no one wants to use it". Which is pretty true - if the sales and marketing team or project manager is unable to convince (potential) stakeholders on investing or using the software system, it will just be another white elephant (no pun intended) shelved away.
Reports and presentations are important to bring across the messages and ideas which one might have. It also has the power to convince the listener on why he should invest his time and money into the project or system. I guess we cannot run away from the fact that our IT systems will be used by business and thus need a solid business plan to accompany it.
Kind of reminds me on Imagine Cup last year, where although the software system may be the best there may be, without being able to articulate our advantages across will mean nothing to the judges.
And now, its back to my report.
Thursday, 31 January 2008
Nothing much to talk about for today for no actual development work took place. It is more about the report and OO design of Lightdraw. For the OO Design, we contemplated of having signals and slots structures managed by an event handler, and the discussion of whether we needed it or not.
Friday, 1 February 2008
Today is spent in school at the career fair.
Oh well.
Reflection of the Week:
I was at career fair on Friday and took a look around at the various booths of potential employers as well as the booths of universities. I also attended various talks about potential job applications from employers, such as PA, CAAS and Thatz, and University talks by NUS, SMU and NTU.
I also met one of my previous math tuition friends, Charlene. And we recalled the last time that we were back at our tutor's place being referenced by the format (school name) (secondary level) (boy or girl) (any other info e.g. tall). The arriving in our school uniforms every afternoon with our other barang2 at 2.30pm or 4pm and doing our questions through the afternoon silently, only asking our tutor when we needed help.
Later that day over dinner, I was amazed with how fast time flies. I can still remember myself at orientation back in 2005, the first time meeting my care person, my Alice project (first project in polytechnic) and JPetWorld. In fact, all the way back to my maths tuition teacher's house (even before polytechnic days) - pouring over the questions and working out the answers absentmindedly.
3 years later, I'm now at the end of my polytechnic education, thinking of which university to apply for. What happened during these 3 years? Well, the answer to that would include the juggling of my various commitments, projects, events, getting to know more people over time and making new friends across TP's 5 faculties, and many others. It is very shocking, daunting yet exciting that in May, we would graduate from a place we called school (or for some, home) for the last 3 years and move out into a broader playing field full of opportunities and new experiences.
Time waits for no man. It is what we make out of it.
Once again, we put another chapter behind us and move on to the next, bringing with us the progress of the storyline and its characters. At the end of each chapter, we are just a fraction closer to the end of the book.
Monday, January 21, 2008
Week 14 (21 Jan - 25 Jan)
Monday, 21 January 2008
Somehow, Lghtdraw game gave its final problem of its makefile (which i had overlooked in my haste to finish up the project) but it has been solved earlier today.
We also did a bit of designing of Lightdraw in its OO version and have thought up of many new ideas on how to present the interface to the user. New ideas aplenty, now its time for the cool off period to evaluate them.
And to officially move on to Vertex detection.
Tuesday, 22 January 2008
Did a bit of domain modeling in the morning and moved on to Sim Lim after lunch to buy some materials needed for the project when we move on to lasers.
Wednesday, 23 January 2008
Situ had managed to buy some individual parts at Sim Lim yesterday and was working on creating a infra-red makeshift torch light for replicate the Wiimote tracker based on the Youtube video we saw. All went well with him completing the two torches powered via USB to save batteries.
Today I started work on the HCI which has move and resize capabilities, to develop shape recognition within the square that is being manipulated. Took me quite a while (probably due to lack of sleep) to understand it first before starting to implement my portion. Managed to get it to start drawing within the shape by the end of the day.
Thursday, 24 January 2008
Continuing from yesterday, I carried on to implement shape detection together with the help of JL who has helped me in many ways when my brain dead period prevented me from doing the most basic tasks.
We finally managed to get it working, with a bit of tweaking of the previous whackapeng (Lightdraw game) findCircles function's codes to implement a pattern/corner recognition. And based on the shape/num of Corners within the drawn shape inside the square, we would change the colour of the square being drawn during each draw loop of the main function.
We also discussed on the MVC model for Lightdraw and the pros and cons of having a DisplayManager to coordinate the display & menu classes. The main class diagram seems to be taking shape.
Friday, 25 January 2008
I took a day off today to help out at DipIT JAE booth & IIT School booths overall.
Reflection of the Week:
All the design work is making me feel like I'm back to OOAD classes again. The flow - use cases, domain modeling / class diagrams and next would be sequence diagrams, before we start implementing the system. Thinking back to OOAD classes, I wonder how come it was kind of hard to grasp the concept of doing it back then. Perhaps after doing too much functional programming, we get too caught up with implementation rather than design and extensibility of the system instead.
During the designing of Lightdraw for OOP concepts, it all seems to make sense - the rationale falls into place and understanding of the system is made clear. Finally understand how useful and important OO Design of a software system is, especially to ensure that the software is implementing exactly the way we/the client wants it to be.
Well, maybe OOAD classes is not that bad after all...
Somehow, Lghtdraw game gave its final problem of its makefile (which i had overlooked in my haste to finish up the project) but it has been solved earlier today.
We also did a bit of designing of Lightdraw in its OO version and have thought up of many new ideas on how to present the interface to the user. New ideas aplenty, now its time for the cool off period to evaluate them.
And to officially move on to Vertex detection.
Tuesday, 22 January 2008
Did a bit of domain modeling in the morning and moved on to Sim Lim after lunch to buy some materials needed for the project when we move on to lasers.
Wednesday, 23 January 2008
Situ had managed to buy some individual parts at Sim Lim yesterday and was working on creating a infra-red makeshift torch light for replicate the Wiimote tracker based on the Youtube video we saw. All went well with him completing the two torches powered via USB to save batteries.
Today I started work on the HCI which has move and resize capabilities, to develop shape recognition within the square that is being manipulated. Took me quite a while (probably due to lack of sleep) to understand it first before starting to implement my portion. Managed to get it to start drawing within the shape by the end of the day.
Thursday, 24 January 2008
Continuing from yesterday, I carried on to implement shape detection together with the help of JL who has helped me in many ways when my brain dead period prevented me from doing the most basic tasks.
We finally managed to get it working, with a bit of tweaking of the previous whackapeng (Lightdraw game) findCircles function's codes to implement a pattern/corner recognition. And based on the shape/num of Corners within the drawn shape inside the square, we would change the colour of the square being drawn during each draw loop of the main function.
We also discussed on the MVC model for Lightdraw and the pros and cons of having a DisplayManager to coordinate the display & menu classes. The main class diagram seems to be taking shape.
Friday, 25 January 2008
I took a day off today to help out at DipIT JAE booth & IIT School booths overall.
Reflection of the Week:
All the design work is making me feel like I'm back to OOAD classes again. The flow - use cases, domain modeling / class diagrams and next would be sequence diagrams, before we start implementing the system. Thinking back to OOAD classes, I wonder how come it was kind of hard to grasp the concept of doing it back then. Perhaps after doing too much functional programming, we get too caught up with implementation rather than design and extensibility of the system instead.
During the designing of Lightdraw for OOP concepts, it all seems to make sense - the rationale falls into place and understanding of the system is made clear. Finally understand how useful and important OO Design of a software system is, especially to ensure that the software is implementing exactly the way we/the client wants it to be.
Well, maybe OOAD classes is not that bad after all...
Monday, January 14, 2008
Week 13 (14 Jan - 18 Jan)
Monday, 14 January 2008
Of course, solving this was not alone, it was together with the help of C2E and Kevin.
We finally ended our day at 7pm.

Tuesday, 15 January 2008
Stress testing of Lightdraw game to see if the changes made yesterday actually solved the problem. And they did. :)
The game did seem a bit slow - due to a single processing thread attempting to accept light input, calculate all the shape and enclosed detection, then followed by rendering it out on 4 different displays (for debugging purpose), which made the light trail very segmented each time it ran through the loop.
Thus I decided to carefully examine each line of the source code to see how I could actually reduce excessive and/or debugging code and thread some methods to better the overall game play.
23 pages of code, 2am.

Wednesday, 16 January 2008
Today was spent working on the threaded version of the Lightdraw Game (Whackapeng) two shapes. Managed to finally get the threaded version to work as well as renamed and deleted some methods and variables which were poorly named and declared but not used respectively.
However, some of the resulting problems are:
The program seems to run worse on a single core than the original Lightdraw Game on all four cores. Perhaps the original Lightdraw game will be much worse on a single core? I tried the threaded version on 2 cores and it seems to work better, if not, slightly slower than the original Lightdraw on all four cores. Maybe the conclusion is that the game will need around 2 cores to run at least?
There is a memory leak which I have to fix tomorrow.
There is a segmentation fault which appears sometimes, which does not appear some times, which I have to fix too.

Thursday, 17 January 2008
Fixing the two aforementioned problems in the threaded code. (Ironing them out).
Today, I will also try to use the Mii Editor to replace the game pieces for the Lightdraw game to the Lightdraw team Mii characters! Should be pretty fast and cool.
Fixed the time elapsed problem today as well. Which I think this is something interesting to think about. Initially, I had used the processor ticks to attempt to calculate the total time used for playing the game. In the beginning, it showed results like 112, 142, which did not raise my suspicions as the code was slow (single thread) and drawing did seem to take quite a long time. However, with the threaded version and the ability to draw smoothly now, it still showed values exceeding 100 and sometimes even up to 190 seconds ( more than 3 mins).
After reading more about it and pondering aboutthe meaning of life why the program gave such inconsistent values (in comparison with actual time taken to play the game), a sudden thought struck me. I was taking the number of processor ticks at the start and the end and subsequently subtracting the latter with the former and dividing by a constant to give the number of seconds used. However, because there are a total of four cores on the Light machine, could it be that the two values of clock/processor ticks could come from different processors and thus resulted in inconsistent values?
Anyway, with the help of Harold and Kevin, I changed from using the data type clock_t to time_t which solved the problem. Now, I was taking the system time to do the calculation, which solved the inconsistency.

Friday, 18 January 2008
Final clean up of Lightdraw game. Tidied up the code and removed all the rest of commented out codes which were used for debugging or what not. Also added some commands in the drawing of game piece method to turn of the encircled flags. Hopefully they solve the problem.
We demonstrated the rest of our programs and drawn up some plans for the next week, including optional projects, such as adding vertex detection to JL's code as well as doing the UML for a OO approach of Lightdraw.

Reflection of the Week:
As promised, this week's reflection will be about collaborative work using the internet.
During the previous week, I've been checking out the OpenCV yahoo groups' previous threads in search for some answers to my problems. While there, I noticed a few threads asking about how to use OpenCV library with Visual Studio / Windows Environment; and since I had already configured my own environment as well, I thought why not help them. Helped around 3 threads when someone pinged me over the in-built web messenger and asked to clarify a doubt regarding my post.
Soon after, a second person pinged me to ask something about the IplImage class attributes and so on. Within the week, I helped 5 people (complete strangers) through the in-built web messenger.
With the widespread use of technology, I believe it has become much easier to tap on the expertise of more experienced users for help (the way I use the OpenCV groups too). It allows for collaboration all over the world and uses a community based approach to problem solving, instead of the traditional way of independent learning (having to search through books and white papers and not being able to share our knowledge after we have learnt something new).
However, we cannot always be sure that what the other person said is guaranteed to work for us. But I believe that is the nature of learning - curiosity and experimenting will help us find the answers we need and make us more knowledgeable.
What new things or approaches will technology yield next? And more importantly, how will technology affect the way we learn and our approach towards problem solving in the area of having the patience and discipline to slowly sieve through book after book (or link after link) of irrelevant results to find what we truly need?
Right now, I see some users (not majority) of forums and online community portraying impatient attitudes when questions go unanswered and self-centered approaches instead of community base / teamwork. Is this caused by the fast pace of technology which results in them expecting equally fast answers to their problems?
Food for thought. (pun intended)
Oh, one last thing, this week is Doc Green Theme.
The weather is quite good today.Today is spent mainly on cleaning up whackapeng with two shapes (continued from last thurs). Finally, managed to spot the error that I was facing - I had mistakenly used the * operator instead of the *= operator as well as the || instead of a && for the loop condition to initialize random points, thus making the program act strangely and go into a infinite loop occasionally.
Of course, solving this was not alone, it was together with the help of C2E and Kevin.
We finally ended our day at 7pm.
Tuesday, 15 January 2008
Stress testing of Lightdraw game to see if the changes made yesterday actually solved the problem. And they did. :)
The game did seem a bit slow - due to a single processing thread attempting to accept light input, calculate all the shape and enclosed detection, then followed by rendering it out on 4 different displays (for debugging purpose), which made the light trail very segmented each time it ran through the loop.
Thus I decided to carefully examine each line of the source code to see how I could actually reduce excessive and/or debugging code and thread some methods to better the overall game play.
23 pages of code, 2am.
Wednesday, 16 January 2008
Today was spent working on the threaded version of the Lightdraw Game (Whackapeng) two shapes. Managed to finally get the threaded version to work as well as renamed and deleted some methods and variables which were poorly named and declared but not used respectively.
However, some of the resulting problems are:
The program seems to run worse on a single core than the original Lightdraw Game on all four cores. Perhaps the original Lightdraw game will be much worse on a single core? I tried the threaded version on 2 cores and it seems to work better, if not, slightly slower than the original Lightdraw on all four cores. Maybe the conclusion is that the game will need around 2 cores to run at least?
There is a memory leak which I have to fix tomorrow.
There is a segmentation fault which appears sometimes, which does not appear some times, which I have to fix too.
Thursday, 17 January 2008
Fixing the two aforementioned problems in the threaded code. (Ironing them out).
Today, I will also try to use the Mii Editor to replace the game pieces for the Lightdraw game to the Lightdraw team Mii characters! Should be pretty fast and cool.
Fixed the time elapsed problem today as well. Which I think this is something interesting to think about. Initially, I had used the processor ticks to attempt to calculate the total time used for playing the game. In the beginning, it showed results like 112, 142, which did not raise my suspicions as the code was slow (single thread) and drawing did seem to take quite a long time. However, with the threaded version and the ability to draw smoothly now, it still showed values exceeding 100 and sometimes even up to 190 seconds ( more than 3 mins).
After reading more about it and pondering about
Anyway, with the help of Harold and Kevin, I changed from using the data type clock_t to time_t which solved the problem. Now, I was taking the system time to do the calculation, which solved the inconsistency.
Friday, 18 January 2008
Final clean up of Lightdraw game. Tidied up the code and removed all the rest of commented out codes which were used for debugging or what not. Also added some commands in the drawing of game piece method to turn of the encircled flags. Hopefully they solve the problem.
We demonstrated the rest of our programs and drawn up some plans for the next week, including optional projects, such as adding vertex detection to JL's code as well as doing the UML for a OO approach of Lightdraw.
Reflection of the Week:
As promised, this week's reflection will be about collaborative work using the internet.
During the previous week, I've been checking out the OpenCV yahoo groups' previous threads in search for some answers to my problems. While there, I noticed a few threads asking about how to use OpenCV library with Visual Studio / Windows Environment; and since I had already configured my own environment as well, I thought why not help them. Helped around 3 threads when someone pinged me over the in-built web messenger and asked to clarify a doubt regarding my post.
Soon after, a second person pinged me to ask something about the IplImage class attributes and so on. Within the week, I helped 5 people (complete strangers) through the in-built web messenger.
With the widespread use of technology, I believe it has become much easier to tap on the expertise of more experienced users for help (the way I use the OpenCV groups too). It allows for collaboration all over the world and uses a community based approach to problem solving, instead of the traditional way of independent learning (having to search through books and white papers and not being able to share our knowledge after we have learnt something new).
However, we cannot always be sure that what the other person said is guaranteed to work for us. But I believe that is the nature of learning - curiosity and experimenting will help us find the answers we need and make us more knowledgeable.
What new things or approaches will technology yield next? And more importantly, how will technology affect the way we learn and our approach towards problem solving in the area of having the patience and discipline to slowly sieve through book after book (or link after link) of irrelevant results to find what we truly need?
Right now, I see some users (not majority) of forums and online community portraying impatient attitudes when questions go unanswered and self-centered approaches instead of community base / teamwork. Is this caused by the fast pace of technology which results in them expecting equally fast answers to their problems?
Food for thought. (pun intended)
Oh, one last thing, this week is Doc Green Theme.
Tuesday, January 8, 2008
Week 12 (7 Jan - 11 Jan)
Monday, 7 January 2008
SAB presentation for Lightdraw is tomorrow. Lightdraw game with two shapes is really giving me problems today which bugs me quite a bit. It was working perfectly the week before. I guess I must have made one too many changes. Oh well. We used back the single shape game which we made a backup the previous week for the presentation.
There were many people needing to use the Mac today. Thus we were unable to develop much on it.
Practiced a few times with Kevin on the procedure of the demonstration and the clicking and drawing in Lightdraw.
Hopefully all goes well tomorrow.
Tuesday, 8 January 2008
SAB presentation went relatively well. The only minor hiccups were that after the Skype conversation with the researcher in India was turned off forcefully (via Apple + Q), the program did not release the camera resource that it was holding on to. We panicked a little before Kevin decided to show the video first. After the video, the SAB members were genuinely interested and did not mind while Kevin took a minute or two to restart the Mac Pro.
After restarting, the camera managed to work and we managed to continue with the presentation smoothly. :)
Wednesday, 9 January 2008
Since SAB presentation is still on, we need not be physically present at IHPC today. As such, I took the time to ponder about some of my other commitments and take a break from Lightdraw for a while.
Thursday, 10 January 2008
Returned to work and played around with the two shape whackapeng code which did not seem to work. Did not manage to find what was causing it as we only had 4 hours of time inside the COVE to work on Lightdraw today as other teams needed to use the room.
Friday, 11 January 2008
Had a meeting with Lightdraw team to discuss about the progress thus far and the next (few) step(s) which we should take before JL and I officially end our 16 weeks here in IHPC [attached at the end of today's portion]. Time really flies as we are already in our last 4 weeks here.
After which, I worked a bit on the SIP report regarding the company's nature of business section which I had difficulty doing without the help of Kevin. (Thanks!)
Lastly, spent some time cleaning up the source code folder in my account on the Light machine and finally decided to redo the two shape game from scratch as I made too many changes with the original code that I do not even know where the error originates from. Next week is the time to go full steam into the rest of the deliverables for the project.
Next steps - 2 shape game, enlarging HCI, trail on HCI + hover to activate, move and enlarge shape and pattern concept (detecting vertex on drawn shape)
Reflection of the Week:
Lightdraw will be most likely revamped and open sourced at IHPC's open source website. And interestingly enough, I saw the pillow with a different casing at the same location on Friday again.
Anyway, my reflection for this week regards making frequent backups before making any changes. While editing code for the Lightdraw game with 2 game pieces, I had accidentally changed one too many variables across the program and could not get the game to work properly. After another fruitless day on Thursday trying to understand the changes I had made hastily, I decided to reuse a backup I had on my thumb drive to see if I could revert any of the changes. Unfortunately, the back up I had was dated way back to before we even had 2 shapes for the game pieces.
Lesson learnt: If a code works, have frequent backups of it before any changes are made to improve on it.
SAB presentation for Lightdraw is tomorrow. Lightdraw game with two shapes is really giving me problems today which bugs me quite a bit. It was working perfectly the week before. I guess I must have made one too many changes. Oh well. We used back the single shape game which we made a backup the previous week for the presentation.
There were many people needing to use the Mac today. Thus we were unable to develop much on it.
Practiced a few times with Kevin on the procedure of the demonstration and the clicking and drawing in Lightdraw.
Hopefully all goes well tomorrow.
Tuesday, 8 January 2008
SAB presentation went relatively well. The only minor hiccups were that after the Skype conversation with the researcher in India was turned off forcefully (via Apple + Q), the program did not release the camera resource that it was holding on to. We panicked a little before Kevin decided to show the video first. After the video, the SAB members were genuinely interested and did not mind while Kevin took a minute or two to restart the Mac Pro.
After restarting, the camera managed to work and we managed to continue with the presentation smoothly. :)
Wednesday, 9 January 2008
Since SAB presentation is still on, we need not be physically present at IHPC today. As such, I took the time to ponder about some of my other commitments and take a break from Lightdraw for a while.
Thursday, 10 January 2008
Returned to work and played around with the two shape whackapeng code which did not seem to work. Did not manage to find what was causing it as we only had 4 hours of time inside the COVE to work on Lightdraw today as other teams needed to use the room.
Friday, 11 January 2008
Had a meeting with Lightdraw team to discuss about the progress thus far and the next (few) step(s) which we should take before JL and I officially end our 16 weeks here in IHPC [attached at the end of today's portion]. Time really flies as we are already in our last 4 weeks here.
After which, I worked a bit on the SIP report regarding the company's nature of business section which I had difficulty doing without the help of Kevin. (Thanks!)
Lastly, spent some time cleaning up the source code folder in my account on the Light machine and finally decided to redo the two shape game from scratch as I made too many changes with the original code that I do not even know where the error originates from. Next week is the time to go full steam into the rest of the deliverables for the project.
Next steps - 2 shape game, enlarging HCI, trail on HCI + hover to activate, move and enlarge shape and pattern concept (detecting vertex on drawn shape)
Reflection of the Week:
Lightdraw will be most likely revamped and open sourced at IHPC's open source website. And interestingly enough, I saw the pillow with a different casing at the same location on Friday again.
Anyway, my reflection for this week regards making frequent backups before making any changes. While editing code for the Lightdraw game with 2 game pieces, I had accidentally changed one too many variables across the program and could not get the game to work properly. After another fruitless day on Thursday trying to understand the changes I had made hastily, I decided to reuse a backup I had on my thumb drive to see if I could revert any of the changes. Unfortunately, the back up I had was dated way back to before we even had 2 shapes for the game pieces.
Lesson learnt: If a code works, have frequent backups of it before any changes are made to improve on it.
Thursday, January 3, 2008
Week 11 (31 Dec - 4 Jan)
Monday, 31 December 2007
The last day of 2007. And a Monday. Putting such negative thoughts aside, I went to work and improved the per shape timer. The problem with the timer (as mentioned on last Thurday, but recapped here for convenience) was that the timer slept for 20 counts before waking up and clearing the screen. However, if the user had already moved on to the next shape and the thread awoke, it will not know that the user had already successfully encircled a shape and carry on to loyally clear the screen.
Well, that has been solved by ensuring that the thread slept for a much reduced time of 2 seconds and when it awoke, it checked if the number of times it has slept already is more than 20 seconds and if the user had moved to the next shape. If the former is true, it will then dutifully clear the screen, as it has been proven that the user is still on the same shape and the count down for the screen to be cleared has been achieved. If the latter is true, it will restart the sleep counter and carry on sleeping again. This way, the timer will become more responsive and be able to adapt to the change in shapes and be more flexible when coding for other situations, such as pressing the 'c' button to manually clear the screen.
Since today is only till 1245hrs, didn't manage to do much as I had somewhere else to go as well.
Tuesday, 1 January 2008
Today is New Year Day! My goal for 2008? Same as 2007. Does it mean that 2007 has passed with all my efforts in vain?
Actually, I cannot seem to recall my 2007 goal. hmmz.
Wednesday, 2 January 2008
Welcome to Situ Yi! Who is JL's long lost cousin. Or so we assume. Anyway, welcome to the team! The first task that we got to do as a Lightdraw team was to... take down the X'mas tree by the receptionist counter and clear the air conditioner of its overflowing water in its reserve. haha. Great way to bond together :)
Today we also welcome back Kevin, to Singapore, after his deserved break in Mauritius. hee. And our really cool supervisor bought us souvenirs too! Kudos to him!
Anyway, when things got serious, we got down to work. shared with the team on the progress of the Lightdraw game as well as took some constructive feedback on improvement to the game play code as well. Had also implemented an overall timer of game which keeps track of how long the user/player takes to complete each level.
Next stop, putting two shapes on the screen at one time and recording & saving the score via File I/O. Hopefully SAB presentation goes well for all too!
Thursday, 3 January 2008
Early morning went down to TP's newly opened visualization lab in ENG school. Saw the displays there - they are really cool and impressive, especially the human skeleton one and the infra-red one. Though many of the technologies there rely on total internal reflection from the glass panel.
But it did take visualization to a whole new level, redefining the way we interact with our computers and how it presents information to us. After seeing some of the displays, I suddenly had this urge to change my entire desktop to use wireless input devices to reduce the wire cluttering at the back. Hmmz..
Back at IHPC, worked on displaying two shapes for the Lightdraw game, instead of just one. Thanks to JL who walked me through the code and some quick adjustments and clarifications from Kevin, managed to complete the code with two shapes appearing on the screen now. Tomorrow its time to refine the code I guess.
Friday, 4 January 2008
Thus week 11 has come to an end. Just merely 4 more weeks and my attachment will be over. Start the day with refining code for the two shape appearing on the screen game. Yesterday had completed the code pretty late in the evening and did not really do much correct/efficient programming. Thus today is the day to think about ways on how to improve the source code.
Walked through the code logic again and re-pondered over the approach of the displaying. Removed lots of printf() statements, as well as some variables which were lying all over the place but not actually used at all. Intending to remove the additional windows displaying the different modes of the input frame (such as canny and original versions) but did not have the time as in the afternoon, many people had to use the Light system for their SAB presentation, which resulted in us not being able to VNC in for performance reasons.
Looks like Monday is the day to do the final clean up of the code.
Reflection of the Week:
This week's reflection is about opportunity. [Once again, its not related to work, but something related to SIP in general]
According to dictionary.com:
So what does this mean? In life, there are many windows of opportunities which pass us by. Whether we want to take up this opportunity is one thing. Whether we want to see this opportunity through to greater heights is another. After all, the decision boils down to us, yes? At that moment, to instigate the decision making mechanism within our head to decide if it is a yes or a no for a particular fork in our lives. However, this simple decision mechanism can be easily influenced by many factors, both tangible, such as cash returns, and intangible, such as negative experiences. Now that is the beauty of evolution - our experiences change us, our decisions mould us. After all, if always following the same path of decision making and choosing the same option when faced with the same situation, what is the difference between us and the machine which you read my blog on?
Intelligence. We grow and evolve over time. Artifical Intelligence. How we attempt to make the computer as smart as, if not smarter, than us. But that is a whole new ball game which many people have written countless of books on.
Seeing the OSIP team (India) come back to Singapore made me wonder about the opportunities I am faced with and the corresponding decisions I have made. Every time a particular decision is made, we gain some, we lose some. For example, choosing not to go to India for OSIP means I have lost the opportunity to do some work attachment abroad and gain some valuable experience, as well as the luxury to end my work attachment this week and experience a different country's culture. However staying locally for my SIP allowed me to work with such wonderful people at IHPC and learn many interesting things such as OpenCV and C Programming. Not forgetting many work related skills from our colleagues and our really cool supervisor, who is very friendly and understanding.
How do we gauge which is better than the other? Even now, being close to the end of my work attachment, as well as seeing the India team return to Singapore, I am still unable to decide which yields better returns. Even more so during the initial fork at choosing between local or overseas internship.
The analogy is similar to a game I played often in the past. Choosing one mission over the other - where one mission rescues a family member caught in a war, and another to gain better tactical advantage in the final battle against the enemy. Of course, being a game, there's always that "load previous..." option or the luxury to try again when one option has failed. Unfortunately in reality, there is no try again option - and opportunities that have once been presented may not be presented again.
Of course, there's always the "if there are no opportunities, make your own" quote that some readers would be thinking now. True to a certain extent - we can recreate the opportunity - or rather, we can create a similar opportunity, but we can never have the same experience as compared to the first. To bring it back to the context of the India SIP team, it is possible to re-create the opportunity to go to India to do some work, be it attachment or normal work in the industry, but I will definitely not be able to work with the same people who just came back, or to perhaps work on the same project, stay in the same housing, etc. Same if we did it the other way around - I might not have been able to work on a really great project like Lightdraw, meet great people, etc.
Conclusion? I can't really tell you how my decision making mechanism in my mind works, probably based on all my experience and possible favorable outcome. But once I have made up my mind, I stick to it and do not regret my decision. Being optimistic and open to new experiences is the best way to learn new things and be positive, right?
The last day of 2007. And a Monday. Putting such negative thoughts aside, I went to work and improved the per shape timer. The problem with the timer (as mentioned on last Thurday, but recapped here for convenience) was that the timer slept for 20 counts before waking up and clearing the screen. However, if the user had already moved on to the next shape and the thread awoke, it will not know that the user had already successfully encircled a shape and carry on to loyally clear the screen.
Well, that has been solved by ensuring that the thread slept for a much reduced time of 2 seconds and when it awoke, it checked if the number of times it has slept already is more than 20 seconds and if the user had moved to the next shape. If the former is true, it will then dutifully clear the screen, as it has been proven that the user is still on the same shape and the count down for the screen to be cleared has been achieved. If the latter is true, it will restart the sleep counter and carry on sleeping again. This way, the timer will become more responsive and be able to adapt to the change in shapes and be more flexible when coding for other situations, such as pressing the 'c' button to manually clear the screen.
Since today is only till 1245hrs, didn't manage to do much as I had somewhere else to go as well.
Tuesday, 1 January 2008
Today is New Year Day! My goal for 2008? Same as 2007. Does it mean that 2007 has passed with all my efforts in vain?
Actually, I cannot seem to recall my 2007 goal. hmmz.
Wednesday, 2 January 2008
Welcome to Situ Yi! Who is JL's long lost cousin. Or so we assume. Anyway, welcome to the team! The first task that we got to do as a Lightdraw team was to... take down the X'mas tree by the receptionist counter and clear the air conditioner of its overflowing water in its reserve. haha. Great way to bond together :)
Today we also welcome back Kevin, to Singapore, after his deserved break in Mauritius. hee. And our really cool supervisor bought us souvenirs too! Kudos to him!
Anyway, when things got serious, we got down to work. shared with the team on the progress of the Lightdraw game as well as took some constructive feedback on improvement to the game play code as well. Had also implemented an overall timer of game which keeps track of how long the user/player takes to complete each level.
Next stop, putting two shapes on the screen at one time and recording & saving the score via File I/O. Hopefully SAB presentation goes well for all too!
Thursday, 3 January 2008
Early morning went down to TP's newly opened visualization lab in ENG school. Saw the displays there - they are really cool and impressive, especially the human skeleton one and the infra-red one. Though many of the technologies there rely on total internal reflection from the glass panel.
But it did take visualization to a whole new level, redefining the way we interact with our computers and how it presents information to us. After seeing some of the displays, I suddenly had this urge to change my entire desktop to use wireless input devices to reduce the wire cluttering at the back. Hmmz..
Back at IHPC, worked on displaying two shapes for the Lightdraw game, instead of just one. Thanks to JL who walked me through the code and some quick adjustments and clarifications from Kevin, managed to complete the code with two shapes appearing on the screen now. Tomorrow its time to refine the code I guess.
Friday, 4 January 2008
Thus week 11 has come to an end. Just merely 4 more weeks and my attachment will be over. Start the day with refining code for the two shape appearing on the screen game. Yesterday had completed the code pretty late in the evening and did not really do much correct/efficient programming. Thus today is the day to think about ways on how to improve the source code.
Walked through the code logic again and re-pondered over the approach of the displaying. Removed lots of printf() statements, as well as some variables which were lying all over the place but not actually used at all. Intending to remove the additional windows displaying the different modes of the input frame (such as canny and original versions) but did not have the time as in the afternoon, many people had to use the Light system for their SAB presentation, which resulted in us not being able to VNC in for performance reasons.
Looks like Monday is the day to do the final clean up of the code.
Reflection of the Week:
This week's reflection is about opportunity. [Once again, its not related to work, but something related to SIP in general]
According to dictionary.com:
op·por·tu·ni·ty [op-er-too-ni-tee, -tyoo-]
–noun, plural -ties.
a good position, chance, or prospect, as for advancement or success.
So what does this mean? In life, there are many windows of opportunities which pass us by. Whether we want to take up this opportunity is one thing. Whether we want to see this opportunity through to greater heights is another. After all, the decision boils down to us, yes? At that moment, to instigate the decision making mechanism within our head to decide if it is a yes or a no for a particular fork in our lives. However, this simple decision mechanism can be easily influenced by many factors, both tangible, such as cash returns, and intangible, such as negative experiences. Now that is the beauty of evolution - our experiences change us, our decisions mould us. After all, if always following the same path of decision making and choosing the same option when faced with the same situation, what is the difference between us and the machine which you read my blog on?
Intelligence. We grow and evolve over time. Artifical Intelligence. How we attempt to make the computer as smart as, if not smarter, than us. But that is a whole new ball game which many people have written countless of books on.
Seeing the OSIP team (India) come back to Singapore made me wonder about the opportunities I am faced with and the corresponding decisions I have made. Every time a particular decision is made, we gain some, we lose some. For example, choosing not to go to India for OSIP means I have lost the opportunity to do some work attachment abroad and gain some valuable experience, as well as the luxury to end my work attachment this week and experience a different country's culture. However staying locally for my SIP allowed me to work with such wonderful people at IHPC and learn many interesting things such as OpenCV and C Programming. Not forgetting many work related skills from our colleagues and our really cool supervisor, who is very friendly and understanding.
How do we gauge which is better than the other? Even now, being close to the end of my work attachment, as well as seeing the India team return to Singapore, I am still unable to decide which yields better returns. Even more so during the initial fork at choosing between local or overseas internship.
The analogy is similar to a game I played often in the past. Choosing one mission over the other - where one mission rescues a family member caught in a war, and another to gain better tactical advantage in the final battle against the enemy. Of course, being a game, there's always that "load previous..." option or the luxury to try again when one option has failed. Unfortunately in reality, there is no try again option - and opportunities that have once been presented may not be presented again.
Of course, there's always the "if there are no opportunities, make your own" quote that some readers would be thinking now. True to a certain extent - we can recreate the opportunity - or rather, we can create a similar opportunity, but we can never have the same experience as compared to the first. To bring it back to the context of the India SIP team, it is possible to re-create the opportunity to go to India to do some work, be it attachment or normal work in the industry, but I will definitely not be able to work with the same people who just came back, or to perhaps work on the same project, stay in the same housing, etc. Same if we did it the other way around - I might not have been able to work on a really great project like Lightdraw, meet great people, etc.
Conclusion? I can't really tell you how my decision making mechanism in my mind works, probably based on all my experience and possible favorable outcome. But once I have made up my mind, I stick to it and do not regret my decision. Being optimistic and open to new experiences is the best way to learn new things and be positive, right?
Saturday, December 29, 2007
Week 10 (24 Dec - 28 Dec)
Monday, 24 December 2007
Today, is Monday, 24th of December 2007. X'mas eve. Which means that everyone gets to leave work early at 12.45pm. Today, we left work early, but it was at around 4pm, earlier than normal days I guess.
Today I still continued to research and refine my code on detecting a single point within any given shape, represented as an array of points. And finally, it reached a workable and acceptable state. I initially wanted to improve more on the code, but I guess with the datelines for SAB nearing, we'd better combine the code first. Better one working program with some bugs than two perfect files with no working output, JL reminded me.
And thus, we took code 1 and code 2 and mashed them up, and my luck, we got a working program. Well, not really by luck, but by a lot of re-editing the method signatures and copy and pasting code from one to another. Alas, a working game code, just with a couple of issues to iron out, such as the scoreboard, threading time, debugging outputs being printed at the background, etc.
Tuesday, 25 December 2007
Today is Christmas. Did I get many presents from Santa? Well, I've got all my friends around me. That should be enough for me, right? :)
Wednesday, 26 December 2007
Well, what else could we have done today, save for improving the game code? (its called whackapeng.c, btw).
Well, there are 2 major changes which we made today, and shall highlight them here:
Firstly, we ironed out some bugs in the game play, to name a few, were the encircling counter and circle sensitivity. It was hilarious when we started to test the program, and after attempting to draw 10 shapes (for level 1) to see if the code works fine under a happy flow, we realized that we had forgotten to add code to keep track of how many shapes have been encircled. Interesting.
The second problem we faced as that by drawing a small enough square/rectangle, by just basically completing 2 out of 4 sides, and a little start on the third side, the program will immediately assume its a circle (due to its small difference in diameter of the 3 random pair points) and draw a circle, which, if enclosing the center of the shape, will be considered as a successful shape encircling. Thus, I had to reduce the sensitivity of the circle detection, dropping the difference in diameter from 12 to 10. This change did not eliminate the problem, but only reduced the chance of it from happening, and the player had to draw a really shape to get it. Alternatively, was to totally trash circle detection for the game play, since the code for n-gon point detection will work fine for circles as well too, I believe.
Decisions, decisions.
We also added a high score board after the successful encircling of the shapes, though its just a dummy board as we have yet to think of a way to perform I/O effectively for the scores and the possible logo. hmmz.
Thursday, 27 December 2007
Well, with the main functionality of the game working, its time to improve it, pondering about the overall threading issue + file I/O.
One of the problems faced for the threading is that after every 20 seconds, the program will clear the screen of all drawings, just in case the user has drawn too much on the screen to effectively continue the game. Though when the thread that is in-charge of this goes to sleep for 20 seconds, it loses track of the game play. So even if the game had already moved to the next shape, or has been manually cleared (if ever it occurs during actual deployment), it would be impossible to alert the thread to stop and restart the count down timer, so that the clearing of the screen will effectively take place 20 seconds after the new drawing has been rendered on the screen. Or is there? hmmz. (I wonder if there is something akin to Java's wait() and notify() methods?)
File I/O is just thinking of how to solve the storing and retrieving of high scores for each level and the possible corresponding player logos for each of the high scores.
Been thinking...
Friday, 28 December 2007
I'm still working on some improvements of the game (e.g. overall threading issue + file I/O). Still not quite there yet. Took the last 3 hours of work or so to practice and revise for my SCJP exam, which is tomorrow. Hopefully I will do well :)
In addition to today, JL did a very cool code of using the light to drag primitive shapes around the screen. I can already see the HCI forming. :)
Reflection of the Week:
What did I learn for this week? Well, basically, its performance and the effect of inefficient code.
Lets start with performance, which I would be referring to code performance, as our entry point. Many times, our deployment environment or developing environment is quite powerful due to the use of modern technologies or high powered hardware. Which indirectly leads to more inefficient code being written. Why do I say that? When coding a function to solve a problem, there is little regard to the amount of memory that will be used by the function or the entire software. The code will run with little or neglectable performance degrading.
Thus even if the function is very inefficient, it won't really matter cause during development phase or (even deployment phase), only one application is tested at a single time, with a possibility of core 2 dual processor at 1.8GHz running in the back ground and 2GB of RAM. With regard to my experience in our school projects (again, this leads to school. But hey, isn't this supposed to be a reflection of my school experience vs the experience I am having now?), we develop applications that take little consideration of efficiency. Sure, we know what is the definition of efficiency, but do we really know the finer details of how to go about doing it in our code?
There was once I wrote a 1800 line class file for a very simple application - well, it probably beat the length of many people's code, but I bet it also beat them in being the most inefficient code. It had so many repetitions and nested loops, but when tested on my computer (Pentium 4), it was totally not a problem. Now imagine we put that code up on a not so powerful server in Singapore, and this application becomes really popular, with up to 3,000 concurrent users worldwide online calling it concurrently. Now we're really going to see the strain on the server. But if back then I've written really efficient code, perhaps of a couple of hundred lines, the strain would be much lesser.
So how does this relate back? Many times, the ideas that come to my mind to solve the problems I face within the code are not really the best way to go about doing it. Cramming all the code within a nested for-loop in a single thread and calling it to execute its loops repeatedly would probably cause strain on the program, which can be seen by the time it takes between when the light is captured by the camera, to the time it is rendered on the screen. The longer the time needed for the program to process the code, the larger the gaps become.
So conclusion? Thinking before coding :)
Today, is Monday, 24th of December 2007. X'mas eve. Which means that everyone gets to leave work early at 12.45pm. Today, we left work early, but it was at around 4pm, earlier than normal days I guess.
Today I still continued to research and refine my code on detecting a single point within any given shape, represented as an array of points. And finally, it reached a workable and acceptable state. I initially wanted to improve more on the code, but I guess with the datelines for SAB nearing, we'd better combine the code first. Better one working program with some bugs than two perfect files with no working output, JL reminded me.
And thus, we took code 1 and code 2 and mashed them up, and my luck, we got a working program. Well, not really by luck, but by a lot of re-editing the method signatures and copy and pasting code from one to another. Alas, a working game code, just with a couple of issues to iron out, such as the scoreboard, threading time, debugging outputs being printed at the background, etc.
Tuesday, 25 December 2007
Today is Christmas. Did I get many presents from Santa? Well, I've got all my friends around me. That should be enough for me, right? :)
Wednesday, 26 December 2007
Well, what else could we have done today, save for improving the game code? (its called whackapeng.c, btw).
Well, there are 2 major changes which we made today, and shall highlight them here:
Firstly, we ironed out some bugs in the game play, to name a few, were the encircling counter and circle sensitivity. It was hilarious when we started to test the program, and after attempting to draw 10 shapes (for level 1) to see if the code works fine under a happy flow, we realized that we had forgotten to add code to keep track of how many shapes have been encircled. Interesting.
The second problem we faced as that by drawing a small enough square/rectangle, by just basically completing 2 out of 4 sides, and a little start on the third side, the program will immediately assume its a circle (due to its small difference in diameter of the 3 random pair points) and draw a circle, which, if enclosing the center of the shape, will be considered as a successful shape encircling. Thus, I had to reduce the sensitivity of the circle detection, dropping the difference in diameter from 12 to 10. This change did not eliminate the problem, but only reduced the chance of it from happening, and the player had to draw a really shape to get it. Alternatively, was to totally trash circle detection for the game play, since the code for n-gon point detection will work fine for circles as well too, I believe.
Decisions, decisions.
We also added a high score board after the successful encircling of the shapes, though its just a dummy board as we have yet to think of a way to perform I/O effectively for the scores and the possible logo. hmmz.
Thursday, 27 December 2007
Well, with the main functionality of the game working, its time to improve it, pondering about the overall threading issue + file I/O.
One of the problems faced for the threading is that after every 20 seconds, the program will clear the screen of all drawings, just in case the user has drawn too much on the screen to effectively continue the game. Though when the thread that is in-charge of this goes to sleep for 20 seconds, it loses track of the game play. So even if the game had already moved to the next shape, or has been manually cleared (if ever it occurs during actual deployment), it would be impossible to alert the thread to stop and restart the count down timer, so that the clearing of the screen will effectively take place 20 seconds after the new drawing has been rendered on the screen. Or is there? hmmz. (I wonder if there is something akin to Java's wait() and notify() methods?)
File I/O is just thinking of how to solve the storing and retrieving of high scores for each level and the possible corresponding player logos for each of the high scores.
Been thinking...
Friday, 28 December 2007
I'm still working on some improvements of the game (e.g. overall threading issue + file I/O). Still not quite there yet. Took the last 3 hours of work or so to practice and revise for my SCJP exam, which is tomorrow. Hopefully I will do well :)
In addition to today, JL did a very cool code of using the light to drag primitive shapes around the screen. I can already see the HCI forming. :)
Reflection of the Week:
What did I learn for this week? Well, basically, its performance and the effect of inefficient code.
Lets start with performance, which I would be referring to code performance, as our entry point. Many times, our deployment environment or developing environment is quite powerful due to the use of modern technologies or high powered hardware. Which indirectly leads to more inefficient code being written. Why do I say that? When coding a function to solve a problem, there is little regard to the amount of memory that will be used by the function or the entire software. The code will run with little or neglectable performance degrading.
Thus even if the function is very inefficient, it won't really matter cause during development phase or (even deployment phase), only one application is tested at a single time, with a possibility of core 2 dual processor at 1.8GHz running in the back ground and 2GB of RAM. With regard to my experience in our school projects (again, this leads to school. But hey, isn't this supposed to be a reflection of my school experience vs the experience I am having now?), we develop applications that take little consideration of efficiency. Sure, we know what is the definition of efficiency, but do we really know the finer details of how to go about doing it in our code?
There was once I wrote a 1800 line class file for a very simple application - well, it probably beat the length of many people's code, but I bet it also beat them in being the most inefficient code. It had so many repetitions and nested loops, but when tested on my computer (Pentium 4), it was totally not a problem. Now imagine we put that code up on a not so powerful server in Singapore, and this application becomes really popular, with up to 3,000 concurrent users worldwide online calling it concurrently. Now we're really going to see the strain on the server. But if back then I've written really efficient code, perhaps of a couple of hundred lines, the strain would be much lesser.
So how does this relate back? Many times, the ideas that come to my mind to solve the problems I face within the code are not really the best way to go about doing it. Cramming all the code within a nested for-loop in a single thread and calling it to execute its loops repeatedly would probably cause strain on the program, which can be seen by the time it takes between when the light is captured by the camera, to the time it is rendered on the screen. The longer the time needed for the program to process the code, the larger the gaps become.
So conclusion? Thinking before coding :)
Thursday, December 20, 2007
Week 9 (17 Dec - 21 Dec)
Monday, 10 December 2007
Week 9 has come (and gone, for when I'm typing this entry, its Friday). The presentation during the mid-semester briefing/meeting is today.
Anyway, it went well actually. With some people laughing at us at the beginning before we started for some strange reason which we both cannot comprehend. But they liked the video a lot - which is attributed to CT's fantastic skills in creating the video and JL's interesting music.
Anyway, maybe we're making another one..?
Tuesday, 11 December 2007
ReachOut - Beyond Social Services is today. We went over to NTU Alumni Clubhouse in the morning and prepared for the games. For my "Amazing Scientific Race" station, I was with Harold and we shifted indoors due to the threat of rain. We talked about gravity and air resistance in the form of a fun game, which consisted them of throwing paper airplanes to reach the furthest distance (further = more points). And they got points which they could claim for prizes. Although the kids were very energetic which was a good sign, though I'm not sure if the handling of them was very effective, with all the overlooking for certain things which they should not be doing.
Anyway, after the race, had a buffet lunch at 8 Degrees Restaurant (so familiar) and when back to IHPC for a movie screening of Ratatouille, in conjunction with the staff movie screening for December. Well, since I've not watched that movie, might as well sit in and enjoy myself. :)
At the end of the day, though we were all tired from all the activities, we sat in for an AC Xmas retreat and enjoyed a bit before heading home.

Wednesday, 12 December 2007
Back to work. We started the day with manually calibrating the 4 projectors and learnt a bit about projector keystones, the effect is has when projecting while tilting up or down, as well as how the 4 tiled projectors were set up.
It took a lot of fine-tuning and adjusting before we managed to get the projectors more or less aligned. So now we have 4 screens where we can drag our windows on - which gets confusing sometimes, because I'm so used to drawing on a reversed canvas for the shape detection that when I draw on the normal canvas, I keep moving in the wrong way.
Oh well, gotta get used to it. Anyway, Kevin briefed us that we have the SAB presentation on the 8th of January 2008. We reviewed our milestones and projected end products and decided to give the game a while more before we move on to developing the HCI. However, this would mean that we will leave the game at a certain state where it is stable enough before moving on and coming back to it later to refine it. Oh well, few more days of the game code, gotta work harder!
Now focusing on point within a polygon detection. With the previous code for circle detection, it is possible to find the center of the circle to match the center of the object drawn. However, with a polygon, it is virtually impossible to find the center of it as there is no knowning before the detection, the number of corners the polygon will have. But some people will ask, why so? If the user draws (approximately) 4 right angles, it should relate to a rectangle/square, right? Or a shape with 3 corners would result in a triangle, won't it?
Not so! As the user's hand is not necessarily stable and the camera may not exactly capture light in a straight line. Result? A square with 4 right angles but more than 4 points, or a triangle with 4 points. - totally unpredictable.
So, without being able to find the fixed center of a n-gon without invoking very complicated and resource intensive mathematics, how can we find the center of a polygon, if possible, or to find out if a point is within the polygon, given a series of points/coordinates?
The Solution - I'm working on it!
Thursday, 13 December 2007
Today is a holiday. I spent the better half of the day studying for SCJP.
Friday, 14 December 2007
Okay. I'm lagging behind in my postings. Let me recall / summarize the things I've done for today.
Doing more research on Wednesday's problem. Searching and researching. Well, there are numerous interesting links, including a Fortan code written by someone a long time ago. Things like Mathlab and other related programs/framworks do repeatedly resurface in the search results, though it is highly likely using another program altogether would fix the problem.
Determination finally paid off, and towards the end of the day, I've finally found a suitable method. Well, it is not surprising that the C code solution is written by the same person who had written that Fortan code a long time ago. Well, looks like he's very kind to redo it in C, since majority of people use C/C++ out there.
Well, let me do a summary of the algorithm here. But for more detailed information and the code implementation, please feel free to visit the website above. So, without further ado, the algorithm, which is called "The Crossing Number", goes something like this:
Accepting an argument for the single point (P) to be checked if it is inside the polygon, and an array (and where array[n] == array[0]) of all the points, it will draw a line from P, towards the edge of the canvas, towards the direction where x = infinity while keeping y constant (i.e. towards the right, parallel to the x-axis on a x/y graph). It then traverses the array and for every two points (i.e. Polygon Boundary Edge) , it determines if the line will cut across it. It then counts the total number of times the line passes over the entire polygon boundary. If the total number is even, then the point is outside of the polygon, else it is inside.
Pretty ingenious right? Using the knowledge of this new found methodology, I proceeded to manipulate it for my own selfish means and finally overcome the problem of detecting a point inside/outside an n-gon, which was resurfacing in my mind frequently for quite a while now.
Another thing I've learnt (although it is quite a while back) is that the coordinates (0,0) of the image is actually the top right corner, not the initial top left corner I have always assumed. Probably because during the circle detection, I was using an unflipped version of the canvas, causing everything to have a mirrored effect.
Okay, that's all for today. Hope you enjoyed reading.
Reflection of the Week:
I'm not sure if I have mentioned it previously, but I joined a Yahoo! Group regarding OpenCV as well as thronged through many forums and websites to search for tried and tested (and even untried and untested) methods to solve my problems. One thing I've noticed in all my surfings, including surfings from the past 3 to 5 years (5 being my first arrival to the Wired), is the lack of initiative that exist in there. Well, let me say that I am not stereotyping by saying that everyone inside a forum or user group has no initiative, but rather, a small number of people (and their outstanding incidents) have got me wondering if these people joined the group just to ask/demand/expect for answers. Although the way they ask their question may be slightly rude and demanding, the other great members inside the forums tap on their pool of patience and knowledge to try to answer them thoroughly and patiently.
What are the incidents, one might ask? Well, it usually goes along the lines of:
"I am developing [project details] and have an error. Can someone help me out? [insert entire source code here, consisting of a/several complex class(es)]" or "Can someone tell me the answer to [insert a question that has already been answered by other earlier threads, or can be easily found by searching Google]"
Well, it is true that forums and user groups are a source of information - to find solutions to problems, but should we be abusing it by pasting our entire source code (or worse, only a portion of the source code with no explanation and expect others to know the rest) there and expecting people to scan through the entire codes to understand the logic and find out what is wrong? Or demanding a quick answer to their problems which can easily be solved if they attempted to try (such as by looking at the API available online)?
IMHO, if there were at least attempts to try to understand their problem and only ask questions towards a narrower scope, it would have been much more easier and quicker for people to respond. Anyway, who would be inclined to find problems in codes amount up to 1000 lines with no incentive in return?
Perhaps, a better way to put it would be:
"I am developing [project details] and have encountered a problem which I cannot seem to comprehend. I've checked the server logs and it mentions that I have an buffer overflow thrown on line 35 (highlighted in red). I did a search on the method being called and did not notice anything wrong with the return type, neither does it throw any checked exceptions which I am supposed to handle. Could it be that the variable passed in as the argument during the for-loop is null or of wrong type? I know it might be tedious, but can someone kindly help me out, please? [insert source code of the method which the error occurs in and any related methods.]"
And of course, a little thank you after the answer has been posted and an update of the problem solving is appreciated, to show that their hard work and time is not wasted after all. Well, perhaps after going into that level of detail to state their problem within a narrower scope, they themselves would have been able to notice the error and solve the bug in their code before they even hit the "post thread" button. Thankfully, only a small handful of people behave like the former; the rest behave in a much more matured and well-mannered fashion.
Negative online etiquette aside, I found many people at these forums or groups helpful and passionate to share their knowledge. Perhaps they are the ones, whose posts we should also value more, who make the forums a good place to hang out and learn. :)
Ciao for Week 9!
Week 9 has come (and gone, for when I'm typing this entry, its Friday). The presentation during the mid-semester briefing/meeting is today.
Anyway, it went well actually. With some people laughing at us at the beginning before we started for some strange reason which we both cannot comprehend. But they liked the video a lot - which is attributed to CT's fantastic skills in creating the video and JL's interesting music.
Anyway, maybe we're making another one..?
Tuesday, 11 December 2007
ReachOut - Beyond Social Services is today. We went over to NTU Alumni Clubhouse in the morning and prepared for the games. For my "Amazing Scientific Race" station, I was with Harold and we shifted indoors due to the threat of rain. We talked about gravity and air resistance in the form of a fun game, which consisted them of throwing paper airplanes to reach the furthest distance (further = more points). And they got points which they could claim for prizes. Although the kids were very energetic which was a good sign, though I'm not sure if the handling of them was very effective, with all the overlooking for certain things which they should not be doing.
Anyway, after the race, had a buffet lunch at 8 Degrees Restaurant (so familiar) and when back to IHPC for a movie screening of Ratatouille, in conjunction with the staff movie screening for December. Well, since I've not watched that movie, might as well sit in and enjoy myself. :)
At the end of the day, though we were all tired from all the activities, we sat in for an AC Xmas retreat and enjoyed a bit before heading home.
Wednesday, 12 December 2007
Back to work. We started the day with manually calibrating the 4 projectors and learnt a bit about projector keystones, the effect is has when projecting while tilting up or down, as well as how the 4 tiled projectors were set up.
It took a lot of fine-tuning and adjusting before we managed to get the projectors more or less aligned. So now we have 4 screens where we can drag our windows on - which gets confusing sometimes, because I'm so used to drawing on a reversed canvas for the shape detection that when I draw on the normal canvas, I keep moving in the wrong way.
Oh well, gotta get used to it. Anyway, Kevin briefed us that we have the SAB presentation on the 8th of January 2008. We reviewed our milestones and projected end products and decided to give the game a while more before we move on to developing the HCI. However, this would mean that we will leave the game at a certain state where it is stable enough before moving on and coming back to it later to refine it. Oh well, few more days of the game code, gotta work harder!
Now focusing on point within a polygon detection. With the previous code for circle detection, it is possible to find the center of the circle to match the center of the object drawn. However, with a polygon, it is virtually impossible to find the center of it as there is no knowning before the detection, the number of corners the polygon will have. But some people will ask, why so? If the user draws (approximately) 4 right angles, it should relate to a rectangle/square, right? Or a shape with 3 corners would result in a triangle, won't it?
Not so! As the user's hand is not necessarily stable and the camera may not exactly capture light in a straight line. Result? A square with 4 right angles but more than 4 points, or a triangle with 4 points. - totally unpredictable.
So, without being able to find the fixed center of a n-gon without invoking very complicated and resource intensive mathematics, how can we find the center of a polygon, if possible, or to find out if a point is within the polygon, given a series of points/coordinates?
The Solution - I'm working on it!
Thursday, 13 December 2007
Today is a holiday. I spent the better half of the day studying for SCJP.
Friday, 14 December 2007
Okay. I'm lagging behind in my postings. Let me recall / summarize the things I've done for today.
Doing more research on Wednesday's problem. Searching and researching. Well, there are numerous interesting links, including a Fortan code written by someone a long time ago. Things like Mathlab and other related programs/framworks do repeatedly resurface in the search results, though it is highly likely using another program altogether would fix the problem.
Determination finally paid off, and towards the end of the day, I've finally found a suitable method. Well, it is not surprising that the C code solution is written by the same person who had written that Fortan code a long time ago. Well, looks like he's very kind to redo it in C, since majority of people use C/C++ out there.
http://softsurfer.com/Archive/algorithm_0103/algorithm_0103.htm
Well, let me do a summary of the algorithm here. But for more detailed information and the code implementation, please feel free to visit the website above. So, without further ado, the algorithm, which is called "The Crossing Number", goes something like this:
Accepting an argument for the single point (P) to be checked if it is inside the polygon, and an array (and where array[n] == array[0]) of all the points, it will draw a line from P, towards the edge of the canvas, towards the direction where x = infinity while keeping y constant (i.e. towards the right, parallel to the x-axis on a x/y graph). It then traverses the array and for every two points (i.e. Polygon Boundary Edge) , it determines if the line will cut across it. It then counts the total number of times the line passes over the entire polygon boundary. If the total number is even, then the point is outside of the polygon, else it is inside.
Pretty ingenious right? Using the knowledge of this new found methodology, I proceeded to manipulate it for my own selfish means and finally overcome the problem of detecting a point inside/outside an n-gon, which was resurfacing in my mind frequently for quite a while now.
Another thing I've learnt (although it is quite a while back) is that the coordinates (0,0) of the image is actually the top right corner, not the initial top left corner I have always assumed. Probably because during the circle detection, I was using an unflipped version of the canvas, causing everything to have a mirrored effect.
Okay, that's all for today. Hope you enjoyed reading.
Reflection of the Week:
I'm not sure if I have mentioned it previously, but I joined a Yahoo! Group regarding OpenCV as well as thronged through many forums and websites to search for tried and tested (and even untried and untested) methods to solve my problems. One thing I've noticed in all my surfings, including surfings from the past 3 to 5 years (5 being my first arrival to the Wired), is the lack of initiative that exist in there. Well, let me say that I am not stereotyping by saying that everyone inside a forum or user group has no initiative, but rather, a small number of people (and their outstanding incidents) have got me wondering if these people joined the group just to ask/demand/expect for answers. Although the way they ask their question may be slightly rude and demanding, the other great members inside the forums tap on their pool of patience and knowledge to try to answer them thoroughly and patiently.
What are the incidents, one might ask? Well, it usually goes along the lines of:
"I am developing [project details] and have an error. Can someone help me out? [insert entire source code here, consisting of a/several complex class(es)]" or "Can someone tell me the answer to [insert a question that has already been answered by other earlier threads, or can be easily found by searching Google]"
Well, it is true that forums and user groups are a source of information - to find solutions to problems, but should we be abusing it by pasting our entire source code (or worse, only a portion of the source code with no explanation and expect others to know the rest) there and expecting people to scan through the entire codes to understand the logic and find out what is wrong? Or demanding a quick answer to their problems which can easily be solved if they attempted to try (such as by looking at the API available online)?
IMHO, if there were at least attempts to try to understand their problem and only ask questions towards a narrower scope, it would have been much more easier and quicker for people to respond. Anyway, who would be inclined to find problems in codes amount up to 1000 lines with no incentive in return?
Perhaps, a better way to put it would be:
"I am developing [project details] and have encountered a problem which I cannot seem to comprehend. I've checked the server logs and it mentions that I have an buffer overflow thrown on line 35 (highlighted in red). I did a search on the method being called and did not notice anything wrong with the return type, neither does it throw any checked exceptions which I am supposed to handle. Could it be that the variable passed in as the argument during the for-loop is null or of wrong type? I know it might be tedious, but can someone kindly help me out, please? [insert source code of the method which the error occurs in and any related methods.]"
And of course, a little thank you after the answer has been posted and an update of the problem solving is appreciated, to show that their hard work and time is not wasted after all. Well, perhaps after going into that level of detail to state their problem within a narrower scope, they themselves would have been able to notice the error and solve the bug in their code before they even hit the "post thread" button. Thankfully, only a small handful of people behave like the former; the rest behave in a much more matured and well-mannered fashion.
Negative online etiquette aside, I found many people at these forums or groups helpful and passionate to share their knowledge. Perhaps they are the ones, whose posts we should also value more, who make the forums a good place to hang out and learn. :)
Ciao for Week 9!
Tuesday, December 11, 2007
Week 8 (10 Dec - 14 Dec)
Monday, 10 December 2007
Week 8, and this means 8 more weeks to the end of my internship at IHPC. Giving it some thought over dinner, I am definite that I will miss IHPC and the Cove once I'm gone. Working here at IHPC, though only 8 weeks, have not only been fun, but also an educational and eye-opening experience. *opens eyes*
Now that I've opened my eyes and am finally awake, lets start this week fresh, energetic and in the mood of X'mas. I want my play-doh please. Whoops.
Odd shape detection is very challenging. With all the strange point coordinates its returning me and attempting to draw lines to. After spending some OT on Friday to separate the method used to draw the coordinate and calculate the corners (making it much more neater and easier to understand), I sat down the entire morning to do a code walk through. My waste-paper stack cum mouse pad is increasing with every paper I use. :)
Anyway, finally managed to more or less solve the problem before I called it a day - the coordinates being passed into the array of points seemed to be giving very strange numbers, such as (18912345, -1452) and (-523, 8), resulting in the lines being drawn all over the place, in an attempt to connect these nonexistent points which seem to fluctuate over time. With the time hitting 6.30pm, I decided to leave the office to grab some chow on my way home...
I've given some thought about the skeleton for the slides on Monday - hopefully I'll be able to get some interesting pictures to add to the slides. And that they won't bore anyone to sleep.
*back @ home*
Starting for SCJP is not easy. I've spent 0.0 hours today studying about it. The thought of it resurfacing regularly in my mind though, reminding me to study, but alas...
Picture of the day ...
Tuesday, 11 December 2007
What should I say? Eureka! or whatever word that has the same meaning as it.
Before lunch, finally manged to find out why the coordinates for the points were so strange - they were actually values of the memory addresses which I was using thanks to a addition of a wrong variable to the array index. After lunch, managed to fix that problem and move on to ironing some other bugs, such as deleting some unwanted repeated code to make the program more efficient (hopefully) so that it does not skip a few points when the total number of points and pointers increase [which happened a few times for some strange reasons, where the total # of points increased up to 110+ but the program was still reading the points from around 105 ].
After 7 days, managed to find out what is wrong with the odd shape detection code, solve it, and tidy up the code on my side a bit as well. I've also improved my knowledge of the parameters used in various OpenCV functions and its parameters. The idea behind it is still the same, taking only the points which are required to draw the n-gon shape and draw them, skipping those points on the contour which are already drawn, or contours with only less than 3 points.
This n-gon (or odd shape) detection is by far one of the longest task which I have done for Lightdraw so far. However, the experiences and challenges it brings is something worth exploring and solving, as the focus moves away from what I usually do in school, web dev, to something a bit closer to Computer Visioning and pattern recognition.
Pictures of before and after:

Wednesday, 12 December 2007
With the odd shape detection / n-gon shape detection done, we moved on to discuss the rest of the game play and the immediate step to take. JL did a great job on the .png pictures which were used as the encircling symbol for the game play.
The next step would be to detect a single point collision within a shape via (ideally) a sequence of points of the shape or (not so ideally) by redrawing the shape.
In order to properly and more effectively get the sequence of the points and perform this encircling detection, it was suggested to perform "point merging". Which is to say, if on the n-gon where there are a couple of points which are closely positioned of X units between, we would merge them as one point so that the shape will become more defined, and that there will be lesser points to draw on the screen. Which will in turn lead to better point collision code. Hopefully.
After lunch went to double check the code and tested it to see if any hidden errors / memory leaks were hiding before updating of the SVN.
Just when we were all ready to start with the next step, we were reminded that we had a presentation to do on Monday and Kevin suggested that we prepare some slides and do a sample presentation to him so that he can give us areas of improvements.
Well, seemed like a pretty straightforward task to me. (or so I thought before Thursday)
Picture of the day:
Thursday, 13 December 2007
We focused mainly on the slides today which I have done up yesterday to present on next Monday. However, having not done presentations for a long time, I had lost touch of many presentation skills and did not synchronize well with JL, partly due to my complicated and over-wordy slides.
Naturally, our presentation didn't go as well as we would have liked and were given numerous areas of improvements for the presentation, including rewording and redesigning the slides. Reworking of the slides took place over throughout the rest of the day (and night) as the next demo presentation was in 24 hours after the first one ended.
After the presentation, we started filming the short video to complement our presentation. with JL as the director and myself as the star, who knows what rating will our video get. R21? Just kiddin'.
The idea may be good, but without a good presentation, no one will buy the idea.

Friday, 14 December 2007
Anyway, after which, we all headed down to doc green for some healthy food ( a man of my word ). And some humorous incidents at the Vaio roadshow. And then back to the Cove for more slide editing and video filming before finally presenting to Kevin and Harold again. This time round, they mentioned that we have improved from the previous time, though there were still many points to take note. They gave many valid points of improvements for the slides as well as some of their learning points from previous experiences. Thank you, to Kevin and Harold, if you are reading this post. :)
Finished up some last minute work on the slides, and finally left the office at 9pm.
We take some, we give some.
Picture of the day:

Reflection of the Week:
I always thought that presentations relied only on the speaker - How confident the speaker portrayed himself and how detailed he elaborated about was somewhat all that mattered. Of course, the speaker must know his/her stuff thoroughly enough to do so.
Or at least that is my perception until this week at work.
When we got the points of feedback pertaining to our first presentation, it was then I realized how much things that I have been doing wrongly for my past few presentations in school. It is true that while presenting, we do a few things which we do not consciously take notice of, such as swinging our arms and playing with things in our hands. And we need people to tell us that we are doing such things before we actually realize it.
I also thought that speech came fluently to the speaker so that abstract slides, or even no slides, can still get the message to the audience within a short period of time. But again, I was proven wrong as I stumbled a couple of times during our rehearsals and got tongue-tied. Perhaps I need to speak slower in order to be concise and clear.
In terms of abstract slides, to me, I know what that one word means on the slide and/or how great a screen shot may be, in terms of time and effort spent. But putting myself in the shoes of the listener, the word is just another word and the screen shot might be just another possible photoshopped picture.
But this experience is great, as in school, the presentations were focused mainly on the way we portrayed ourselves (formal attire, etc) and the project which we have done (the so and so system which does ABC). Rarely were we actually corrected us on things like how we should not read from the slides, speaking too softly, not making eye contact, body movement, not presenting confidently, etc. The focus, was more or less on attire and project.
I'm not saying that there was totally no help or constructive feedback given to us by our tutors and peers. But perhaps the state of seriousness (or the lack of it) of the situation inside a classroom with all our peers looking equally worried as they frantically coded and amended their code before their turn (myself included) while they half-listened as us did not really drive in the point. Also, with our friendly tutors as our evaluators, the familiar faces reduced one of the stress and pressure points on us.
Peer to peer evaluation is equally important and should be taken seriously. Though it is rare that peer evaluations included pointers on presentation skills - more on the project and teamwork issues. In my experience, very few friends have came up to me and actually told me in my face that I was doing something wrongly. Of course, if feedback came my way, I would have to put aside any emotional feelings and see the feedback as it is, and not from who it was said by.
Well, at the end of this post, would just like to summarize the learning point for this week, which is: good presentations need quality visual aids to compliment the presenter. When given feedback, accept it modestly, thank the person and work to improve on it if it is a valid point.
Anyway, hope Monday's presentation goes well.
Week 8, and this means 8 more weeks to the end of my internship at IHPC. Giving it some thought over dinner, I am definite that I will miss IHPC and the Cove once I'm gone. Working here at IHPC, though only 8 weeks, have not only been fun, but also an educational and eye-opening experience. *opens eyes*
Now that I've opened my eyes and am finally awake, lets start this week fresh, energetic and in the mood of X'mas. I want my play-doh please. Whoops.
Odd shape detection is very challenging. With all the strange point coordinates its returning me and attempting to draw lines to. After spending some OT on Friday to separate the method used to draw the coordinate and calculate the corners (making it much more neater and easier to understand), I sat down the entire morning to do a code walk through. My waste-paper stack cum mouse pad is increasing with every paper I use. :)
Anyway, finally managed to more or less solve the problem before I called it a day - the coordinates being passed into the array of points seemed to be giving very strange numbers, such as (18912345, -1452) and (-523, 8), resulting in the lines being drawn all over the place, in an attempt to connect these nonexistent points which seem to fluctuate over time. With the time hitting 6.30pm, I decided to leave the office to grab some chow on my way home...
I've given some thought about the skeleton for the slides on Monday - hopefully I'll be able to get some interesting pictures to add to the slides. And that they won't bore anyone to sleep.
*back @ home*
Starting for SCJP is not easy. I've spent 0.0 hours today studying about it. The thought of it resurfacing regularly in my mind though, reminding me to study, but alas...
Picture of the day ...
Tuesday, 11 December 2007
RedSteel - and the "oh yes" scene.
What should I say? Eureka! or whatever word that has the same meaning as it.
Before lunch, finally manged to find out why the coordinates for the points were so strange - they were actually values of the memory addresses which I was using thanks to a addition of a wrong variable to the array index. After lunch, managed to fix that problem and move on to ironing some other bugs, such as deleting some unwanted repeated code to make the program more efficient (hopefully) so that it does not skip a few points when the total number of points and pointers increase [which happened a few times for some strange reasons, where the total # of points increased up to 110+ but the program was still reading the points from around 105 ].
After 7 days, managed to find out what is wrong with the odd shape detection code, solve it, and tidy up the code on my side a bit as well. I've also improved my knowledge of the parameters used in various OpenCV functions and its parameters. The idea behind it is still the same, taking only the points which are required to draw the n-gon shape and draw them, skipping those points on the contour which are already drawn, or contours with only less than 3 points.
This n-gon (or odd shape) detection is by far one of the longest task which I have done for Lightdraw so far. However, the experiences and challenges it brings is something worth exploring and solving, as the focus moves away from what I usually do in school, web dev, to something a bit closer to Computer Visioning and pattern recognition.
Pictures of before and after:
Before...
Wednesday, 12 December 2007
With the odd shape detection / n-gon shape detection done, we moved on to discuss the rest of the game play and the immediate step to take. JL did a great job on the .png pictures which were used as the encircling symbol for the game play.
The next step would be to detect a single point collision within a shape via (ideally) a sequence of points of the shape or (not so ideally) by redrawing the shape.
In order to properly and more effectively get the sequence of the points and perform this encircling detection, it was suggested to perform "point merging". Which is to say, if on the n-gon where there are a couple of points which are closely positioned of X units between, we would merge them as one point so that the shape will become more defined, and that there will be lesser points to draw on the screen. Which will in turn lead to better point collision code. Hopefully.
After lunch went to double check the code and tested it to see if any hidden errors / memory leaks were hiding before updating of the SVN.
Just when we were all ready to start with the next step, we were reminded that we had a presentation to do on Monday and Kevin suggested that we prepare some slides and do a sample presentation to him so that he can give us areas of improvements.
Well, seemed like a pretty straightforward task to me. (or so I thought before Thursday)
Picture of the day:
Thursday, 13 December 2007
We focused mainly on the slides today which I have done up yesterday to present on next Monday. However, having not done presentations for a long time, I had lost touch of many presentation skills and did not synchronize well with JL, partly due to my complicated and over-wordy slides.
Naturally, our presentation didn't go as well as we would have liked and were given numerous areas of improvements for the presentation, including rewording and redesigning the slides. Reworking of the slides took place over throughout the rest of the day (and night) as the next demo presentation was in 24 hours after the first one ended.
After the presentation, we started filming the short video to complement our presentation. with JL as the director and myself as the star, who knows what rating will our video get. R21? Just kiddin'.
The idea may be good, but without a good presentation, no one will buy the idea.
Friday, 14 December 2007
Today I learn the meaning of 3 minutes. And good customer service.That aside, today we sat through some presentations of some AC staff. We observed how they presented and what points which they did well on, and where they can improve. Indeed, every day seems to be an eye opener. It seems that many people fear presenting, and occasionally choosing to memorize their slides/speech, which should not be the case. As memorizing (IMHO) would mean that the speaker would not be flexible in his speech and panic when he/she forgets the words or point sequence ( i learnt that the hard way from the MSP dinner too ). The memorized sequence would partly seem to be very mono-tone and no tone of enthusiasm for some.
Anyway, after which, we all headed down to doc green for some healthy food ( a man of my word ). And some humorous incidents at the Vaio roadshow. And then back to the Cove for more slide editing and video filming before finally presenting to Kevin and Harold again. This time round, they mentioned that we have improved from the previous time, though there were still many points to take note. They gave many valid points of improvements for the slides as well as some of their learning points from previous experiences. Thank you, to Kevin and Harold, if you are reading this post. :)
Finished up some last minute work on the slides, and finally left the office at 9pm.
We take some, we give some.
Picture of the day:

Reflection of the Week:
I always thought that presentations relied only on the speaker - How confident the speaker portrayed himself and how detailed he elaborated about was somewhat all that mattered. Of course, the speaker must know his/her stuff thoroughly enough to do so.
Or at least that is my perception until this week at work.
When we got the points of feedback pertaining to our first presentation, it was then I realized how much things that I have been doing wrongly for my past few presentations in school. It is true that while presenting, we do a few things which we do not consciously take notice of, such as swinging our arms and playing with things in our hands. And we need people to tell us that we are doing such things before we actually realize it.
I also thought that speech came fluently to the speaker so that abstract slides, or even no slides, can still get the message to the audience within a short period of time. But again, I was proven wrong as I stumbled a couple of times during our rehearsals and got tongue-tied. Perhaps I need to speak slower in order to be concise and clear.
In terms of abstract slides, to me, I know what that one word means on the slide and/or how great a screen shot may be, in terms of time and effort spent. But putting myself in the shoes of the listener, the word is just another word and the screen shot might be just another possible photoshopped picture.
But this experience is great, as in school, the presentations were focused mainly on the way we portrayed ourselves (formal attire, etc) and the project which we have done (the so and so system which does ABC). Rarely were we actually corrected us on things like how we should not read from the slides, speaking too softly, not making eye contact, body movement, not presenting confidently, etc. The focus, was more or less on attire and project.
I'm not saying that there was totally no help or constructive feedback given to us by our tutors and peers. But perhaps the state of seriousness (or the lack of it) of the situation inside a classroom with all our peers looking equally worried as they frantically coded and amended their code before their turn (myself included) while they half-listened as us did not really drive in the point. Also, with our friendly tutors as our evaluators, the familiar faces reduced one of the stress and pressure points on us.
Peer to peer evaluation is equally important and should be taken seriously. Though it is rare that peer evaluations included pointers on presentation skills - more on the project and teamwork issues. In my experience, very few friends have came up to me and actually told me in my face that I was doing something wrongly. Of course, if feedback came my way, I would have to put aside any emotional feelings and see the feedback as it is, and not from who it was said by.
Well, at the end of this post, would just like to summarize the learning point for this week, which is: good presentations need quality visual aids to compliment the presenter. When given feedback, accept it modestly, thank the person and work to improve on it if it is a valid point.
Anyway, hope Monday's presentation goes well.
Monday, December 3, 2007
Week 7 (3 Dec - 7 Dec)
Monday, 3 December 2007
Ahh! Monday, a start of a brand new week. After the long weekend, inclusive of being burnt from a 22km kayaking expedition around Pulau Ubin, its back to work.
Circle Detection and Rectangle Detection seems okay - but a problem arises from the code: When drawing of the rectangle or a 4-sided polygon, the user may have an unstable hand or be unsure of the direction to travel to create the appropriate shapes - which may result in a rectangle having 4 distinct sides. But in reality, after the cvDilate-ing and cvCanny-ing it, there will be 1 to 3 additional points detected along with the 4 distinct corners due to the uneven width of the light and the straightness (or rather, the un-straightness) of the line being drawn.
Solution: to modify the rectangle detection code in such a way that it is able to dynamically detect shapes with 3 or more corners and draw its outline. This way, there will not be a need to have a set of code for each shape, starting with a triangle, polygon, pentagon, hexagon, etc.
Tuesday, 4 December 2007
I'm still doing Monday's task.
Some trivia: RSVP is the abbreviation of the French phrase répondez s'il vous plaît,
Wednesday, 5 December 2007
This blog has been discovered! There is no more hiding in the shadows of my inner random thoughts. Perhaps some censorship is needed in the following 9 posts (9 weeks). Oh well, just do until told not to. :)
Odd shape detection. Still on it - still redefining it. Managed to get a more or less accurate code up and running and understand the source code more, including the one line if-statement again, after asking Harold about it and being reminded that I was not learning based on my first week's post. Perhaps I should really take time out of a weekend to read that book I borrowed about C as well as the C++ books that Mr Yeak has kindly lent me.
Anyway, we also discussed a bit about the concept game, its game play and some rules and things to take note. We got a list of tasks to do and will start working on it as soon as I get the odd shape detection with separate polygons being drawn without being connected.
Ms Chiang sms-ed me today informing JL and myself that we had to do a short 10-15min presentation about the lightdraw project to our cohort during our mid-sem briefing (17 December 2007). We discussed this with CT and Kevin and decided to do some progressive introduction via a slide show and a short video show casing lightdraw in action. Time to factor in some time to do script and slides within the next 2 weeks. Probably, there goes my free nights and weekends (if I had any to begin with) :)
And one more thing, Merry X'mas.

Thursday, 6 December 2007
I'm still doing odd shape detection with separate polygons. There's some progress - at least I know where my previous algorithm went wrong. The corners of the polygon being detected do not necessarily get detected sequentially, thus in a pentagon, the 3rd corner drawn may very well become the first corner in the detected contour. This makes slicing the sequence of points based on the number of corners (like the polygon detection) impossible as there is no way to tell the number of points the user-shape may have, even for a regular polygon, due to the width of the light detected by the camera and the non-linear hand movement across the screen even for straight lines.
Task now: Thinking about how to effectively separate/slice the points, belonging to a single closed shape, from the main sequence of points.
Friday, 7 December 2007
I think I've got it - but only in theory. It took me the entire morning to figure it out, and the entire afternoon to duplicate the code such that it worked via two functions instead of everything lumped together. (Perhaps I'm not understanding the code enough?)
The way that I have thought about to detect if the points within the sequence is by checking, based on the original picture, that the midpoint between them is/are of equal colour, with consideration of thresholding. If they are, that will mean that there is a line drawn between them and they are belonging to the same shape, connected by a line.
However, I've only managed to think about the concept of it. If this concept fails, I'll have to go back to CT's way of manually checking each pixel and defining each pixel to see if it belongs to a certain pattern. Which we suspect will be very slow, and will further cause lag to the software's performance. But we will never know unless we try and then again, with the Mac Pro so powerful...
Reflection of the Week:
This task on odd shape detection for 2 or more shapes is taking quite a while to do (so far till friday, its been 5 days). Well, I admit that perhaps the confusing usage of the various parameters to pass into the functions is one of them. With many parameters being generally explained or the use of terminology with regards to computer vision...
Anyway, that aside, Kevin mentioned to me earlier in the week about how working in an environment outside of school is different in terms of real world experiences. Which I have to agree to some extent. In school, we are unconsciously being spoon-fed to some extent. When assignments are given to us, we already know that they are do-able, and that the answers we seek are inside the lecture notes. We know what is the criteria to score a A/B/C/... (at least for the old system I went through).
Again, I have to clarify my point that it is not that I hate studying in school or I hate being spoon-fed - when I first came into TP-IIT school, I needed all the help I could get to do a simple Hello World program. Spoon-feeding to some extent in school is not a bad thing as isn't it by looking and understanding how others do it that we learn to do it ourselves, and do it better? But just that when it comes to getting exposure on the various industry stuff and what not (e.g. SVN), perhaps these attachments are most ideal in getting the student hands on experience in this aspect.
Working in an environment outside school is akin, IMHO, to doing the bonus task of the assignment, which targets a totally different segment of the working software. However, that aside, for assignments we could always ring on Dr Eng's staff room extension and ask for advice when we meet with some problems (whoops, sorry for disturbing you for the past 2 years, Dr Eng!). But outside of that school boundaries, perhaps some of the problems we are attempting to solve are not even solvable with the state of the libraries/technologies at this point of time (opposite when compared to assignments which we know are possible).
Now, there is no number to call for specific advice with regard to the part of uncertainty. Again, not that I am complaining - it is a good way to gain experience and learn how to solve my own problems. Using forums, interest groups, APIs, white papers and what not. Thankfully, I took up the CDS of "Using the Internet as a Research Tool" (thanks Mdm Jamila) and it is perhaps time to refer back to some of the first few lessons I've learnt in that subject..
At the end of the day, each approach has its pros and cons. And regardless of each phase, we should make the best use of what we have to fully learn as much as we can from our differing experience and grow/develop ourselves.
Next week, I throw another thing up in the air to juggle with my 24 hours each day - studying for SCJP, its test on 29 December. Will I survive?
Wish me luck!
Reminder to myself: write maintainable code...
Ahh! Monday, a start of a brand new week. After the long weekend, inclusive of being burnt from a 22km kayaking expedition around Pulau Ubin, its back to work.
Circle Detection and Rectangle Detection seems okay - but a problem arises from the code: When drawing of the rectangle or a 4-sided polygon, the user may have an unstable hand or be unsure of the direction to travel to create the appropriate shapes - which may result in a rectangle having 4 distinct sides. But in reality, after the cvDilate-ing and cvCanny-ing it, there will be 1 to 3 additional points detected along with the 4 distinct corners due to the uneven width of the light and the straightness (or rather, the un-straightness) of the line being drawn.
Solution: to modify the rectangle detection code in such a way that it is able to dynamically detect shapes with 3 or more corners and draw its outline. This way, there will not be a need to have a set of code for each shape, starting with a triangle, polygon, pentagon, hexagon, etc.
Tuesday, 4 December 2007
Tuesday.setTasks = Monday.getTasks();
I'm still doing Monday's task.
Some trivia: RSVP is the abbreviation of the French phrase répondez s'il vous plaît,
Wednesday, 5 December 2007
This blog has been discovered! There is no more hiding in the shadows of my inner random thoughts. Perhaps some censorship is needed in the following 9 posts (9 weeks). Oh well, just do until told not to. :)
Odd shape detection. Still on it - still redefining it. Managed to get a more or less accurate code up and running and understand the source code more, including the one line if-statement again, after asking Harold about it and being reminded that I was not learning based on my first week's post. Perhaps I should really take time out of a weekend to read that book I borrowed about C as well as the C++ books that Mr Yeak has kindly lent me.
Anyway, we also discussed a bit about the concept game, its game play and some rules and things to take note. We got a list of tasks to do and will start working on it as soon as I get the odd shape detection with separate polygons being drawn without being connected.
Ms Chiang sms-ed me today informing JL and myself that we had to do a short 10-15min presentation about the lightdraw project to our cohort during our mid-sem briefing (17 December 2007). We discussed this with CT and Kevin and decided to do some progressive introduction via a slide show and a short video show casing lightdraw in action. Time to factor in some time to do script and slides within the next 2 weeks. Probably, there goes my free nights and weekends (if I had any to begin with) :)
And one more thing, Merry X'mas.
Thursday, 6 December 2007
The high wall remains firmly rooted to the ground, unbeaten by the multiple attempts that we have put forth to bring it down. Swaying slightly in the breeze, it looks down on our feeble attempts and laughs.
Perhaps in my imagination.
I'm still doing odd shape detection with separate polygons. There's some progress - at least I know where my previous algorithm went wrong. The corners of the polygon being detected do not necessarily get detected sequentially, thus in a pentagon, the 3rd corner drawn may very well become the first corner in the detected contour. This makes slicing the sequence of points based on the number of corners (like the polygon detection) impossible as there is no way to tell the number of points the user-shape may have, even for a regular polygon, due to the width of the light detected by the camera and the non-linear hand movement across the screen even for straight lines.
Task now: Thinking about how to effectively separate/slice the points, belonging to a single closed shape, from the main sequence of points.
Friday, 7 December 2007
I think I've got it - but only in theory. It took me the entire morning to figure it out, and the entire afternoon to duplicate the code such that it worked via two functions instead of everything lumped together. (Perhaps I'm not understanding the code enough?)
The way that I have thought about to detect if the points within the sequence is by checking, based on the original picture, that the midpoint between them is/are of equal colour, with consideration of thresholding. If they are, that will mean that there is a line drawn between them and they are belonging to the same shape, connected by a line.
However, I've only managed to think about the concept of it. If this concept fails, I'll have to go back to CT's way of manually checking each pixel and defining each pixel to see if it belongs to a certain pattern. Which we suspect will be very slow, and will further cause lag to the software's performance. But we will never know unless we try and then again, with the Mac Pro so powerful...
Reflection of the Week:
This task on odd shape detection for 2 or more shapes is taking quite a while to do (so far till friday, its been 5 days). Well, I admit that perhaps the confusing usage of the various parameters to pass into the functions is one of them. With many parameters being generally explained or the use of terminology with regards to computer vision...
Anyway, that aside, Kevin mentioned to me earlier in the week about how working in an environment outside of school is different in terms of real world experiences. Which I have to agree to some extent. In school, we are unconsciously being spoon-fed to some extent. When assignments are given to us, we already know that they are do-able, and that the answers we seek are inside the lecture notes. We know what is the criteria to score a A/B/C/... (at least for the old system I went through).
Again, I have to clarify my point that it is not that I hate studying in school or I hate being spoon-fed - when I first came into TP-IIT school, I needed all the help I could get to do a simple Hello World program. Spoon-feeding to some extent in school is not a bad thing as isn't it by looking and understanding how others do it that we learn to do it ourselves, and do it better? But just that when it comes to getting exposure on the various industry stuff and what not (e.g. SVN), perhaps these attachments are most ideal in getting the student hands on experience in this aspect.
Working in an environment outside school is akin, IMHO, to doing the bonus task of the assignment, which targets a totally different segment of the working software. However, that aside, for assignments we could always ring on Dr Eng's staff room extension and ask for advice when we meet with some problems (whoops, sorry for disturbing you for the past 2 years, Dr Eng!). But outside of that school boundaries, perhaps some of the problems we are attempting to solve are not even solvable with the state of the libraries/technologies at this point of time (opposite when compared to assignments which we know are possible).
Now, there is no number to call for specific advice with regard to the part of uncertainty. Again, not that I am complaining - it is a good way to gain experience and learn how to solve my own problems. Using forums, interest groups, APIs, white papers and what not. Thankfully, I took up the CDS of "Using the Internet as a Research Tool" (thanks Mdm Jamila) and it is perhaps time to refer back to some of the first few lessons I've learnt in that subject..
At the end of the day, each approach has its pros and cons. And regardless of each phase, we should make the best use of what we have to fully learn as much as we can from our differing experience and grow/develop ourselves.
Next week, I throw another thing up in the air to juggle with my 24 hours each day - studying for SCJP, its test on 29 December. Will I survive?
Wish me luck!
Reminder to myself: write maintainable code...
Wednesday, November 28, 2007
Week 6 (26 Nov - 30 Nov)
Monday, 26 November 2007
I wonder why people call it Monday blues? There was not a single outstanding blue colour in today. Nevertheless, I woke up feeling like I need more sleep. Anyway, back to work on week 6 - effectively making it 10 more weeks to go.
The day started with polishing up circle detection and updating it into the SVN repository. However, a slight glitch ended up with our main file, lightdraw.c being updated with a out-of-date file, which we suspect is suffering from a memory leak. Thankfully, we had the working copy of the code located in someone's computer and managed to revert it. Anyway, SVN has the ability to revert the code to a previous revision in the event of such an accident from happening. Anyway, yea.. that's about it for the morning.
In the afternoon, we visited Dell Computers and talked to their MD with regard to loaning a computer with 2 dual output graphic cards (4 monitors). Its specs are good, with it being able to support a game rendered across three screens as demo-ed in their lab. The reason why they had lent it to us was so that we are able to harness its power to create a multi-screen software to run on its 4 monitors, showing that the ability of what 4 monitors can do, as compared to one. Nevertheless, we brought it back to the office and hooked the system up, but not before looking at its innards.

A cool piece of hardware, hopefully we'll make full and good use of it during its precious time with us. :) With the addition of the new machine, we have also partly reworked the layout of the office to cater to the addition to our new addition to the family. With that, we ended another exciting day at IHPC.
Heard that most people enjoyed themselves at the company's dinner and dance. Cool. Well done Bernard for winning the first prize!
Tuesday, 27 November 2007
Today was spent at CMPB doing my pre-enlistment medical check up. After 4 hours of checkup and doing the test, I am certified as Pes A L1. So is that a good thing or not? hmmz...
Wednesday, 28 November 2007
Today I started with square/rectangle detection. Initially had searched around for Hough Transformation, but its parameters had to be specially catered for each picture of different nature. For example, a picture of a building will have different parameters for thresholding passed into the method as compared to a picture of some bathroom tiles - and finding the right combination of parameters was no easy task. At least to me.
Anyway, after that, we revisited circle detection, with some brainstorming on the various rules we would like to set for the game. JL did a very good job in creating a square on the black canvas and the user/player, would have to draw a circle around it to make it disappear. Something simple for now, but I believe will get more complicated. However, the way which circle detection works for the software is quite strict on the way the circle is drawn. The circle's average diameter between 6 evenly spaced out points (3 pair points) had to be no more than X units different away than compared to the circle drawn by the computer.
On the way home, JL suggested that perhaps one area to look into is that to ensure that the contours are of a certain length before calculating if it is a full-fledged circle. Which might be a valid checking as if the user were to just flash the light once in the direction of the camper, the canny method will cause it to appear just like a contour, with the diameters being close to equal than that of the circle being drawn. Thus the loophole in the game was that if the player were to flash a light quick enough at the center of the square, it will take it that the player had drawn a circle around the square's center. A cheat, probably? :)
So to improve on the algorithm, we discussed about it for quite a while. Kevin suggested modifying the conditions such that they had to be of ratio less than X value before the shape is considered a complete one. However, drawing a long rectangle (somewhat similar to a light trail across the screen) would return false for this checking.
In theory, it will be unfeasible, but in practical implementation...?
Thursday, 29 November 2007
With circle detection being worked on by JL for collision detection ( or rather, encirclement detection ), I moved on to using another algorithm, as suggested by CT - Hough Transformation. Hough Transformation is a rather mathematical approach for detecting circles on the input image. However, it might have worked too well as even normal hand drawn circles were not detected as circles for its lack of appropriate curves of the arcs (or might be my handdrawing is lousy).
Also touched a bit on Polygon detection (but not squares, since squares were detected as circles as well as its average diameter and length of their sides are quite the same). Referenced code on the net and the sample OpenCV codes and edited them to my function. Again, worked really well, but perhaps too well as sometimes rectangles had a slight bump in them (due to shaky or crooked lines from the torchlight) which made the program think it was 5 or 6 corners instead of 4 corners.
Though for other polygons, such as trapeziums and rectangles, they worked fine with the code.
Anyway, Bernard had won the first price at the D&D - which was a Wii. We spent some time playing with it on Wed and Thurs to see what it was really like to play the Wii, after hearing so much about it. It was really cool, using the infrared and velocity estimation (i assume), it was able to detect how much force to use or what action to do during the game. Another great HCI as compared to the keyboard/mouse pair of the traditional gaming controller. However, after playing bowling for a while, my shoulder joint started to ache. Haha. Guess its time for me to get more in shape, by bowling? :)
Anyway, here is one of our Mii characters. I won't say who it belongs to though...

Friday, 30 November 2007
Nothing much can be said about work today. Just did more on circle detection using Hough Transformation (cvHoughCircles). Read Thursday's post for more details.
After telling CT that Hough transformation was rather too accurate, he suggested Morphological Thinning, which meant thinning of the edges of the shape so that it would appear, ideally, as a single line 1 pixel wide. But the point was that the shape drawn was not linear enough to do thinning equally on all sides, as a result, some parts totally got thinned to nothing. Well, I guess there are some pros and cons to each methodology. Lastly, I did a combination of both techniques, but results were not as satisfactory. Maybe its some parameters I used?
Anyway, on the way back home, I witnessed a particular incident - a lady had boarded the train with her two young daughters - unfortunately, there were no free seats available at that time, but thankfully, a young man gave up his seat to her. Well, as all loving mothers would do, she let one of her daughters. The other, she had initially carried her other daughter, but I suppose she got a bit tired so she put her down in front of her older (i think) sister. The best part? The people sitting on the left and right of the mother and two daughters, did not budge. Instead, they just looked at them. Interesting huh?

Reflection of the Week:
Well well well. End of the 6th week, which means another 50 days to go (excluding the weekends of course).
With the nature of the company being a research-based one, there is usually no rush for datelines and/or bindings to specific tools. It was mentioned a couple of times - datelines are quite relaxed and there is the possibility of thinking "what-if" during the project, instead of "how-to".
I also had to keep on reminding myself that I should set a dateline and goal of what I wanted to achieve each day, so that I do not end up coding until 7pm-ish each day. With a proper goal in mind, I can work towards it with confidence and speed.
Last point regarding work, after a while, the objectives become less clear over time and milestones have to be set. Initially we were supposed to create nicer light effect (with edge blending), then work on the game, which is in progress. But because the "game" mode's details about gameplay etc is not really defined, we sometimes veer off course on what we should develop and research on, moving all the way to cross-detection and what not. As such, I found it useful to have mini milestones, even if it is an individual milestone to work on, so that I know what I am achieving or need to be achieved. Speaking of which, I better check with JL after I do the shape detection on what should the proposed specs be...
Another thing I noticed this week is about human nature (off topic on SIP). On Sunday, I attended a Kayaking race (or Canoing Race, if you prefer) and we had like 150+ participants. With many people being their first time attempting the race (me included), they were unsure of the currents and choppiness of the water out at sea, especially near the coastal edges of Ubin. And well, quite a number of them capsized. Even as participants in the race, my friends and I stopped our crafts and helped them back onto their kayaks, even though it was not our job to do so. All in the name of good sportsmanship and what not, right?
However, there were plenty of others before us, who just went past them, without even helping them or staying with them till a rescue boat came to help them - especially when they capsized in the middle of the channel, where other motorized boats frequented. Such incidents, which I reflected on, brought me back to Friday's post on the mother with two daughters and the other passengers on the train to the left and right of them. I mean, considering their age, they might perhaps been privileged to sit on those seats. However, after sitting on the seats so long, shouldn't they realize that there is this mother of two, struggling to balance herself while keeping an eye on her two daughters? Although they are that privileged, shouldn't they give their seat up after they have rested like from City Hall to Bedok, to the poor mother, who ultimately resulted to squatting (you can see her in the bottom right of the picture) to ensure that she can balance herself (lower CG) and take care of her two daughters?
What these two incidents have in common is that these other people, when seeing others who obviously needed help of which they had the capabilities and/or resources to do, merely sat there staring at the situation - somewhat being unable to react to it, or too self-centered to do so?
I don't really know. After all, I am in no position to judge or tell them on what they should or rather, shouldn't be doing, or how they should react. Is this a sign of being self-centered, or just conflicting morals and belief in the right of way?
I wonder why people call it Monday blues? There was not a single outstanding blue colour in today. Nevertheless, I woke up feeling like I need more sleep. Anyway, back to work on week 6 - effectively making it 10 more weeks to go.
The day started with polishing up circle detection and updating it into the SVN repository. However, a slight glitch ended up with our main file, lightdraw.c being updated with a out-of-date file, which we suspect is suffering from a memory leak. Thankfully, we had the working copy of the code located in someone's computer and managed to revert it. Anyway, SVN has the ability to revert the code to a previous revision in the event of such an accident from happening. Anyway, yea.. that's about it for the morning.
In the afternoon, we visited Dell Computers and talked to their MD with regard to loaning a computer with 2 dual output graphic cards (4 monitors). Its specs are good, with it being able to support a game rendered across three screens as demo-ed in their lab. The reason why they had lent it to us was so that we are able to harness its power to create a multi-screen software to run on its 4 monitors, showing that the ability of what 4 monitors can do, as compared to one. Nevertheless, we brought it back to the office and hooked the system up, but not before looking at its innards.
A cool piece of hardware, hopefully we'll make full and good use of it during its precious time with us. :) With the addition of the new machine, we have also partly reworked the layout of the office to cater to the addition to our new addition to the family. With that, we ended another exciting day at IHPC.
Heard that most people enjoyed themselves at the company's dinner and dance. Cool. Well done Bernard for winning the first prize!
Tuesday, 27 November 2007
Today was spent at CMPB doing my pre-enlistment medical check up. After 4 hours of checkup and doing the test, I am certified as Pes A L1. So is that a good thing or not? hmmz...
Wednesday, 28 November 2007
Today I started with square/rectangle detection. Initially had searched around for Hough Transformation, but its parameters had to be specially catered for each picture of different nature. For example, a picture of a building will have different parameters for thresholding passed into the method as compared to a picture of some bathroom tiles - and finding the right combination of parameters was no easy task. At least to me.
Anyway, after that, we revisited circle detection, with some brainstorming on the various rules we would like to set for the game. JL did a very good job in creating a square on the black canvas and the user/player, would have to draw a circle around it to make it disappear. Something simple for now, but I believe will get more complicated. However, the way which circle detection works for the software is quite strict on the way the circle is drawn. The circle's average diameter between 6 evenly spaced out points (3 pair points) had to be no more than X units different away than compared to the circle drawn by the computer.
On the way home, JL suggested that perhaps one area to look into is that to ensure that the contours are of a certain length before calculating if it is a full-fledged circle. Which might be a valid checking as if the user were to just flash the light once in the direction of the camper, the canny method will cause it to appear just like a contour, with the diameters being close to equal than that of the circle being drawn. Thus the loophole in the game was that if the player were to flash a light quick enough at the center of the square, it will take it that the player had drawn a circle around the square's center. A cheat, probably? :)
So to improve on the algorithm, we discussed about it for quite a while. Kevin suggested modifying the conditions such that they had to be of ratio less than X value before the shape is considered a complete one. However, drawing a long rectangle (somewhat similar to a light trail across the screen) would return false for this checking.
In theory, it will be unfeasible, but in practical implementation...?
Thursday, 29 November 2007
With circle detection being worked on by JL for collision detection ( or rather, encirclement detection ), I moved on to using another algorithm, as suggested by CT - Hough Transformation. Hough Transformation is a rather mathematical approach for detecting circles on the input image. However, it might have worked too well as even normal hand drawn circles were not detected as circles for its lack of appropriate curves of the arcs (or might be my handdrawing is lousy).
Also touched a bit on Polygon detection (but not squares, since squares were detected as circles as well as its average diameter and length of their sides are quite the same). Referenced code on the net and the sample OpenCV codes and edited them to my function. Again, worked really well, but perhaps too well as sometimes rectangles had a slight bump in them (due to shaky or crooked lines from the torchlight) which made the program think it was 5 or 6 corners instead of 4 corners.
Though for other polygons, such as trapeziums and rectangles, they worked fine with the code.
Anyway, Bernard had won the first price at the D&D - which was a Wii. We spent some time playing with it on Wed and Thurs to see what it was really like to play the Wii, after hearing so much about it. It was really cool, using the infrared and velocity estimation (i assume), it was able to detect how much force to use or what action to do during the game. Another great HCI as compared to the keyboard/mouse pair of the traditional gaming controller. However, after playing bowling for a while, my shoulder joint started to ache. Haha. Guess its time for me to get more in shape, by bowling? :)
Anyway, here is one of our Mii characters. I won't say who it belongs to though...
Friday, 30 November 2007
Nothing much can be said about work today. Just did more on circle detection using Hough Transformation (cvHoughCircles). Read Thursday's post for more details.
After telling CT that Hough transformation was rather too accurate, he suggested Morphological Thinning, which meant thinning of the edges of the shape so that it would appear, ideally, as a single line 1 pixel wide. But the point was that the shape drawn was not linear enough to do thinning equally on all sides, as a result, some parts totally got thinned to nothing. Well, I guess there are some pros and cons to each methodology. Lastly, I did a combination of both techniques, but results were not as satisfactory. Maybe its some parameters I used?
Anyway, on the way back home, I witnessed a particular incident - a lady had boarded the train with her two young daughters - unfortunately, there were no free seats available at that time, but thankfully, a young man gave up his seat to her. Well, as all loving mothers would do, she let one of her daughters. The other, she had initially carried her other daughter, but I suppose she got a bit tired so she put her down in front of her older (i think) sister. The best part? The people sitting on the left and right of the mother and two daughters, did not budge. Instead, they just looked at them. Interesting huh?
Reflection of the Week:
Well well well. End of the 6th week, which means another 50 days to go (excluding the weekends of course).
With the nature of the company being a research-based one, there is usually no rush for datelines and/or bindings to specific tools. It was mentioned a couple of times - datelines are quite relaxed and there is the possibility of thinking "what-if" during the project, instead of "how-to".
I also had to keep on reminding myself that I should set a dateline and goal of what I wanted to achieve each day, so that I do not end up coding until 7pm-ish each day. With a proper goal in mind, I can work towards it with confidence and speed.
Last point regarding work, after a while, the objectives become less clear over time and milestones have to be set. Initially we were supposed to create nicer light effect (with edge blending), then work on the game, which is in progress. But because the "game" mode's details about gameplay etc is not really defined, we sometimes veer off course on what we should develop and research on, moving all the way to cross-detection and what not. As such, I found it useful to have mini milestones, even if it is an individual milestone to work on, so that I know what I am achieving or need to be achieved. Speaking of which, I better check with JL after I do the shape detection on what should the proposed specs be...
Another thing I noticed this week is about human nature (off topic on SIP). On Sunday, I attended a Kayaking race (or Canoing Race, if you prefer) and we had like 150+ participants. With many people being their first time attempting the race (me included), they were unsure of the currents and choppiness of the water out at sea, especially near the coastal edges of Ubin. And well, quite a number of them capsized. Even as participants in the race, my friends and I stopped our crafts and helped them back onto their kayaks, even though it was not our job to do so. All in the name of good sportsmanship and what not, right?
However, there were plenty of others before us, who just went past them, without even helping them or staying with them till a rescue boat came to help them - especially when they capsized in the middle of the channel, where other motorized boats frequented. Such incidents, which I reflected on, brought me back to Friday's post on the mother with two daughters and the other passengers on the train to the left and right of them. I mean, considering their age, they might perhaps been privileged to sit on those seats. However, after sitting on the seats so long, shouldn't they realize that there is this mother of two, struggling to balance herself while keeping an eye on her two daughters? Although they are that privileged, shouldn't they give their seat up after they have rested like from City Hall to Bedok, to the poor mother, who ultimately resulted to squatting (you can see her in the bottom right of the picture) to ensure that she can balance herself (lower CG) and take care of her two daughters?
What these two incidents have in common is that these other people, when seeing others who obviously needed help of which they had the capabilities and/or resources to do, merely sat there staring at the situation - somewhat being unable to react to it, or too self-centered to do so?
I don't really know. After all, I am in no position to judge or tell them on what they should or rather, shouldn't be doing, or how they should react. Is this a sign of being self-centered, or just conflicting morals and belief in the right of way?
Subscribe to:
Posts (Atom)