Welcome to my blog!


Welcome to my WordPress.com blog.

In this blog I will post news entries, comments and views about research and project, and occasionally more general posts on topics that I find interesting.

Blog entries are aimed at wider audience than the relevant research community. Blog entries regarding research and papers reflects my personal views and should be considered as such. They do not necessarily reflect the views of my co-authors, my employer or anyone else.

The best code is written while strolling in the park …

Long  (over 10 years) before I received my Ph.D. degree (a.k.a “Permanent Head Damage” or  “Poor Hungry Doctor”  by my interns) and thus immediately labeled as “Incapable of writing a single line of code that is not FORTRAN” I have earned my living writing code for quite big rather critical systems.

I worked with different programming languages, some of which I bet you never heard of, I used whatever needed to get the job done including punch cards and compilers that run on tapes, and I wrote a lot of assembly… and a lot of object code — I still remember some of the codes.

Since then the world has changed, punch cards, tapes, computer front panels .. are nowhere to be found, and the simplest smart phone is significantly stronger than any computer I used to work on back then, and it fits in a pocket i.o. taking up a room with
floating floor and air condition that freezes up your everything.

But one thing has not changes. High quality code is not created in-front of any screen.
High quality code is created while talking a walk in the park. That is thinking, and having peace of mind. The rest is merely typing.

It doesn’t sound like much, in fact – it doesn’t sound deep at all. But how many people really take the time to think peacefully away from their desk about the problem at hand?
It sometimes is a very hard thing to do especially when you are stressed and when the project is already late.

Try this – next time you need to write a program, just think about the problem you are about to solve for several hours, a day, two days, or even an entire week  away from your desk  (either in the park – or any place that gives you peace of mind) before you sit to write the first line of code (must be the first, after that you may already be committed to a wrong path).

It may be difficult to explain to your supervisor why you need to take a walk in the park, all by yourself  exactly at the most stressful time of the project. But one thing is sure – thinking for two days before writing the first line of code will not slow you down.  What will slow you down tremendously  is writing a not-well-thought-of-code in two days — and then “debug” it for two weeks. And after that continue to debug it for three additional months, or a year,  because you already put a lot if effort in it and you are “that close to get it done”…  before you realize it was fundamentally flawed from the start.

AS an exercise try this:
I put in this page:

Fibonacci code — It is JUST Fibonacci running on Linux, nothing special about it. Perhaps the oldest CS exercise in the book, and now see if you can write a smaller / faster code while thinking and coding on the fly at your desk.

I didn’t, and couldn’t write at my desk without taking some quite time to thing first.

Note though that I do not think that this code is the smallest / fastest possible, in fact I know it is not, but I believe it is sufficient to make the point.

Thank you for reading, please let me know what you think 🙂



The red bird has landed …

Apollo Guidance Computer and DSKY

Apollo Guidance Computer and DSKY

This is it.  That is all — A 16bit word computer (15 data + 1 parity), 2K Words magnetic core memory (RAM). 36K Words core rope memory (ROM).  4 Registers, including the program counter. All running at 2.048 MHz.

This computer controlled:

  1. DSKY – Display and Keyboard, shown in the image.
  2. Inertial  Measurement Unit (IMU)
  3. Hand Controller
  4. Rendezvous Radar
  5. Landing Radar
  6. Telemetry receiver
  7. Engine Command
  8. Reaction Control system
Simply put, on 20 July 1969 this unit was used to put a man on the moon during an approximately 3 days trip.

Today’s  iPhone 4S has 2 CPU cores, each running at 1GHz, + a GPU. It has 512 MB RAM + 64GB storage (flash). By a very rough comparison it is about x1000 times faster, has x128K times more RAM, and much more non-volatile storage.

And what is this awesome power used for?

In most cases, well… this:

On March 22, 2012 angry bird space was researched – in just 35 days iPhone4S units, and similar devices, have “launched” over 50 million copies of angry birds into (virtual) space…

The final cost of project Apollo  (1961-1972)  reported to congress as $25.4 billion in 1973, (Given the unknowns, James Webb gave an amazingly close estimate of @20 billion). This amount is  approximately $134 billion in  2013, or $11.2 billion annually. 

This is no small money. And yet the  annual revenue of Apple, the iPhone maker, is $169.4 billion, more than the entire Apollo program, the annual net profit is much less of course, “only” $37.7 billion – still over 3 times the annual cost of the Apollo program.

Was the Apollo program a bigger “leap to mankind” than the smartphone is? This I cannot answer – Personally I think that we don’t have a choice but to go to space much sooner than the the time sun will become a red giant or when a future captain Kirk starts exploring the galaxy – but for much more down-to-earth reason such as energy and minerals.   Other people have different opinions and sometimes very strong emotions as well on matters that involves big government spending.

Here are few points to think about:

The Emergency Economic Stabilization Act of 2008 a.k.a the bailout of the US financial system authorized the US treasury to spend $700 billions to buy mostly mortgage-backed security (toxic assets) – this is over five times the entire cost of the Apollo program.

Apple employs 72,800 direct full-time employees, and unknown number of people employed indirectly (many of them outside the US).  The Apollo program had 34,000 direct employees and 375,000 indirect employees in industry and universities in the US. The Apollo program also had direct positive impact on many industries.

Today universities have centers, faculty members, and undergraduate programs detected to computer games – such as Angry Bird. Computer games are a big business and there is serious research on the topic, from psychology to mathematics and technology.

Last but not least, I cannot imagine the courage it takes to sit at the top of a Saturn-V rocket that is about to  launch into space. In particular Apollo 8 crew,  Borman,
Lovell, and  Anders that were the first to leave earth orbit and orbit the moon, and of course Apollo 11 crew, Armstrong, Aldrin and Collins.  Not many are aware of the fact that the engine on the lunar module that takes the astronauts back to the command module orbiting the moon – could not be tested before the flight because of the corrosive fuel…

Apollo-8 launch live ABC broadcast:

More resources:

Hybrid Imaging 8 Years After

The hybrid camera project started at 2002 at Columbia University CAVE lab after I have noticed just how many of my images taken by my new Nikon CoolPix 995 came out blurred by motion blur.

This was definitely not the first attempt to deblur morion blur images, in fact INSPEC listed over 400 papers aiming at blind deblurring of motion blur images. Since the problem is very ill-posed, some assumptions were needed, usually some assumption about the type of the motion was taken – from linear and constrained speed motion to more complex model such as harmonic motion.

Unfortunately, these assumptions did not fit well the motion of a hand-held camera, which is cause by hand movement – in particularly during pressing the shutter release button.

This work was focused on measuring the camera motion during image capture, and it did it by utilizing a secondary video camera (see paper for detail). It is the first method that was able to compute the PSF and deblur images resulting from a relatively very long and complex motion path.

However, The deblurring algorithm itself (RL-deconvolution) was not very strong allowing for shift-invariant motion only (although the hybrid camera did compute rotation as well) and resulting with many ringing artifacts.

Later on, through the work of Fergus et at. and Levin at al and others, blind deblurring was greatly improved by replacing the assumptions about the motion path with statistical priors on natural images. Moreover, these methods results with much better deblurring nearly canceling all deblurring artifacts, and even enable deblurring of slightly mixed signals at occluded boundaries.  Flutter shutter photography by Raskar at al. can further improve the deblurring result by better conditioning the system by controlling the exposure pattern.

To date, hybrid imaging framework is still the best methods for measuring arbitrarily long and and complex motion path (and compute the resulting PSF). It can measures the PSF for each image during image capture, and when a single lens system is used (see paper) – it allows free change of lenses and zoom setting without needing to calibrate the system to the new settings.

A combination of hybrid camera, flutter shutter and prior based deblurring  should prove to be a very robust system for motion debluring including shift variant blur, and to some extent also deblurring of moving objects.

The work was cited over 200 time (average of 25+ citation a year) and appeared in the recent (2010/11) Eurographics State Of the Art (STAR) review on Computation Plenoptic Imaging. Hybrid cameras were also built and successfully used by other researcher.