Ask Your Question
0

undefined reference to 'cv::findTransformECC

asked 2020-04-23 12:08:41 -0600

andrei186 gravatar image

updated 2020-04-23 12:21:28 -0600

article "Image Alignment (ECC) in OpenCV" (www.learnopencv.com/image-alignment-e...) Sample code has #include <opencv2 opencv.hpp=""> and uses findTransformECC().</opencv2>

On my Ubuntu 18.04 and OpenCV 3.4 this code would not compile:

undefined reference to 'cv::findTransformECC(....

I guess some library is missing. What else needs to be included other than opencv.hpp and which libraries I need to add to compillation command? At the moment I have

lopencv_core -l opencv_imgcodecs -l opencv_highgui -lopencv_photo -l opencv_videoio -l opencv_imgproc -l opencv_calib3d
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-04-23 14:55:27 -0600

you can refer the documentation of the function and see

#include <opencv2/video/tracking.hpp>

so you need to add opencv_video

edit flag offensive delete link more

Comments

Thank you. Yesterday I googled findTransformECC and this page was not shown on the first two screens. The page shows the need for video/tracking.hpp. How have you deduced from this that opencv_video is needed?

Added the above and now it throws up "cannot find -lopencv_video" In my Installation/OpenCV-3.4/lib/ there are

libopencv_video.so

libopencv_video.so.3.4

libopencv_video.so.3.4.10

Previously I had similar "cannot find" about other libs and solved it by moving .so and .so.3.4 versions to another directory. This time it does not work.

Also previously I managed to install missing library using

 sudo apt-get install libopencv_video-dev

which returns

Unable to locate package libopencv_video-dev

Do I have the packager name wrongly?

andrei186 gravatar imageandrei186 ( 2020-04-24 05:20:03 -0600 )edit
supra56 gravatar imagesupra56 ( 2020-04-24 22:57:13 -0600 )edit

Thank you very much. I downloaded libopencv-video-dev_3.2.0+dfsg-4ubuntu0.1_amd64.deb

sudo dpkg -i libopencv-video-dev_3.2.0+dfsg-4ubuntu0.1_amd64.deb

and it returned

dpkg: dependency problems prevent configuration of libopencv-video-dev:amd64:
libopencv-video-dev:amd64 depends on libopencv-video3.2 (= 3.2.0+dfsg-4ubuntu0.1);  
Package libopencv-video3.2 is not installed.

libopencv-video3.2 asks for libopencv-imgproc3.2 (though opencv_imgproc is installed as I am using it with other cpp files), and several other dependencies. After three iterations I already have to install 7 other dependencies and cannot complete none because each of those seven wants several more dependencies and no end to this recursion.
sudo apt install -f did not help. How get round it?

andrei186 gravatar imageandrei186 ( 2020-04-25 06:07:10 -0600 )edit

also the link you provided, says how to install it:

sudo apt-get install libopencv-video-dev

I understand this is an alternative way without downloading the .deb file. It returns

Unable to locate package libopencv-video-dev

Do I need to add another repository address to my list?

andrei186 gravatar imageandrei186 ( 2020-04-25 06:16:49 -0600 )edit

You're supposed to change Package libopencv-video3.2 . to Package libopencv-video3.4.10

supra56 gravatar imagesupra56 ( 2020-04-25 07:24:45 -0600 )edit

You first do sudo apt-get upgrade. Then do install.

supra56 gravatar imagesupra56 ( 2020-04-25 07:27:24 -0600 )edit

How am I supposed to change to libopencv-video3.4.10 while the link to libopencv_video.so.3.4.10 you provided says Requires libopencv-video3.2 ? OK. It finally installed without explicitly installing libopencv-video3.* using

sudo apt-get install libopencv-video-dev

after I added universe repositary using:

sudo add-apt-repository universe

After that all my cpp files stopped working complaining about conflict between opencv_highgui 3.4 and 3/2 versions. Perhaps this is because on the link you provided it was libopencv-video-dev_3.2.0 while I needed libopencv-video-dev_3.4.10 ?

andrei186 gravatar imageandrei186 ( 2020-04-25 08:14:42 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-04-23 12:08:41 -0600

Seen: 586 times

Last updated: Apr 23 '20