Ask Your Question
1

How can I use hierarchicalClustering?

asked 2013-07-30 16:27:48 -0500

I use this code:

int c_count =cv::flann::hierarchicalClustering<L2<float>  >(data,cluster,kmeans_param);

I got this error:

 error C2146: syntax error : missing ';' before identifier 'ElementType'

How can I solve it?

My features is 3d (x,y,theta) that I want to cluster these. when the classification was done.How can I access to cluster id for each feature?

edit retag flag offensive close merge delete

Comments

The second post is not related to first post.The current post correspond to code & other post correspond to comparison of the algorithms. Please respect the right of other forum members .Please Open the current post and other post back to previous state.

Mostafa Sataki gravatar imageMostafa Sataki ( 2013-07-31 06:34:20 -0500 )edit

I do not think I didn't respect your right as forum member, I merely merged two topics that handle the exact same topic, being different clustering types. Discussing a technique and then trying to solve problems with using that specific algorithm seems reasonably the same to me. Topics restored like you asked ... will let others deal with it if they have problems.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-07-31 06:43:53 -0500 )edit

Also, guidelines say to update your original topic, when you have find a solution which yields new problems or warnings.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-07-31 06:44:56 -0500 )edit

Thank you.

Mostafa Sataki gravatar imageMostafa Sataki ( 2013-07-31 06:45:44 -0500 )edit

1 answer

Sort by » oldest newest most voted
1

answered 2013-07-31 05:39:31 -0500

updated 2013-07-31 13:34:08 -0500

I solve it by below code.

Mat1f cluster_data(15,3);
cluster_data(0,0) = 1;  cluster_data(0,1) = 1;cluster_data(0,2) = 1;
cluster_data(1,0) = 2;  cluster_data(1,1) = 2;cluster_data(1,2) = 1;
cluster_data(2,0) = 2;  cluster_data(2,1) = 1;cluster_data(2,2) = 1;
cluster_data(3,0) = 1;  cluster_data(3,1) = 1;cluster_data(3,2) = 2;
cluster_data(4,0) = 1;  cluster_data(4,1) = 2;cluster_data(4,2) = 2;


cluster_data(5,0) = 100;    cluster_data(5,1) = 99;cluster_data(5,2) = 98;
cluster_data(6,0) = 101;    cluster_data(6,1) = 100;cluster_data(6,2) = 99;
cluster_data(7,0) = 103;    cluster_data(7,1) = 90;cluster_data(7,2) = 97;
cluster_data(8,0) = 99; cluster_data(8,1) = 98;cluster_data(8,2) = 102;
cluster_data(9,0) = 98; cluster_data(9,1) = 100;cluster_data(9,2) = 102;

cluster_data(10,0) = 1001;  cluster_data(10,1) = 997;cluster_data(10,2) = 996;
cluster_data(11,0) = 1002;  cluster_data(11,1) = 1001;cluster_data(11,2) = 999;
cluster_data(12,0) = 1000;  cluster_data(12,1) = 999;cluster_data(12,2) = 998;
cluster_data(13,0) = 999;   cluster_data(13,1) = 998;cluster_data(13,2) = 1000;
cluster_data(14,0) = 998;   cluster_data(14,1) = 1003;cluster_data(14,2) = 1003;



cvflann::KMeansIndexParams k_params(10, 1000, cvflann::FLANN_CENTERS_KMEANSPP,0.01);

Mat1f centers(10,3);
centers.setTo(0);

int count = cv::flann::hierarchicalClustering<cv::flann::L2<float> >(cluster_data,centers,k_params);
cout << cluster_data << endl;

cout << centers << endl;
edit flag offensive delete link more

Comments

why I got the follow error:

error: ‘hierarchicalClustering’ is not a member of ‘cv::flann’

wandering gravatar imagewandering ( 2016-12-16 06:05:48 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2013-07-30 16:27:48 -0500

Seen: 2,251 times

Last updated: Jul 31 '13