Tuesday, January 27, 2009

The meaning of Python rapid prototyping

I was thinking about the usefulness of rapid prototyping to be a quick preview of a program to see if it works for our business, until I used Python for a large scale system development (Maya based crowd simulation). The meaning of rapid prototyping is not only that! During the project I was designing/coding the system as well as making schedules. As you know in a project where multiple people are working on, it's quite common that there are tasks that can be done only after some other task(s) is completed, and if you have made a schedule you'll know for that reason it's difficult to make a schedule. At the last project I often used Python for rapid prototyping to complete a task to make the team working efficiently, not making a member bored by just waiting for his workmate finish a task. We could rewrite the script in c++ for better performance later when there was enough time. If we had been coding only in c++, the project might have been ended up in failure. Python worked so nice.

Just one caution, you need to be careful to make sure the temporary Python codes are rewritten. It tends to be left unmodified because it's working.

Monday, January 26, 2009

Blender Architecture

Looks interesting.

(I haven't read it yet)

Tuesday, January 20, 2009

IQ Test


Sunday, January 18, 2009

Getting XYZ to/from RGB conversion matrix

This page explains how to get RGB to XYZ conversion matrix. It's written in Japanese but you can see equations.
The page is not copiable so I'll just write several comments. It may help you understand it.

You need x and y value of r, g, b, and w(white point).
(xr, yr, zr), (xg, yg, zg), (xb, yb, zb), (xw, yw, zw) are the (x, y, z) value of r, g, b, and w.
z value can be obtained from x and y (See below).

Sr, Sg, Sb are the variables. You can get the conversion matrix by calculating these values.

X, Y, Z indicates a color including intensity
x, y, z indicates a color excluding intensity, which are
x = X / (X + Y + Z)
y = Y / (X + Y + Z)
z = Z / (X + Y + Z)
x + y + z = 1
Same color with different intensity produces the same (x, y, z) value.

So if you know x, y, and Y,
X = x * (X + Y + Z) = x * Y/y

Like the second equation, if you multiply M and

R = |0|
|0| ,

|X| |xrSr xgSg xbSb| |1| |xrSr| |xr|
|Y| = MR = |yrSr ygSg ybSb| |0| = |yrSr| = Sr |yr|
|Z| |zrSr zgSg zbSb| |0| |zrSr| |zr|

The author of the page recommends you to use ITU-T BT.709 if you don't know the exact value of (xr, yr, zr), (xg, yg), (xb, yb), (xw, yw) are the (x, y).

ITU-R BT.709
(xw, yw, xr, yr, xg, yg, xb, yb)=(0.3127, 0.3290, 0.64, 0.33, 0.30, 0.60, 0.15, 0.06)
xW and yW are the ones for D65.

The conversion matrix is shown on the page (eq4).
It is not almighty. If the RGB space is not compatible with ITU-T BT.709, the result will include error.

The white point (xw, yw) for a color templature can be calculated with Plank's law (I don't want to calculate it, anybody knows the answer table?).
By converting RGB to XYZ with a (xw, yw) and converting the XYZ to RGB with another (xw, yw), you can convert RGB value for one color templature to another.

Tuesday, January 13, 2009

A counterintuitive Python specification

I found this story on python-ml-jp mailing list.

>>> None is None is None
>>> (None is None) is None
>>> None is (None is None)
This is not a bug. Python behaves like this since is is not a binary operator.
It's well known that you can write a code like

if a < b < c:
do something
to do something if a is smaller than b and b is smaller than c.
This is because < is a comparison, which is not a binary operator.
It is taken as

if a < b and b < c:
do something
This behavior is documented here.
If it was a binary operator, it would be taken as

if (a < b) < c:
do something
is and in are categorized in tests. Though it doesn't seem to be clearly documented, a test behaves the same way as a comparison.

Friday, January 9, 2009

3D camera

From this page,

Canesta’s electronic perception technology is a patented, low cost, and practical technology that enables machines and electronic devices to "see" by tracking nearby objects in three dimensions in real time. Using EPT, Canesta CMOS chips emit a field of continuous field of infrared light and measure the time it takes for that light to reflect back to the chip – for every pixel. In real-time, the chip processes those distances to create a three dimensional image of the objects in its field of vision.

and this page,

In a recently-granted U.S. patent, Canesta describes several of its inventions for "timing" the travel time of light to a unique, new class of low-cost sensor chips.

Fundamentally, the chips work in a manner similar to radar, where the distance to remote objects is calculated by measuring the time it takes an electronic burst of radio waves to make the round trip from a transmitting antenna to a reflective object (like a metal airplane) and back. In the case of these chips, however, a burst of unobtrusive light is transmitted instead.

Monday, January 5, 2009

Shikine Island

Last automn I went to Shikine island.
I'll show you photos taken with my cool digital camera (aka mobile phone).

Shikine island is in Tokyo prefecture but located far south of the main land. It takes 11 hours by ferry from Tokyo.

Room number on the ferry is 900.

Good enough.

Tokyo tower from the ferry.

Next morning. Still on the ferry. It's another island.

That's Shikine!

Came to the hotel room. Typical Japanese style.

I went to a beach. Unfortunately waves were too big. I went to the island for scuba diving but I couldn't since the condition of one of my shoulders was not good. Now I can't swim either...

I decided to go to a hot spring. Shikine island is famous for hot springs. One of them is at the bottom. I needed to go down.

Natural bathtub (it's nearly a boiling water, don't believe me).

A graffiti carved on a rock wall. It says. "'75 Shigeru(name). A day in youth'. Be careful when you carve something on a wall, somebody will take a picture and put it on the net 30 years in the future :p

High tide water reached here 6 years ago on a typhoon season.

Reached here.

A hole to see the water temperature of the hot spring. Warm inside.

A camp site.

Second day. I went to a beach.

Somewhere in the island.

It was a beautiful beach, and the waves were not big.

My gears. Let's go snorkeling.

About half kinds of the fish I saw was familiar.

Reading a book while drying my wet.

In the evening I went to another hot spring. This place was easier to come. Wearing a swim suit was a must, unlike many Japanese outdoor spas. Lots of locals were here too. I was just hearing their conversations.
"In the world war 2, I was in ..."
"Baseball game result was..."
"McCain was elected president ... Ah no, Obama"
"People in that island are friendly, that island are not ..."
blah blah blah

Another one. This was the best.

The third day. I went to a natural trail.

Looks nice.

Well, a little bit too natural. I needed to avoid disturbing little spidys' cute life by mistakenly breaking their beautiful nests.

Camera t=(0, 0, -0.3) r=(0, 180, 0). Me at origin.

Camera t=(0, 0, 0) r=(90, 0, 0). Spydy at (0, 0.7, 0)

There used to be a seal in the cave.

The trail is getting better. Guess I don't have to be suffered from the nests any more.

Of course it was wrong.

I decided to use a weapon to get rid of those nasty traps set up by little devils.

Finally I walked through the spider trail, oops natural trail. There was still some more time left until the sunset.

A beautiful shellfish shape bay and beach. It's a shame my camera is not good. better photos on google image.

"A seventy year old woman made steps and a hand-made beacon on her own. No ship wrecked since then" written on the rock. Wowgoodstorywhydidnobodyhelpher.

Big work.

The beacon. Climbing up the steps was too much work for me.

A park. I drew a sketch here. I'd rather not show it here, for the rest of my life.





That's all. thanks for reading.

Good bye island.