Cooler Master Hyper N520 CPU Cooler

Now this CPU cooler is a real monster ! With all those elaborate copper heat pipes and not one but two fans, it delivers an exceptional cooling  performance.  It has been about two weeks since I installed it into my Desktop with a ~ 3 GHz Intel Pentium 4 processor and since then my CPU temperatures have never crossed 60 ^{\circ}  (even at full load !). This is simply awesome considering the fact that with the earlier stock  Intel fan, the CPU temperatures used to be in the 60^{\circ} -65 ^{\circ} range at zero load ! This thing is going into all my future Desktops for sure ;).


2 days, 20 emails, couple of Skype calls, few games of SC2 and numerous messages later, I sit down to blog about the iPhone4 ON my iPhone4. The 4 hour wait in the lineup at the apple store has been totally worth it. I often ask myself what I would do without my laptop and internet connectivity. I don’t anymore. The past two days of internet outage at my apartment did not affect me at all. Also, I did not find a reason to turn on my laptop except to play SC2. The iPhone4 has already become a part of me 😉

The first thing I noticed about the iPhone4 was how amazing it’s touch interface is. I must confess I have not checked out a lot of touch screen phones, but I can safely say iPhone4’s touch interface would surely be right up there. Another feature I am truly enjoying is the QWERTY keyboard on the iPhone4. I used to have a tortuous time typing, using my previous phone’s (Nokia N95) keypad. Further enhancing my typing experience are the iOS’s features like auto-complete/correct, Copy-Paste (this is the first phone I have used with this capability ! ) and the magnifying glass to accurately move around with the cursor.

The resolution of the iPhone4’s display is just awesome. It definitely does justice to all of your HD videos. Oh by the way, I did not yet talk about the web browser ! Well again a lot of good things to say here too. The seamless zooming in and out of the page feature makes it very easy to browse even the regular (I meant, NOT the mobile version) webpages. I have had no trouble at all opening pages, even with tons of images and java scripts. The only downside with the browser is that,  most of the pages with Adobe Flash content will not open. Well, this is a well known issue, which is due to the ongoing tussle between Apple and Adobe.

The iPhone4 supports Internet tethering which means you can mooch off the 3G internet of your service provider using your laptop. I did this yesterday to play SC2 and it was pretty cool. Finally, the 5 Mp camera makes the iPhone4 simply un-resistable.

I totally approve of the iPhone4.

Scientific temper

The following is the Wikipedia entry for scientific temper:

Scientific temper describes an attitude which involves the application of logic and the avoidance of bias and preconceived notions. Discussion, argument and analysis are vital parts of scientific temper. It is thus necessarily open — admitting every point of view, however heterodox it might be, or where it comes from. Elements of fairness, equality and democracy are built into it.

The above aptly summarizes the attitude any person in the pursuit of science or happiness should necessarily cultivate.  After all, the sole aim of science is to uncover the truth and fact wherein in lies true happiness.

Histogram equalization (part I)

Note:  This post is split into two parts,  the first part provides an introduction to the basics of digital images and it informally states and motivates the task of histogram equalization, in the second part we precisely formulate histogram equalization and then discuss the mathematical details of the solution to histogram equalization .

Since the past few days I have been reading upon the details behind histogram equalization, and must say I found it pretty interesting.  For the uninitiated, histogram equalization is an image processing technique that enhances the contrast of an image. It should be present as a standard feature in your favorite image editing program and I bet most of you would have used it at some point or the other to make those overly “dark” images look relatively “brighter” and vice-versa. So, if you are curious about how exactly this histogram equalization fixes your images, read on.

Before I go any further, here are some basics about images. A digital image is basically a collection of pixels, so if your digital camera is rated as say a 5 Mega Pixel (MP) camera, then your images  can contain a maximum of 5 \times 10^6 = 5000000  pixels.  Of course these pixels are arranged nicely in a rectangular array (matrix), say 2048 \times 2441 for the 5 MP case. We then say that our  5  MP camera has a maximum resolution of 2048 \times 2441.

For the sake of further discussion let us consider a gray color or a “black & white” image of  Lena of  a very modest resolution 256 \times 256  (by the way Lena was a playboy model in the 70’s, see here and her picture is very often used in image processing literature…for obvious reasons I guess 😉 ).  Below, you can see the image of Lena and a schematic of the corresponding rectangular array of  pixels. The numbers (rough values just for illustration, not actual values) in the rectangular array indicate the intensity values recorded at each of the corresponding pixel locations of the image. The range of these intensity values  in an image, in general is \{0,1,\ldots,255\}, where 0 represents a totally dark (black) pixel and 255 represents a totally bright (white) pixel, the values in between represent the intermediate shades of gray. So, the lower numbers in the \{0,1,\ldots,255\}  range represent the darker shades of gray and the higher numbers represent the brighter shades of gray.

A digital image corresponds to a rectangular array of pixels.

Now, if you observe carefully, the intensity values in the above rectangular array do not span the whole \{0,1,\ldots,255\}  range but instead fall in a narrower  \{0,1,\ldots,100\}  range, which represents relatively darker shades of gray. This is explains why the Lena image above looks “dark”.

A standard way to visualize the distribution of shades of gray  in an image is to plot the histogram of the intensity values. Simply put, the histogram is like a bar graph with a bar for each of the possible intensity values (\{0,1,\ldots,255\})  and, the height of each bar is proportional to the number of pixels in the image with that particular intensity value.  The histogram for the Lena image is shown below:

Original Lena image, notice the dark gray shades in the image.

Histogram of the original Lena image, all the peaks exist only in the range 0 to 100.

You can observe that all the “peaks” (non-zero heights) in the above histogram exist only for intensity values less than a 100, which is expected as the Lena image only contains shades of gray in the range \{0,1,\ldots,100\}. Now, let us enhance the contrast of the Lena image using histogram equalization. The resulting contrast enhanced Lena image and the corresponding histogram are shown below:

Contrast enhanced Lena Image, notice the relatively brighter gray shades and subsequently much improved contrast in the image.

Histogram of the contrast enhanced Lena image, notice how the peaks are distributed uniformly over the full range 0 to 255.

We can clearly observe that the contrast enhanced Lena image looks “brighter”  and “nicer” with much better contrast than the original Lena image. Also, the histogram of the contrast enhanced Lena image contains peaks with similar heights, spread uniformly over the full intensity range \{0,1,\ldots,255\}. Based on this, one might postulate that images with a uniform histogram should exhibit good contrast and look “nicer”. This is in fact true and histogram equalization is motivated by this very observation. In histogram equalization, we attempt to transform the histogram of a given image such that it becomes “more” uniform.  So, how do we determine this transformation given an image  in general ? For this, we need to consider a mathematical formulation of the histogram equalization task.

Histogram equalization (part II)

Note: The following discussion assumes the knowledge of basic probability theory.

Initially, we will consider a continuous range of intensity values [0\;255] instead of the discrete set of values \{0,1,\ldots,255\}.  Additionally, we re-map the range of intensity values from [0\;255] to [0\;1]. Further, we define a normalized histogram as a histogram of an image where the heights of the bars are normalized to the range [0\;1], the normalization basically involves division of the number of pixels of each intensity (given by the bar height) by the total number of pixels. Henceforth,  we only consider the normalized histogram of an image and hence refer to the normalized histogram as just the histogram.

Given an image \mathcal{I}, let us consider a continuous random variable R associated with the intensity values in \mathcal{ I}, such that the R has a probability density function (PDF) p(R = r) over the range of intensity values [0 \;1]. We note that the PDF p(r) is simply the continuous version of the (normalized) histogram of the image \mathcal{I}. Now, let us define a transformation \mathbf{T} such that :

\mathbf{T}(r) = \int_{0}^{r} p(w)\;dw

we can see that \mathbf{T}  is basically the corresponding Cumulative Density function (CDF) of the PDF p(r). Now, consider another random variable S on [0\;1] such that s = \mathbf{T}(r). What is the PDF of S  ?

As R and S are related by s = \mathbf{T}(r) we can write the following:

p(R= r)\;dr = p(S = s = \mathbf{T}(r))\;ds

where dr > 0, ds >0 are infinitesimal changes defined over the ranges of the random variables R and S correspondingly. You should convince yourself of the above before reading further.  Also, s = \mathbf{T}(r) \implies ds = \mathbf{T}^{'}(r)\;dr. Substituting this in the above we get:

p(r)\;dr = p(s) \mathbf{T}^{'}(r)\;dr

Differentiating the CDF of R we get:

\mathbf{T}^{'} (r) = p(r) , which is the PDF of R !!, this should not be surprising as the PDF is in fact given by the first derivative of the CDF. Putting this in the above we have:

p(r)\; dr = p(s)\; p(r)\; dr  which implies p(s) = 1 , the uniform PDF !!.  Hence, given a random variable R, a transformation defined by the CDF of R transforms it into a random variable S such that the PDF of S is uniform !! (this in particular I found to be a pretty awesome result 🙂 ). So, in summary given an image \mathcal{I}, we can enhance its contrast by transforming the intensity values in \mathcal{I} using the transformation defined by the CDF of the histogram (which is same as PDF) of  the image \mathcal{I}.

It is pretty straightforward to extend the above result to the discrete domain. Given a discrete range of intensity values \{0,1,\ldots,255\}, we compute the discrete histogram (p_{u} ) of an image \mathcal{I} as:

p_{u} = \frac{n_{u}}{N}u \in \{0,1,\ldots,255\}, where n_u is the number of pixels in the image with an intensity u and N is the total number of pixels.  The discrete CDF transformation is given by :

\mathbf{T}(u) = \sum_{i = 0}^{u} p_{i}, for a given intensity u. So, we replace every pixel with an intensity value u in \mathcal{I} with an intensity value v = \mathbf{T}(u) to obtain the contrast enhanced image.

My Kindle DX

All right ! so it has been about month since I got my new Kindle DX .  I bought the Kindle basically to replace my stack of scientific papers.  Considering the fact that I have not printed a single paper in the past one month (and yeah of course I did read a couple of new papers 🙂 ),  the Kindle seems to be serving me and the environment (not that I care very much :-P) pretty well so far. I thought I would list out the pros and cons from my perspective:

* e-paper display:  This is arguably the best feature of the Kindle. The e-paper display looks amazingly paper like. Virtually no glare and its extremely easy on the eyes. Even though I wish the contrast was a bit better, especially while looking at thin lines in graphs etc… its actually very good in general (click on the above pic for a better view of the e-paper display). I heard released a new version with about 50% improved contrast.

*Native PDF reader:  This is just awesome. I can just dump all those .pdfs onto the Kindle directly without any conversion hassles and start reading immediately ! You CAN search text in .pdfs but you CANNOT annotate.  Further, you can only zoom into .pdf documents by rotating the Kindle (it has an accelorometer built in). The zoom level is fixed at “fit-to-width” option in acroread. (see the zoom-in video here)

*No touchscreen: Yeah 😦 . You can only get around using the 5 navigation keys available. It has a small  QWERTY keyboard to type in text though.

*Page-to-Page navigation: Well the basic page-to-page navigation is a bit slow. So, it is not exactly like flipping pages through a book. This is an inherent limitation of the e-paper technology as it takes sometime to render each page. (see the page-to-page navigation video here)

*No color: Again, a limitation of the current e-paper displays, the Kindle can only show 16 gray levels.

*Free 3G wireless: Yeah, no contract no monthly payment nothing ! To use the wireless, there is a  simple built-in browser which is pretty decent for reading news, blogs etc… and downloading ebooks (you can only download Kindle format or Mobibook format ebooks, for some strange reason it does not allow you to download .pdfs).

*Play Mp3s: I have not tried this feature yet but I guess its a handy thing to have.

*Battery life: The battery life is very good, especially if you turn off the wireless you do need to re-charge atleast for couple of weeks.

*Storage: It has 4G built-in storage,  which is NOT expandable. This is kind of a bummer, but hey I think its good enough if you only put mostly only e-books on it and not mp3s.

*Price:  The base price is currently USD $379 (they slashed the price by USD $110 right after I bought it 😦  ).  The shipping and the custom taxes (yeah apparently they do not have them in Canada yet, have to ship from US) would add an extra USD $80, plus a must have accessory is the Kindle protection case/cover which is USD $55  on (a more patient and prudent person can probably get it for cheaper on e-bay). So, yeah the Kindle DX  is bit of a luxuary item right now :D.

So, in summary Kindle DX is not quite the ideal e-book reading device one could envision, but I would say its about 50% there. As the e-paper technology evolves we can expect features like touch-screen, stylus and color which could then potentially replace the actual paper books and other print materials.

The last question ?

I recently read the famous short story by Issac Asimov (Last Question). Its obviously a very interesting and a thought provoking piece. So, what is this ‘last question’ according to Asimov ? My interpretation was that, the final discovery us humans would ever make, would be about the “size” of the universe. In other words find an answer to ” Is the universe finite ?”. Is infinity just a mathematical concept or is it the ultimate reality ? Can we find an atom (or some speck of matter) for every natural number (1,2,3…) there is ? And synonymously, as asked in the story, Are we eventually going to run out of energy ? Will the entropy of the universe ever stop increasing ?. The story suggests the only way for us to know an answer might be to actually push to the limits. That is to go populate every corner of the universe, drain out all the energy from the suns, the stars etc… . But of course this will take trillions and trillions of years, or will it ? I mean isn`t this exactly the question we are trying to answer, if we knew we could populate the universe in a finite number of years (sure it might be a ridiculously large number, but finite nevertheless) we are done ! The universe is finite. Unfortunately it is not the case, we cannot be sure, just the other day i was watching a TV show about the discovery of a new galaxy, wonder how many more new galaxies are out there to be discovered. So, I guess this truly is the LAST QUESTION then.