Pergunta

I am using OpenCV with Visual Studio 2013 (and Vis Assist X) and want to find the .cpp file in which a class is implemented. A recent example is the constructor of BackgroundSubtractorMOG, because i wanted to check the default arguments.

I have compiled OpenCV 2.4.8 on my machine and i am able to locate the header file in which the class BackgroundSubtractorMOG is defined via right click on the class name and "go to definition"/F12. (it's in background_segm.hpp).

How can i find the .cpp file which implements the constructor?

I solved this specific problem by locating the .hpp file in

[...]\OpenCV-2.4.8\sources\modules\video\include\opencv2\video

and searched in all .cpp files from:

[...]\OpenCV-2.4.8\sources\modules\video\src\

For BackgroundSubtractorMOG, but I suspect there is a faster way that I am not aware of.

ps: If this Question is a duplicate, please let me know. I wasn't able to find something.

Foi útil?

Solução 2

From Berak:

use the debugger, just set a breakpoint, and let it run there

Outras dicas

I'm not 100% sure of how c++ works internally, but I think this might be the reason :-

OpenCV header files contain all the class declerations, but the actual function definitions are in external libraries (.lib, .dll, .so) files. The source is available on github, and if you cloned the repo or downloaded the source and built OpenCV manually, it should be with you.

I think this is what you're looking for - https://github.com/Itseez/opencv/blob/master/modules/legacy/src/bgfg_common.cpp

The modules folder contains the source of all of OpenCV so if it's not there, I would say it ain't anywhere else.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top