#include "iclVQ2D.h" #include #include #include #include #include #include using namespace icl; float rnd(float min=0, float max=1){ return (float)((max-min)*drand48())+min; } void getCenter(int i, float &cx, float &cy){ // {{{ open switch(i%10){ case 0: cx = 20; cy = 20; break; case 1: cx = 40; cy = 20; break; case 2: cx = 20; cy = 40; break; case 3: cx = 40; cy = 40; break; case 4: cx = 60; cy = 20; break; case 5: cx = 80; cy = 20; break; case 6: cx = 20; cy = 60; break; case 7: cx = 20; cy = 80; break; case 8: cx = 40; cy = 60; break; default: cx = 80; cy = 80; break; } } // }}} float *createData(int dim, Img8u &image){ // {{{ open float *data = new float[2*dim]; for(int i=0;i minError){ vq.run(++k,steps,minError,errorBuf); } const VQVectorSet ¢ers = vq.centers(); const VQClusterInfo &info = vq.features(); printf("prototypes: \n"); for(int i=0 ; i