So I configured OpenCV as below.
1. sudo nano /etc/ld.so.conf.d/opencv.conf to add the following line to the empty file.
2. sudo nano /etc/bash.bashrc to add the following 2 lines to the end of the file.
Then I tried to run the programs convexhull and kmeans. But both warning messages of not being able to open display.
3. pi@raspberrypi ~/fongvision $ cd OpenCV-2.3.1/build/bin
pi@raspberrypi ~/fongvision/OpenCV-2.3.1/build/bin $ sudo ./convexhull
This sample program demonstrates the use of the convexHull() function
(hull:2647): Gtk-WARNING **: cannot open display:
4. pi@raspberrypi ~/fongvision/OpenCV-2.3.1/build/bin $ sudo ./kmeans
(clusters:2649): Gtk-WARNING **: cannot open display:
Raspberry Pi + OpenCV POSTED BY MICHAEL ON JUN 14, 2012
*** Configure ***
Finally, we need to make a few configurations for OpenCV. First, open the opencv.conf file with the following code:
sudo nano /etc/ld.so.conf.d/opencv.conf
Add the following line at the end of the file (it may be an empty file, that is ok) and then save it:
Then edit the system-wide bashrc file:
sudo nano /etc/bash.bashrc
Add the following new lines to the end of the file:
*** Comments ***
Pete FEBRUARY 8, 2013
There is a small mistake in the step where you change the system-wide bashrc:
“PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig export PKG_CONFIG_PATH”
How it should be:
“export” needs to be on the second line otherwise you get a ton of console spam and an error from that bashrc…
mrshu MARCH 1, 2013
Also, you need to run `sudo ldconfig` after you add anything to /etc/ld.so.conf.d/opencv.conf
*** C Demos ***
Now that everything is installed and configured, on to the demos! The C demos are here:
C demos in build/bin demos worth checking out (that don’t require a webcam):
*** Python demos ***
The python demos are located in samples/python:
These demos also don’t require a webcam: