“Head Collector” Head Counter program Overview & Paper

This is a post about image processing based research project. I am creating head counting program using open CV, since it is free library. The hardware I use is Windows Kinect regarding its advantages on various luminosity (explained in older post).

visit-counter-camera-fiilis-l

This project initiated as my internship project at my involvement in Electrical Engineering ITB Indonesia – Instrumentation & Control Dept KMUTT Thailand Research exchange summer 2013, with result in basic fundamental concept of the product. In the following year, summer 2014, I had an opportunity to continue developing this product at Blackberry Innovation Center at ITB Indonesia.

What is Head Counter?

Counter is a program to count number of defined object. it could be various, from human, animal, car, anything. In this program, I count the number of people, specifically its head. The objective is to count the number of people passing through an area. If the area is non-open area or limited such as door, gate, or gateway, it could be used for various use. For example, counting total flow, counting hourly flow, determining number of people in a closed room and building, etc.

images

What is the data source/sensor?

I use Windows Kinect, and the output is depth image. Depth image is actually an image (2D) with additional value in the 3rd dimension. For example, 3D diagram, coin, or relief in a stone.

What are the steps?

1. Head Detection : Detect the head on an image as an object

2. Tracking : detect which-object-in-last-frame is the same object in frame now

3. Finishing : Counting and defining whether the head has pass the defined area.

 

Part 1 : Head Detection

This is the foundation of the program, the image processing part. There are some ways to extract an object from an image such as mean shift, background subtraction, etc. In this project it is bit different since I do not use normal image but Depth Image.

DS1_32DS1_0

In this Setting, the camera is positioned in ceiling facing the ground. The taller object respective to its surrounding is a candidate for a head. To find those candidates in a depth image, I use Quick Shift algorithm. After collecting those candidates, we apply a criteria to define a head.

The result is an object(s) that match the criteria of the head.

Detailed version of my Head Detection algorithm can be read in my paper : Here

Working with Kinect : Installing OpenNI & Sensorkinect (Drivers)

It was on mid 2010, I just entered college, I know there is a new human-computer interaction device will come in to the market. At that time, I was following a professor/lecturer from Carnegie Mellon University named Johny Chung Lee and his Wii Projects. I had the joy working with Wii, doing his DIY tutorial and present it on a class afterwards. That leads me to read his blog, and he was talking about “Project Natal XBOX360”.

I thought it was just a rebranding program of XBOX. Then I realized he is no ordinary man, but a Human Computer Interaction expert from CMU. That was the first time I got amazed by a Kinect

On mid 2013 when I was on my internship, my supervisor gave me a project using Kinect for Windows. I need to create head detection algorithm using Kinect depth image.

OK, that was my experience with Kinect, so here it goes the real deal : How to prepare your PC to be able to work with Kinect. Basically it’s :

Hardware:

  1. Kinect Sensor ($100)
Kinect original
  1. Adapter and Power supply ($10) to connect the Kinect to your PC using USB port (Kinect’s USB port is different though)
Kinect USB & Power Adapter

Or you can use Kinect for Windows but it will be a lot pricier than that (around $200+)

Kinect for Windows

Software:

So you might be wondering what’s the difference about Primesense (you might have heard of it), OpenNI, Kinect SDK, NITE, OpenCV etc. Here is the explanation :

  • Kinect SDK : Standard development kit developed by windows. Highly compatible if you are using Kinect for Windows (that $200+ device). Windows said that they make this SDK for Kinect for windows, but you actually still could use it for standard Kinect.
  • OpenNI : OpenNI is a free SDK developed by a company named PrimeSense. This SDK supports Kinect & Kinect for windows, also a Kinect-like camera developed by Asus named Xtion. The big deal is most of the developer and tutorials outside there are using OpenNI. My suggestion is keep sticking with it.
  • PrimeSense : an Israeli company in human computer interaction. OpenNI is the main product, but the bad news is it was acquired by Apple Computer on November 2013. The good news is the open source will never die! An organization called structure.io provides new version of OpenNI.
  • NITE : a library of Kinect if you want to use body gesture.
  • OpenCV : Free image processing library for C++ and Python

So, this time we will install the basic here : OpenNI, Sensor Kinect, OpenNI Modules, and NITE

OpenNI

The bad news is the creator of OpenNI, PrimeSense was bought by Apple on last quarter of 2013, so they don’t provide the OpenNI service anymore. Worry not, there is another organization taking care of OpenNI. You can download OpenNI 2 in http://structure.io/openni or you can download OpenNI version 1 which I am using (32 bit Windows), through my dropbox link in https://www.dropbox.com/s/cvtqvkjjw31k6gg/OpenNI-Win32-1.5.4.0-Dev1.zip

SensorKinect

Go to https://github.com/avin2/SensorKinect  , download the zip file and extract it.  Navigate to the Binfolder , find SensorKinect093-Bin-Win32-v5.1.2.1.msi  and install it

Sample Program

Download at https://www.dropbox.com/s/pi777kyes4rif9g/OpenNIKinectXML.zip

Testing Installation

Use OpenNI\Samples\Bin\Release  and openNIViewer, here is the output :

Kinect Camera Result

That’s all guys, meet me on the Q&A!

What does abroad experience tells you?

I always want to have abroad experience. I did apply for a program back when I was in high school, but I did not get the offer. Then it became one of my goals when I entered college. I have to go abroad. I applied four programs, got accepted in three of them, and took two of them. So I was abroad for approximately seven months. Two months for internship in Bangkok, Thailand, and five months in Singapore as an exchange student. What did I learn from that journey?

  1. Life is not a race.

Yes. This is what I feel just now. My friends are about to graduate while I will stay longer in campus, compensating my time abroad. Dude, it’s freakin’ boring. When your friends are free, you got to do your assignments. When you are free, your friends are dumped with their final projects/thesis. But I remember that one year ago I made a note that I want to buy myself a time. This is what I got. It’s perfect, but I didn’t know that it would be like this. Don’t get me wrong, I feel so glad that I have this experience. Now, I know the true value of a friendship. From now on, I want to be a good friend, and be good to my friend. It’s not legendary if your friends aren’t there to see it, isn’t it Barney?

  1. Look after a family and friends.

When you are outside there abroad, where the people speak a language you don’t understand, you need companies. So look after some friends. Have some conversations. If you are lucky, you might get a family to care about you. This is what I get in Bangkok and Singapore. When I was working as research student in Bangkok, I was lucky to have some great friends in my lab. I won’t make it this far if it wasn’t from their support on me. In that lab, I feel like having new classmates.

From these LAB fellows in Thai
From these LAB fellows in Thai
These gossip gals from around Asia
These gossip gals from around Asia
And the whole gank of TF SCHOLARS NUS 2013. Miss em all :')
And the whole gank of TF SCHOLARS NUS 2013. Miss em all :’)

When I was in Singapore, lot of exchange students there so I felt like became a member of a community. But the main thing is there are 40 of us, so it feels like having new classmates in high school. The best thing is they came from several countries in Asia!

  1. But don’t forget your family back in home

But my mom is still my guidance star. She’s always there to chat me or give me a call. She always there if I need to talk. She never fails to comfort me or put me back on my legs if I don’t feel like having a good day. The rule is you don’t forget friend who have always been there for you when you need it. And your mom is that friend.

Family, Comes first and will always be
Family, Comes first and will always be
  1. And also your pals back in your Uni.

Even if you are not there to witness your old friend having moments of their life, always show that you are there to congratulate them, to send them some messages, or to be your late night coffee partner, even just in online. It’s important to make them now that you’re still their friend. Be thankful for their support which makes you having abroad experience.

friend 4eva!
friend 4eva!
  1. Be friendly with transition

Live somewhere else means you’re about to have transitions in your life. From spiciness of your food, accent of your language, transportation mode, temperature, anything. This is definitely amazing, and will makes your jaw dropped for a while, but it’s a bit tricky. You need to transform right. Don’t let the transition eats you and stress you.

  1. Always have high hope

When you are abroad you will meet amazing persons everywhere. They are the cream of the crop, the top of their competition. Sure they are amazing person in their job, but you will realize that they are just a normal folks that don’t give up with their dream. They dropped a lot, got rejected, being in some hard times, but they just don’t give it up. Their dream is their treasure, and they will keep it until the end of the time. You can learn a lot from them, that if you keep your dream and hold it tight, it will keep you and give yourself a guideance. Be a friend with your own dream.

high hope 1
high hope 1
high hope 2
high hope 2

A friend wants to capture his dream ends up crazy 😀

  1. Be a good friend

Did I mention this already? But this is very important for everyone. Make yourself a good friend, be reachable and talkable to everyone. It doesn’t need a special recipe or a degree from communication science. It needs some effort and humility from yourself to listen and care about the person next to you.

And don’t forget to have fun and try something new! That’s the point of being abroad isn’t it?

Be Happy and Have Fun!
Be Happy and Have Fun!

Bonjour! 

Week 1.1 : exploring your universe // Jelajahi semesta mu!

I’ll write the story in Bahasa first, then i’ll write it in English. Afterall, it was same story.

KMUTT Logo

Salah satu dosen saya, Pak Armein ZR pernah bilang, bahwa semesta kita adalah apa yang bisa kita lihat dan ketahui. Jadi saya memutuskan untuk menjalani kehidupan di bangkok se-bahagia mungkin dan se-menyenangkan mungkin, serta mencoba hal-hal baru untuk memperluas semesta saya. Pengalaman baru.

Salah satu pengalaman baru saya adalah naik pesawat jakarta-bangkok. Saya belum pernah naik pesawat sebelumnya. Sama sekali. Waktu itu saya tiba di Bandara sukarno hatta jam 12 malam, tapi flight jam 7 pagi. Mulai lah, malam gak jelas yang dihabiskan dengan mengamati orang lalu lalang dan membaca novel ‘Hafalan Shalat Delisa’. Novelnya sangat-sangat sedih dan sangat-sangat bagus. Saya merekomendasikan banyak anak muda dan manusia yang kehilangan makna hidup untuk baca novel ini.

Pengalaman lain adalah berteman dengan orang Thailand. Karena keramahannya, saya banyak bicara ke orang-orang ini. Teman pertama saya dan Fauzan (saya ke bangkok dengan M Fauzan, EL ITB 2010) adalah Tik & Song.

Song, taken from Fb
Tik, taken from Fb

Mereka berdua adalah graduate student di KMUTT. Tik adalah pemudi dengan kemampuan komunikasi yang mumpuni. Bahasa Inggrisnya lancar, dan dia juga bisa menguasai pembicaraan. Song adalah gadis dengan penampilan modis dan fashionable. Kalau tertawa manis sekali.

Selain itu, kami di sini dipandu oleh mahasiswa 2011 bernama Aun. Pemuda satu ini lugu dan pekerjakeras. Dia selalu bawa catatan tentang apa yang harus dia kerjakan. Dia bekerja selama liburan untuk menambah uang. Hebat. Kami juga kenalan dengan mahasiswa manis yang duduk di kantin. Namanya Pat. Dia memakai kerudung, seorang muslim. Ternyata Pat adalah mahasiswa S1 dengan usia 3.5 tahun lebih tua dari Fauzan :p . Tapi dia maniiis banget dah.  Dia juga kenalin kita ke temannya namanya Sa (Za?). Mereka satu kelas. Sa ini kelihatannya sangat gaul dan easy going.

Sa, No pic?
Pat- Very kind-hearted engineer

Selain itu ada teman-teman Indonesia (belum sempat ketemu), orang-orang international office yang sangat baik dan menawarkan program bersama mahasiswa korea (yeay!). Terimakasih kepada Bu Sasima, Pak Anak, yang dulu ke ITB dan masih kenal saya. Dan kepada dosen-dosen yang sangat gaul seperti Mr Poj, dan baik seperti Mr Phakkorn. Udah aah!

—————————————

One of my Lecturer at ITB, Mr Armein ZR, told us that our universe is the things that we could see and we could know. So, I decide to enjoy my life, being impulsive, and live my life at bangkok to the fullest, and try something i never been tried. All of those thing are in purpose to expand my universe. New experiences.

So, one of my universe expanded by travel by plane from jakarta to bangkok at 3rd or june 2013. I’ve been arrived at airport at 00 AM but my flight was in 7.00 AM. This events starts my random night in the jakarta airport, that i spent it read a novel called “Delisa’s shalat reads(?)”. Very very good and very touching novel. I recommend this novel to everyone. Any people and any religion.To the youth and to the people that feel emptiness of his/her life.

Another Experiences was to met with Thai People, espescially KMUTT folks. Since they are very kind, I talk much to these persons. Me & Fauzans first friend is Tik & Song. They are graduate students at our departements. Tik have very good communication skill, good english, and she’s kind of talk & joke all day very much. You will love to joke around with her. Song is a girl with very up to date fashion and good fashion instinct. And She has very lovely nice smile. I mean incredible. Thumbs up!

Besides them, we have Aun to jelp us to deal with student registration stuff. This boy is very hardworker. He use to bring his little agenda, writing his tasks there. He work at summer to make extra money. Great job Buddy! We also make friends with thailand muslim student called Pat. Pat was in cafetaria, and I go to talk to her, spontaniously. She’s using Hijab. Pat is a final year student, she is 24. She is veeeeery damn cute and has sweet smile. She also introduce us to her friend, Sa. Sa (or Za) is very cool girl. I dont know why I always thinking that Sa would be a good Rockstar Singer 😀 . Sa is very easy going. They are classmate.

Other than that, there are indonesian people (whis is we didn’t meet them yet), International Office people which is veeery nice. They even offer us to join a program with korean student in july and free tours. And thank you to Mrs Sasima and Mr Anak, that still remember me. We have met in ITB. And there are very kind and cool lecturers like Mr Phakkorn and Mr Poj. Thats all for today!!

Akhirnya! Jadi beli waktu!! // At Last, I bought some times for myself!

I’ll write in bahasa first, then i’ll write in english. afterall, it’s the same story.

Akhirnya saya jadi beli hadiah buat diri sendiri, hadiah paling besar seumur hidupku! Saya bakal pergi dari rutinitas selama 7-8 bulan! Saya bakal menunda kuliah selama 1 semester (atau 1 tahun, belum memutuskan). Saya bakalan hidup di bangkok selama 2 bulan, di singapura selama 4,5 bulan, dan di depok selama 1 bulan. semoga jadi ke eropa atau ke australia selama 4 bulan sisanya..

Saya dapet program internship di King Mongkut University of Technology Thonbury (KMUTT) Bangmod, south Bangkok. Saya  sudah 2 hari berada di kampus ini, dan akan ada di sini sampai akhir juli. Kampus yang sangat indah kalau menurut saya. Poin utamanya adalah masyarakat yang ramah. Kentara banget kalo masyarakat di sini itu ramah dan sopan. Semuanya senyum.

Jadi saya akan menulis sekitar 2 kali seminggu. tidak panjang-panjang, mungkin 3-4 paragraf. Supaya saya santai dan teman-teman yang baca juga santai. Selamat berpetualang!

——————-

At last, i bought myself ‘times’ to enjoy my life, biggest deal of my life! I’ll throw away my routines and travel the world for at least 7-8 months! I’ll postpone my undergraduate study in ITB for 1 semester (or 2, haven’t decide it yet) . I’ll be live in bangkok for 2 months, in singapore for four and half months, and in depok, Jakarta for another 1 month. I hope I could travel europe or australia in another 4 months.

So I get an internship in King Mongkut University of Technology Thonbury (KMUTT) Bangmod, South of Bangkok. I’ve been here for 2 days, and will be here until the end of july. Very lovely campus. My point is, everybody is nice. You’ll be noticing that everyone is polite, nice, and charming. Everybody is smiling :).

So, I’ll be in my blog twice a week. Not to write something very long and difficult, maybe just 3-4 paragraphs of interesting events in my journey. I want to make myself enjoy writing this blog, and also want to make everyone that reading this blog enjoy my story.

So, Happy traveling, have a great adventures!