answered 2014-01-10 08:08:04 -0600
Try using the one at sample/c/bgfg_codebook.cpp. It compiles fine for me on Linux
g++ bgfg_codebook.cpp -o bgfg_codebook -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_legacy