Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8095747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:14:12+00:00 2026-06-05T21:14:12+00:00

I use the following call to openCV function to perform K-means algorithm: cvKMeans2(points, count,

  • 0

I use the following call to openCV function to perform K-means algorithm:

cvKMeans2(points, count, &clusters, cvTermCriteria( CV_TERMCRIT_EPS+CV_TERMCRIT_ITER, 10, 1.0 ), 1, CV_KMEANS_USE_INITIAL_LABELS, centers);

where

image2 = cvLoadImage( "lab.jpg", 0);
points = cvCreateMat( image2->height, image2->width, CV_32FC1 );    
cvConvert(image2, points);
//count= number of clusters.
CvMat* centers; // To store the center of each cluster. (output).

lab.jpg is an image in CIE L*a*b* format.

But the above line, while compiling, shows the following errors:

`CV_KMEANS_USE_INITIAL_LABELS' undeclared (first use in this function) 

too many arguments to function `cvKMeans2' 

It would be very helpful if someone can point out where am wrong, specially the first error which says KMEANS_USE_INITIAL_LABELS undeclared.

Thanks in advance !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T21:14:15+00:00Added an answer on June 5, 2026 at 9:14 pm

    From the opencv doc for cvKMeans2:

    flags – Can be 0 or CV_KMEANS_USE_INITIAL_LABELS.

    You left out CV_.

    Edit: also note that there should be two arguments between termcrit and flags, so you are skipping either attempts or rng. Try

    cvKMeans2(points, count, &clusters, cvTermCriteria( CV_TERMCRIT_EPS+CV_TERMCRIT_ITER, 10, 1.0 ), 1, 0, CV_KMEANS_USE_INITIAL_LABELS, centers);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use the following the jquery statements to call my php controller function, it
I use the following event to call when the application will close in Internet
If I make the following call in PHP it will use my password and
i am creating simple call filter application which restrict unwanted calls. i use following
The following contents are in a file.i use a shell script to call a
In Oracle, I can use the following: String query = { ? = call
I am trying to use the Python opencv function Moments() on a grayscale image,
I have the following function call: public static MvcHtmlString NavLinks( this HtmlHelper helper, IList<MenuItem>
I am trying to use following queries but the browser says Fatal error: Call
I am begging to use jquery. I have the following call that works in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.