PDA

View Full Version : Using opencv after installation



Avisek003
May 14th, 2013, 09:04 PM
I installed opencv 2.4 from Ubuntu Software Centre. Now what do I need to do so that I can write programs. Do I need to set library paths for the system to find opencv, and in my program how should I include the libraries I need, like highgui

steeldriver
May 14th, 2013, 09:21 PM
I think the easiest way is to use pkg-config to expand the appropriate paths / libs on your compiler command line e.g. to compile the CannyDetector demo program from the tutorials


gcc -o CannyDetector_Demo `pkg-config --cflags opencv` CannyDetector_Demo.cpp `pkg-config --libs opencv`

If you're using a Makefile, you can can add them to CFLAGS and LIBS using


CFLAGS += $(shell pkg-config --cflags opencv)

and so on

DISCLAIMER: I'm only just starting to use OpenCV though

Avisek003
May 14th, 2013, 09:30 PM
Cool, that worked, thanks!