Ask Your Question
0

Recompiling OpenCV after modifying src code - CMake GUI

asked 2016-09-04 04:37:57 -0600

Nbb gravatar image

I'd like to edit some functions in OpenCV for my project and I'd like to know if there is a way to make the build a lot quicker ? I know the steps of building opencv from source code is to

1) Configure and generate visual studio project via CMake 2) Open up solution in visual studio and build

Step 2 takes a very long time and is very troublesome especially if I am only doing minor editing to try and test variants of a function. Is there a way to shorten the process ? Is it possible to configure, generate and compile files that have been changed ?

edit retag flag offensive close merge delete

Comments

which module are you trying to edit ? i'm sure, you can restrict it to that module and it's dependancies

berak gravatar imageberak ( 2016-09-04 04:40:51 -0600 )edit
1

Hi thanks ! Id like to edit SLIC superpixels.. have it cluster based on 3D coordinate as well. So it would be a very small edit. Its under the ximgproc module

Nbb gravatar imageNbb ( 2016-09-04 08:54:45 -0600 )edit

^^ yea i remember, it's precedessor had functions to retrieve the cluster centers / colors. that would be a very useful addition !

berak gravatar imageberak ( 2016-09-04 09:25:06 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-09-04 09:19:11 -0600

berak gravatar image

updated 2016-09-04 09:41:27 -0600

  1. have a look at the cmakelists.txt in the module, you want to work on, to figure out the dependancies. in the case of slic (ximgproc), we see (line 3):

    opencv_imgproc opencv_core opencv_highgui opencv_calib3d .

    that's the minimum you have to build now (and ofc. ximgproc itself)

  2. make a new build folder, like "build_slic" (leave your original configuration intact for later)

    cd there and call cmake-gui ... tick off any BUILD_opencv_xxx targets not in the list above(you'll still need 3rdparty things, also probably your testing code needs opencv_imgcodecs) , any TEST, SAMPLES, DOC, EXAMPLES thing

  3. build your minimal .sln from that. you won't have to re-run cmake after the initial run (unless you add new files to the module)

edit flag offensive delete link more

Comments

0: make a new git branch for your changes. commit as often as you can, so you can easily track & revert stale ideas.

berak gravatar imageberak ( 2016-09-04 09:21:45 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-09-04 04:37:57 -0600

Seen: 197 times

Last updated: Sep 04 '16