Ask Your Question
0

Codebook algorithm

asked 2014-04-27 05:37:46 -0600

andrei.toader gravatar image

updated 2014-04-27 13:44:54 -0600

Hi all,

Can someone explain me in detail how the codebook algorithm works?
I read about how it works but I am a bit confused about the entire process starting from how is a codeword defined and how codebooks are computed. So far I have read a part from the book Learning OpenCV(Oreilly) and from the following paper:
Real-time foreground–background segmentation using codebook model

Thanks in advance, Andrei

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
1

answered 2014-04-27 14:42:42 -0600

pheips gravatar image

updated 2014-04-27 14:49:04 -0600

First of all, there are several names for codebooks, so maybe you've heard from them in another context: visual vocabularies, bag of visual words, textons... The Wiki site on the bag of words principle is pretty informative I would say. You should check it out: http://en.wikipedia.org/wiki/Bag-of-words_model_in_computer_vision

But the basic idea is rather simple and inspired by text classification tasks. Consider a text classification problem. Typically one would count the number of occurences of certain words to classify a text. E.g. if a text consists of a various number of words like 'price', 'credit card' and so on, one might guess this Mail is some sort of financial text. So depending on the task, some words are counted and some are not, e.g. 'and', 'he' and so on are not helpful to recognize some sort of financial text, while 'price' and 'credit-card' are. Thus the latter words would be part of the Codebook (or vocabulary). Such a codebook is then used to describe an entire text by counting the occurences of every codebook-word in the text, resulting in a so called word frequency histogram.

For an image/object classification task (or even segmentation) this principle is also used, but instead of words we need to obtain so called 'visual words'. This is typcícally achieved by collecting a lot of feature descriptors from images and clustering them. The resulting cluster centers are then your codebook.

How is a codeword defined? - typically as a cluster center of feature descriptors

How are codebooks computed? - typically with some sort of clustering algorithm (e.g. KMeans)

edit flag offensive delete link more

Comments

Thanks a lot. I understood meanwhile by taking a few examples on paper. Though, I am not sure we are talking about the same idea, because I don't mean bag of words/visual words but background subtraction using codebook.

andrei.toader gravatar imageandrei.toader ( 2014-04-27 16:41:15 -0600 )edit
1

I just had a quick look at the paper on background substraction and it seems to me their codebooks are defined and built just as for a bag of words but just used in another context. Background substraction can be seen as a classification task on pixels. Deciding for each pixel if it is of class background or foreground. Their features are simply the pixels color values and they build codebooks for each pixel position seperately. They don't use KMeans but some other clustering mechanism, but the idea is the same as for any codebook generation.

pheips gravatar imagepheips ( 2014-04-28 00:23:00 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2014-04-27 05:37:46 -0600

Seen: 4,603 times

Last updated: Apr 27 '14