Monday, October 29, 2007

Week 2 (29 Oct - 2 Nov)

Monday, 29 October 2007

Finally, we are down to work. We started the day with Requirements Gathering for the project. Kevin, CT, JL and I pooled our brain power together to think about what system requirements are there for the project. There were many interesting suggestions and potential problems were brought up. Debating and possible solutions were thrown in and we finally narrowed down the tentative specificiations for now.

After lunch at NUS, CT and I were tasked to do image processing from a camera with consideration to light luminance tolerance. Making use of the OpenCV library, CT had already done a mock up and I reviewed his code for the rest of the afternoon. I realised that it is possible to write single if-else statements (argc == 2 ? argv[1][0] - '0' : 0 ).

Apart from that, I also recapped CT's lesson on colour channels and bit depth of each channel. And how to iterate through the rows and columns of the picture (in a way, pixiels) by adding bytes and channels to the initial starting value of the Image structure.

And my favourite site for today:
http://www.cprogramming.com/

And this is what the COVE stands for:


Somehow, I feel like I have seen this before in my dreams..




Tuesday, 30 October 2007

The code analyzing continued today. I had to manually walk through each step of the code to clarify my doubts and understandings on just less than 20 lines of code. I also implemented the idea on using the same image as the input for the output against a dark background within a certain threshold.

Not bad for a day's work I must say. But the program is still suspectable to memory leaks and Segmentation Faults. Hopefully I will be able to solve these two problems before I have to leave for school tomorrow. And that dynamic threshold thingy too. But won't the light pixels get affected by the dynamic threshold too? Questions aplenty, but answers only tomorrow, I shall sleep away the wait.

We also found out the reason on why the computer has only one dual output graphics card. But the dog and pony shows are interesting nonetheless.

And hopefully the .jp servers are up and running on my ride to school :)


Blogger Discovery
Btw, I realized that in compose mode, if there are any angular brackets, they are mistaken as tags. I had written 'less than sign' 20, but it got mistaken as a tag and my entry went missing.




Wednesday, 31 October 2007

Got to work right on time today. Since I had to take 1/2 day off to go back to TP to talk about the MSP program to the top 20% of junior year, I thought I'll be extra hardworking.

I got in and immediately started work on the dynamic threshold. Managed to implement a working prototype but the camera was constantly out of focused. Fearing that I've destroyed the iSight, CT came to my rescue and proved that it was more of the coding than the hardware which caused the problem.

Apparently, by using a same pointer to the image to do multiple things, the image got distorted. When I duplicated the image to another pointer, the image sharpened back to normal. Strange huh. I also solved the segmentation error with this change of code. The segmentation error came about when the camera attempted to read/write from/to a nonexistent or protected memory location or attempted to take two screen shots without first clearing the first one. With the duplicate pointer, the segmentation fault disappeared :)

However, the code still suffers from memory leaks. I wonder where the leak is coming from..? Perhaps that is another story to tell on Thursday.



Thursday, 1 November 2007

I came to the office in the morning to a pleasant surprise. CT had already fixed the memory leak problem and the program was working fine. It was able to detect the various light sources and show it up on the screen based on the threshold set.

JL also managed to blend his images together, though there is a bit of a problem - when the images were too bright, darker images were not able to be blended by the camera. Nevertheless, it was really cool to see his blending in action. Next, Kevin asked us to combine our work together. Initially, we had hit a dead end - because we had customized our code so much, it was kind of hard to integrate both pieces of code together without first understanding the algorithm and workings of the other. We decided to break for lunch at NUS for the beautiful view and food. After lunch, we continue to tackle the problem and we finally managed to combine the code, after being encumbered by memory leaks and lacking of pointers.

Though light sources can now be retained on the canvas, we are now looking into improving the algorithm in terms of blending the light together.



Friday, 2 November 2007
Get up, get up morning. Good morning, Keep on Movin'

Just a phrase from a song that got stuck in my head when I woke up. Right now, taking some time during work to blog about yesterday and today. Oh well. Shall update this part a bit later.

Later is actually on Monday of the following week - I'm making the update 3 days late. Oh well.

What can be said about Friday? Hmmz.. We finally realised why the light halos were appearing - the threshold for the light was too low. Increasing the threshold works, but because light conditions may change during actual deployment, I was thinking of having a slider/button and a method to reconfigure the dynamic threshold as and when required. We also tried to play around with some methods to blend the light sources together so that it creates better light blending, but some of the methods made the program run slower though.

Apart from that, we also celebrated Hari Raya and Deepavali at IHPC. Finally getting to see everyone who works in IHPC (about 170). We had a presentation on each of the festivals and some hands on activities related to the festival (such as Ketupat folding). After which, we were treated to some standard catered food and we talked to Kevin and Harold about our views on software piracy and open sourced. The short talk opened my mind to broader perceptions and values over this controversial topic and the advantages vs disadvantages of using either.

With that, we finally ended the day. I stayed back a bit to make some of the blending and threshold work for the project, but was unable to accomplish anything except the realization of the reason behind the light halo.

Lets hope the next week will be more interesting. Oh and hope Kevin gets well really soon :)




Reflection for the Week:

Working with people on new projects is very fun. Especially when everyone on the team is committed and light hearted. This milestone has given me a really good hands on opportunity in coding with C and OpenCV libraries on Linux and Mac OS X. Nevertheless, there is still lots to learn and understand. There are many times where we have to take the initiative to improve on our working prototypes without being told to do so.

After finishing my part on Wednesday and combining the code on Thursday, I was tempted to just stop doing as I have reached the intended end goal. Why bother about some minor flaws when the main functionalities are there? This is typical in some projects where after fulfilling the requirements of a certain grade, I would stop and focus my time on other projects. But I decided not to waste my time at the COVE waiting for time to pass and work to end, but instead to improve on the prototype to make it better.

When working in a new environment, I learnt that there are many things which I had taken for granted back in school (I mentioned this previously). Many times, we have to be extra careful so that we do not offend anyone with our decisions or do things that gives us a bad impression. Also, the familiarity of my teammate's perception of things as well as their proficiencies in development makes me take for granted their skill set.

Nevertheless, I see all of this as part and parcel of a working life - a valuable experience to prepare me better for my future job. In fact, I am already (hopefully) adapting to it.

On a more relaxing mood, check out this really cool meeting room located in Biopolis. Would be cool to have a meeting overlooking the city.



See you next week.

Saturday, October 27, 2007

Week 1 (22 Oct 26 Oct)

Monday, 22 October 2007
Our reporting time was 9am. But we arrived slightly later as we got lost en route. Missing the Shell petrol station which the email indicated for us to look out for (we only noticed it at the end of the day on the way home), we managed to get into IHPC at around 9.20am.

We were introduced to Mr Kevin Veragoo and Cheng Teng, the two other people who are attached to our project. Nothing much can be said about the project I suppose, as a NDA-like document has been signed.

After a tour of the office and being introduced to each member of the AC department, we visited the brain of the network powering IHPC. With computers stacked in racks cooled by powerful air-conditioning, they hummed softly in contrast to their computational intensive processes which ran within them.

Lastly, we were introduced to the COVE, where we will be spending the next 16 weeks there. As well as our two laptops, which were were not in the best condition in terms of capacity and looks, but nevertheless functional. Mr Kevin and Cheng Teng ran through with us the project, refurnishing and being slightly more detailed as Mr Lim's description back in the meeting room.

Being introduced to Fedora was something similar to being back in OPSY labs with Mr. Lai. I believe that he will be pleased to know that I still remember that the "Command Prompt" is referred to as "Terminal" in Linux. :) [But please do not tell him that that is the only thing i remember from his class]

It was like learning how to walk again, learning to ropes of BASH commands and the GUI of Fedora 7. The final machine where the project will be implemented is on a Mac OS X (Tiger) output on 4 projectors on a screen.

We had lunch with the rest of the guys of AC department and the two admin clerks at the food court opposite Ginza plaza with the help of the free lunch shuttle. Modest meal of $2 chicken rice. Oh well.

The rest of the day was spent getting lost in Fedora.




Tuesday, 23 October 2007
We got our own user accounts on the Mac computer. Cheng Teng was kind enough to teach us how to SSH and VNC to the Mac computer. After which, we were informed that for the project, we will be using the OpenCV library, which Cheng Teng also did a mini-lecture about the functionality of the library for us and the rest we had to find out by ourselves. [Even Kevin was a student of CT's lecture, this goes to show that learning never stops] :)


So, left to our own devices, we surfed around the net to download the OpenCV libraries and installed them onto our machines using the ./configure, make and (sudo) make install (and sudo ldconfig for machine wide availability done in root account).

Apart from that, Kevin has also mentioned that while CT and himself were used to doing C programming on simple text editors (these guys are the pros!), we could make use of IDEs which we were more familiar. With that in mind, we downloaded Eclipse CDT version, only to realise that it needed Java JRE to run as well.

In all my life, I have only installed programs via a .exe icon. But that day, I had to install Java's JRE via command line (Terminal). After much fumbling around, I managed to get it installed. (during the rest of my attachment, I realized that what I had just done was an oh-so-simple everyday thing to do in a linux environment.


With IDE and OpenCV, we were challenged to write a simple HelloWorld program in C. Using cut and paste of course! :)

#include <stdio.h>
int main()
{
printf( "Hello World!" );
return 0;
}


But cut and paste aside, this was one of our first programs written in C, a programming language totally not taught in school but used in the industry for its speed and stability.

Some links used today:
http://opencvlibrary.sourceforge.net/InstallGuide_Linux
http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html




Wednesday , 24 October 2007

I still remember Chewy saying this line when I was attached to the MIC:
What better way to learn something than diving deep into it and getting your hands all dirty?

Too true indeed, jumping right into the fray with guns drawn was probably the best way to learn about OpenCV and C Programming (save for the ponytails and backpack in Tomb Raider). Unfortunately, before we could do so, I had cleverly tripped the power of the room, triggering two circuit breakers in the process. Thankfully, the "circuit master" of the place managed to get things back and running in no time and we resumed our progress.

The rest of the day, though short, was rather interesting as we played with OpenCV and a webcam, which I used to take a screen shot of JL, my SIP partner, and myself. :)


Another interesting thing learnt is Mac's MVC model used for its desktop - Closing a window only minimizes it, but the process is still running in the background (similar to minimize button for windows) the program's window will disappear but its process will appear on the dock [task bar equivalent] in the form of an icon). Quitting the application will terminate the task, similar to 'closing' the application in windows.


Homework for today:
Reading about CVS vs SVN

Notes to myself:
/usr/local/include/opencv and /usr/local (place where OpenCV libraries are stored)
/etc/ld.config (file to add in the directory where OpenCV files are)




Thursday, 25 October 2007

Everyday we learn so many new things.

Today, we were given a talk by Kevin about SSH vs Telnet and the differences between them. After which, we were given more time to find out more about CVS and SVN. Kevin brought us to lunch today at NUS followed by a talk today about "The Right to Privacy and Personal Data Protection in Singapore" given by a fellow A*Star employee in the Biomedical side (I believe), which talked a bit about the Odex case, which is of interest to us as IT people. Interesting and educational.

Back at COVE, JL's C program could not seem to run and with Kevin's help, we managed to identify that he was missing some devel (pronounced as "devil", but means developer) tools to compile his codes. We were then introduced to the BASH command "yum install package_name" to download the necessary packages with the help of PBone to define the exact package name.

After which, we played around a little more with SVN and learnt more about KDE and Gnone Windows Manager in Linux and their history on how it evolved.

Homework:
Finding out how the IDE Eclipse created Makefile and compiled C files




Friday, 26 October 2007
A great mystery indeed, about Makefiles. We had deduced that Makefiles were generated dynamically and automatically by the IDE, choosing to distribute its Makefile components into 3 other files which were included into the main Makefile. After much trial and error, as well as analyzing the sub-makefiles, we all (Kevin, JL and myself) managed to create our own Makefiles and port it over to the Mac, but not before CT had already beaten us to it. :)

After lunch, we watched "Pirates of the Silicon Valley" [basically a story about how Bill Gates and Steve Jobs started off their companies]. An interesting watch as it talked in detail about the two men, their perception of things and evolving with changes, and making changes, in the technology sector.

After which, it was back to Fedora land. I Landed myself in a KDE IRC Channel #KDE where people went to chat about KDE problems with technical people there to help baffled users.


Something interesting: I found out that with the ability to stretch the vector-based file icons on the desktop, it will actually show the first few lines of content within the icon (see picture below). Pretty cool huh?






Reflection for the week:

When I look back at the week, it all seems to pass so fast and during this short 5 days, I have learnt so much things, perhaps not as detailed as some of my other modules in school, which are not taught in school.

I can still remember my CVS lab in school, where due to a technical fault in the CVS setup, we were unable to finish the lab. Losing valuable experience in understanding and getting hands on about how CVS worked. But CVS was still covered in the lecture, right?

Many times during the week at IHPC, I had thanked my teachers for teaching a bit here and there about some things, such as Fedora, CVS and Bash Commands (mkdir, rm, ls, etc) which I found very useful. Though by now the knowledge would have been slightly outdated, they were nevertheless still useful in some way. I also found out that somethings that I have learnt during my participations in competitions paid off, such as the use of Eclipse, open libraries and some command line commands (such as ipconfig in linux is /sbin/ifconfig).

On the other hand, I had also wished that I had learnt more during my school semesters - about SSH/Telnet, SVN, C Programming, OpenCV, just to name a few. But as Mr. Yeak has mentioned before, we are not taught about a specific topic in school; we are taught how to learn independently. And in many situations of my friends in other attachments where they are tasked to do things unrelated to what is taught in school, though they complain (we all do, right?) but all of us learn well.

:)

Hacking the Penguin

This is my first post for "Hacking the Penguin"

This blog is to talk a little more about my SIP Experience, since the eSIP system only allows for 200 characters (come on, MP eSIP team).

I believe that there is much more to write than 200 characters :)

So, why "Hacking the Penguin", some might ask.

Its all because during my internsip, I will be developing the project using C Programming on Fedora (Linux based) complete with the MakeFiles and Bash commands. And a few comical errors here and there.