Ask Your Question
0

Errors during compiling tutorial (feature_homography)

asked 2017-11-29 13:45:29 -0600

michlvl gravatar image

updated 2017-11-30 05:16:11 -0600

Hi,

I have issues while compiling this tutorial code: tutorial_feature_homography

I'm using OpenCV 3.3.1 and Visual Studio 2017 (Windows 7 platform).

Compiler output:

log at pastebin

How can I solve it?

Regards!

UPDATE1:

I have added opencv_flann331d.lib to Linker - Input - Additional Dependencies and its solved issues with cv::flann.

UPDATE2:

I have added opencv_features2d331d.lib (I missed that there are 2 similar libs opencv_features2d331d.lib and opencv_xfeatures2d331d.lib) to Linker - Input - Additional Dependencies and its solved some more issues.

My current list of libs in Linker:

  1. opencv_core331d.lib
  2. opencv_highgui331d.lib
  3. opencv_imgproc331d.lib
  4. opencv_imgcodecs331d.lib
  5. opencv_video331d.lib
  6. opencv_videoio331d.lib
  7. opencv_features2d331d.lib
  8. opencv_xfeatures2d331d.lib
  9. opencv_line_descriptor331d.lib
  10. opencv_flann331d.lib

Now build log looks like this:

log at pastebin

main.cpp d:\projects\video_recognition\videorecog\img_template_match01\img_template_match01\main.cpp(76): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data

d:\projects\video_recognition\videorecog\img_template_match01\img_template_match01\main.cpp(77): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data

d:\projects\video_recognition\videorecog\img_template_match01\img_template_match01\main.cpp(78): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data

d:\projects\video_recognition\videorecog\img_template_match01\img_template_match01\main.cpp(79): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data

main.obj : error LNK2019: unresolved external symbol "class cv::Mat __cdecl cv::findHomography(class cv::debug_build_guard::_InputArray const &,class cv::debug_build_guard::_InputArray const &,int,double,class cv::debug_build_guard::_OutputArray const &,int,double)" (?findHomography@cv@@YA?AVMat@1@ABV_InputArray@debug_build_guard@1@0HNABV_OutputArray@41@HN@Z) referenced in function _main

D:\Projects\video_recognition\VideoRecog\img_template_match01\Debug\img_template_match01.exe : fatal error LNK1120: 1 unresolved externals

edit retag flag offensive close merge delete

Comments

be kind to this site, and replace your screenshots with proper text version, thank you !

berak gravatar imageberak ( 2017-11-29 15:27:04 -0600 )edit

From your error log, it suggests a linker error especially with locating cv::flann. Confirm that opencv was built with opencv_contrib and the modules were probably linked

eshirima gravatar imageeshirima ( 2017-11-29 17:05:27 -0600 )edit

Hi, @berak, ok, I have replaced screen with text.

@eshirima How can I confirm what opencv biulded with contrib modules (i'm sure 99% that it have been built with them)?

Here is CMake config screen: screen

I have added opencv_flann331d.lib to Linker - Input - Additional Dependencies and its solver cv::flann issues. Also I tried to search some .lib files for cv::DescriptorMatcher , but looks like I'm going wrong way. Please, advice what else can I do? I suppose its all about linker settings...

Now, build log looks like this:

log at pastebin

michlvl gravatar imagemichlvl ( 2017-11-30 04:44:02 -0600 )edit

opencv_features2d opencv_calib3d opencv_flann opencv_xfeatures2d

if you did not build the opencv libs with opencv_contrib, you won't have xfeatures2d, in thatcase rather try this tutorial

berak gravatar imageberak ( 2017-11-30 05:00:21 -0600 )edit

Ok, have solve some others issues (see UPDATE2), there are couple more left.

michlvl gravatar imagemichlvl ( 2017-11-30 05:17:16 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2017-11-30 05:33:47 -0600

michlvl gravatar image

updated 2017-11-30 05:35:04 -0600

I solved issue, thanks @berak and @eshirima . Issue was with missing libs at Linker - Input - Additional Dependencies.

With next list of libs tutorial project have built successfully:

  1. opencv_core331d.lib
  2. opencv_highgui331d.lib
  3. opencv_imgproc331d.lib
  4. opencv_imgcodecs331d.lib
  5. opencv_video331d.lib
  6. opencv_videoio331d.lib
  7. opencv_xfeatures2d331d.lib
  8. opencv_features2d331d.lib
  9. opencv_line_descriptor331d.lib
  10. opencv_flann331d.lib
  11. opencv_calib3d331d.lib
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-11-29 13:43:21 -0600

Seen: 1,172 times

Last updated: Nov 30 '17