OpenCV_REbuild_Problem

Dear All,

I wanted to rebuild the opencv_opensource. I just commented ROI resize function in trackerKCF.cpp file and compiled using the below cmake command

cmake -D CMAKE_BUILD_TYPE=RELEASE \    -D CMAKE_INSTALL_PREFIX=/usr/local \    -D INSTALL_C_EXAMPLES=ON \    -D INSTALL_PYTHON_EXAMPLES=OFF \    -D OPENCV_GENERATE_PKGCONFIG=ON \    -D OPENCV_EXTRA_MODULES_PATH=~/opencv_build/opencv_contrib/modules \    -D BUILD_EXAMPLES=ON ..

But its not compiling. Is there any steps to rebuild the opencv. Please suggest me.

Thanks&Regards,
kohila.S

cmake does not compile anything, it generates makefiles/projects. you need to run:

make install

from the cmdline

@berak
does cmake --build . --config release compile and link on linux (using selected compiler)?

1 Like

Thank you so much berak for your reply. Let me check .

Regards,
kohila.S

Hi berak,

As per your suggestion, i tried the following steps. But not able to see the output of library which regenerated.

Step 1:
commented the detection part from trackerKCF.cpp as below:

Mat img;
// resize the image whenever needed
if (resizeImage)
resize(image, img, Size(image.cols()/2, image.rows()/2), 0, 0, INTER_LINEAR_EXACT);
else
image.copyTo(img);

// detection part

/ if(frame>0){*

** // extract and pre-process the patch**
** // get non compressed descriptors**
** for(unsigned i=0;i<descriptors_npca.size()-extractor_npca.size();i++){**
** if(!getSubWindow(img,roi, features_npca[i], img_Patch, descriptors_npca[i]))return false;**
** }**
** //get non-compressed custom descriptors**
** for(unsigned i=0,j=(unsigned)(descriptors_npca.size()-extractor_npca.size());i<extractor_npca.size();i++,j++){**
** if(!getSubWindow(img,roi, features_npca[j], extractor_npca[i]))return false;**
** }**
** if(features_npca.size()>0)merge(features_npca,X[1]);**

** // get compressed descriptors**
** for(unsigned i=0;i<descriptors_pca.size()-extractor_pca.size();i++){**
** if(!getSubWindow(img,roi, features_pca[i], img_Patch, descriptors_pca[i]))return false;**
** }**
** //get compressed custom descriptors**
** for(unsigned i=0,j=(unsigned)(descriptors_pca.size()-extractor_pca.size());i<extractor_pca.size();i++,j++){**
** if(!getSubWindow(img,roi, features_pca[j], extractor_pca[i]))return false;**
** }**
** if(features_pca.size()>0)merge(features_pca,X[0]);**

** //compress the features and the KRSL model**
** if(params.desc_pca !=0){**
** compress(proj_mtx,X[0],X[0],data_temp,compress_data);**
** compress(proj_mtx,Z[0],Zc[0],data_temp,compress_data);**
** }**

** // copy the compressed KRLS model**
** Zc[1] = Z[1];**

** // merge all features**
** if(features_npca.size()==0){**
** x = X[0];**
** z = Zc[0];**
** }else if(features_pca.size()==0){**
** x = X[1];**
** z = Z[1];**
** }else{**
** merge(X,2,x);**
** merge(Zc,2,z);**
** }**

** //compute the gaussian kernel**
** denseGaussKernel(params.sigma,x,z,k,layers,vxf,vyf,vxyf,xy_data,xyf_data);**

** // compute the fourier transform of the kernel**
** fft2(k,kf);**
** if(frame==1)spec2=Mat_(kf.rows, kf.cols);**

** // calculate filter response**
** if(params.split_coeff)**
** calcResponse(alphaf,alphaf_den,kf,response, spec, spec2);**
** else**
** calcResponse(alphaf,kf,response, spec);**

** // extract the maximum response**
** minMaxLoc( response, &minVal, &maxVal, &minLoc, &maxLoc );**
** if (maxVal < params.detect_thresh)**
** {**
** return false;**
** }**
** roi.x+=(maxLoc.x-roi.width/2+1);**
** roi.y+=(maxLoc.y-roi.height/2+1);**
** }*/**

Step 2:
generated binaries using make install

Step 3:
running the sample program which is having KCF tracker

Expected output:
Suppose tracking should not happen using KCF tracker . Because we have commented the detection part.

Current Output:
But tracking is happening .

Issue:
How can i confirm the changes are getting affected in opencv . Is make install enough to rebuild the opencv opensource effectively?

Please help me to come out of rebuild issue .
Thanks in Advance,
Kohila.S