Ask Your Question
0

class algorithm

asked 2014-07-07 03:55:25 -0600

Urmi gravatar image

updated 2014-07-07 04:02:58 -0600

I want to get the list of algorithms available. My code is

 std::vector<cv::String> algorithms;
  cv::Algorithm::getList(algorithms);
  cout << "Algorithms: " << (int)algorithms.size() << endl;
  for (int i = 0; i<(int)algorithms.size(); i++) {
    cout << algorithms[i] << endl;

But when I run it getting zero algorithm. Help apppreciated.

edit retag flag offensive close merge delete

Comments

4

you need to include all the headers, and call like :

initModule_ml();  initModule_features2d();    initModule_video();    initModule_contrib();

before your code.

berak gravatar imageberak ( 2014-07-07 04:17:52 -0600 )edit

Just out of curiosity @berak, is there an initialization function for each module or only for those?

StevenPuttemans gravatar imageStevenPuttemans ( 2014-07-07 06:40:01 -0600 )edit
1

there should be a function for each module, that exposes Algorithms (not all modules do)

btw, forgot initModule_nonfree();

berak gravatar imageberak ( 2014-07-07 09:04:00 -0600 )edit

not that it made the purpose of the functions more clear now but hey... so this gets called for us inside the headers?

StevenPuttemans gravatar imageStevenPuttemans ( 2014-07-07 09:18:04 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-07-07 06:38:40 -0600

I just tried the solution of @berak and his solutions does seem to work. The result can be seen below:

image description

edit flag offensive delete link more

Comments

Why do I get no results when I type initModule_video in the documentation search box? Both for 2.4.9 and 3.0.0?

Witek gravatar imageWitek ( 2014-07-07 06:47:03 -0600 )edit

I have here 2.4.9 stable branch and it still works. As for 3.0.0 I am guessing that has something to do with the change of the module structure, so wouldn't depend on that. What is your system configuration? As to not finding any info on the documentation, that is because it is an internal OpenCV function which isn't explicitly needed as such to work with openCV functionality. Didn't know that it existed either.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-07-07 07:02:48 -0600 )edit

I was referring only to the documentation, I have not tried to run it. I was just curious what the init functions do and when I should call them.

Witek gravatar imageWitek ( 2014-07-07 08:43:24 -0600 )edit

Well I just tried out @berak his solution. No idea where he got the idea :P I have the idea that many internal functions are not reported in documentation.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-07-07 08:53:43 -0600 )edit

I guess this link tells us a bit more. It basically ensures that your current program knows of the existing ML objects and fields.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-07-07 08:55:14 -0600 )edit

Question Tools

Stats

Asked: 2014-07-07 03:55:25 -0600

Seen: 314 times

Last updated: Jul 07 '14