Ask Your Question

macropanther's profile - activity

2019-05-06 06:45:28 -0500 received badge  Popular Question (source)
2012-12-17 06:24:11 -0500 answered a question How do I use opencv.pc 2.4.1

I finally found th eanswer to this problem. Has nothing to do with open/cv. There is a reguirement that the list of ".o" files (inputs) and the output file (-o whatever) appear before any -L's or -l's in the command line of some versions of gcc/g++. In eclipse this means putting the ${flags} variable in the command template LAST instead of second and it means getting all the libraries properly identified, including pkg-config libraries, in the properties for the project.

2012-11-16 10:18:59 -0500 received badge  Editor (source)
2012-11-16 10:16:45 -0500 asked a question How do I use opencv.pc 2.4.1

Normally I would know to use

pkg-config --libs opencv

as part of my linker command (ok, properties in NetBeans). However, I can't seem to get it to work.

The symptom of it not working is a laundry list of link-time errors that looks like:

/usr/local/include/opencv2/core/core_c.h:134: undefined reference to `cvFree_'
/usr/local/include/opencv2/core/core_c.h:142: undefined reference to `cvFree_'
build/Debug/GNU-Linux-x86/_ext/602031749/usingOpenCV.o: In function `cvGetRow':
/usr/local/include/opencv2/core/core_c.h:184: undefined reference to `cvGetRows'
build/Debug/GNU-Linux-x86/_ext/602031749/usingOpenCV.o: In function `cvGetCol':
/usr/local/include/opencv2/core/core_c.h:195: undefined reference to `cvGetCols'

From what I read the opencv.pc file produced when i built opencv following these instructions, is broken or non-standard.

  1. *Is this correct? Is there a fix/patch? With instructions on how to apply it? *
  2. Does anyone have an opencv.pc file that returns the usual -l nad -L type entries rather than the list of .so's.
  3. Are there other tags i should add to this question? I am not familiar enogh with opencv to know which to select for it.


$ pkg-config --libs opencv
/usr/local/lib/ /usr/local/lib/ /usr/local
/lib/ /usr/local/lib/ /usr/local
/lib/ /usr/local/lib/ /usr/local/lib/ 
/usr/local/lib/ /usr/local/lib/ 
/usr/local/lib/ /usr/local/lib/ 
/usr/local/lib/ /usr/local/lib/ 
/usr/local/lib/ /usr/local/lib/ 
/usr/local/lib/ /usr/local/lib/

I was really expecting something that looked like -L/usr/local/lib -lopencv-core ....

I tried coding the -l's by hand in my NetBeans linker command, but that fails also. :-(

-o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/autostart -L/opt/voyant/lib -L/usr/local/lib  
-lvoyant -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu 
-lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree 
-lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_ts -lopencv_video
-lopencv_videostab `pkg-config --libs opencv`

and I tried both gcc and g++. Same errors, different progress messages.

2012-11-10 15:52:59 -0500 received badge  Supporter (source)
2012-11-09 16:47:37 -0500 asked a question Getting OpenCV project for Ubuntu 10.04 compiled on Ubuntu 12.04

I inherited a project that uses OpenCV on Ubuntu 10.04. I can compile it there with no problems. IDE = NetBeans (which is another issue...).

Now I need to move the project to Ubuntu 12.04 and an having a world of problems.

As far as I can tell, 10.04 used opencv 2.0.0 while 12.04 uses a more current 2.4.1.

Following the authore instructions, from 10.04 I did

sudo apt-get install libcv-dev ;obcvaux-dev libhighgui-dev

Tried to compile. First error was essentially

Cannot find cv.h

i tried downloading (apt-get) a bunch of opencv packages. Still can't find cv.h.

Next, I downloaded the 2.4.x source package. I compiled it the with cmake, etc. Again, no cv.h.

I went back to the old machine and copied the cv, highgui, cx*, avcodec, avformat and a bunch of other stuff from /usr/lib, and the opencv directory (as indicated by various "can't find so-n-so" errors). After add a bunch of of -I's and -l's and -L's to the NetBeans project, I finally got a complete compile but couldn't link. All the stuff was there but I couldn't manage to find the unresolved references to cvSomething() and cvSomethingElse().

Finally, I cleaned out the hand installed stuff and the apt-gotten packages and tried downloading the source for 2.0 and then compiling it two ways:

  1. using ./configure. After fixing a bunch of ptrdiff_t should be std::ptrdiff_t errors, this compiled. After make install, still no cv.h.
  2. using cmake failed make with a hundreds of errors that look like 'xxxx not defined" in cvcap_ffmpeg.cpp. (I'm not at that cmputer right now. Can post the errors later if anybody needs to see them.)

So, after a painful week, I admit defeat.

Can someone give me guidance on migrating my project from the 10.04 box to my new 12.04 box? I really don't want to have to fix gobs of the author's code if I can help it. I just can't get over the idea that compiling the old package (maybe several old packages) on the 12.04 machine ought to get it going. What am I missing?

Other stuff it uses includes: Voyant Vision and Pylon, both of which were copied over from the old box. They're in /opt. Both Ubuntus are 64-bit.