# OpenCV\_REbuild\_Problem

**URL:** <https://forum.opencv.org/t/opencv-rebuild-problem/3458>\
**Category:** C++\
**Tags:** build\
**Created:** [May 21, 2021, 7:23am UTC](https://forum.opencv.org/t/opencv-rebuild-problem/3458 "2021-05-21T07:23:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kohila](https://avatars.discourse-cdn.com/v4/letter/k/9fc29f/32.png) [@kohila](https://forum.opencv.org/u/kohila)\
**Post date:** [May 21, 2021, 7:23am UTC](https://forum.opencv.org/t/opencv-rebuild-problem/3458/1 "2021-05-21T07:23:06Z")

</div>

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

```auto
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

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [May 21, 2021, 7:30am UTC](https://forum.opencv.org/t/opencv-rebuild-problem/3458/2 "2021-05-21T07:30:12Z")

</div>

> [@kohila](#):
>
> But its not compiling. Is there any steps to rebuild the opencv.

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

```
make install

```

from the cmdline

---

<div class="post-metadata">

**Author:** ![laurent.berger](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@laurent.berger](https://forum.opencv.org/u/laurent.berger)\
**Post date:** [May 21, 2021, 8:32am UTC](https://forum.opencv.org/t/opencv-rebuild-problem/3458/3 "2021-05-21T08:32:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kohila](https://avatars.discourse-cdn.com/v4/letter/k/9fc29f/32.png) [@kohila](https://forum.opencv.org/u/kohila)\
**Post date:** [May 22, 2021, 5:40am UTC](https://forum.opencv.org/t/opencv-rebuild-problem/3458/4 "2021-05-22T05:40:26Z")

</div>

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

Regards,  
kohila.S

---

<div class="post-metadata">

**Author:** ![kohila](https://avatars.discourse-cdn.com/v4/letter/k/9fc29f/32.png) [@kohila](https://forum.opencv.org/u/kohila)\
**Post date:** [May 24, 2021, 3:26pm UTC](https://forum.opencv.org/t/opencv-rebuild-problem/3458/5 "2021-05-24T15:26:58Z")

</div>

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
