Friday, 21 June 2013

OpenCV making notes

I gave up checking out the difference between cmake and ccmake.  I just followed the instruction to do the following.

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON -D BUILD_EXAMPLES=ON ..

I thought the above make command would take 4 hours.  But it finished in a couple of minutes and return the following message.

...

CMake Warning:

  Manually-specified variables were not used by the project:

    BUILD_PYTHON_SUPPORT

-- Build files have been written to: /home/pi/fongvision/OpenCV-2.3.1/build

It appears that cmake has writtne some build files.  So should I now start the real thing build?

Lunch time.

.END


pi@raspberrypi ~/fongvision/OpenCV-2.3.1/build $ ls
cmake_opencv.sh

pi@raspberrypi ~/fongvision/OpenCV-2.3.1/build $ cat cmake_opencv.sh

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON -D BUILD_EXAMPLES=ON ..

pi@raspberrypi ~/fongvision/OpenCV-2.3.1/build $ sudo ./cmake_opencv.sh

-- The C compiler identification is GNU 4.6.3
-- The CXX compiler identification is GNU 4.6.3
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named sphinx
CUDA_TOOLKIT_ROOT_DIR not found or specified
-- Could NOT find CUDA (missing:  CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY) (Required is at least version "4.0")
-- Parsing 'cvconfig.h.cmake'
--
-- General configuration for opencv 2.3.1 =====================================
--
--     Built as dynamic libs?:     YES
--     Compiler:                   /usr/bin/c++
--     C++ flags (Release):          -Wall -pthread -ffunction-sections  -O3 -DNDEBUG  -fomit-frame-pointer -DNDEBUG
--     C++ flags (Debug):            -Wall -pthread -ffunction-sections  -g  -O0 -DDEBUG -D_DEBUG -ggdb3
--     Linker flags (Release):
--     Linker flags (Debug):
--
--   GUI:
--     GTK+ 2.x:                   YES
--     GThread:                    YES
--
--   Media I/O:
--     ZLib:                       YES
--     JPEG:                       TRUE
--     PNG:                        TRUE
--     TIFF:                       build
--     JPEG 2000:                  build
--     OpenEXR:                    NO
--     OpenNI:                     NO
--     OpenNI PrimeSensor Modules: NO
--     XIMEA:                      NO
--
--   Video I/O:
--     DC1394 1.x:                 NO
--     DC1394 2.x:                 YES
--     FFMPEG:                     NO
--       codec:                    YES
--       format:                   YES
--       util:                     YES
--       swscale:                  NO
--       gentoo-style:             YES
--     GStreamer:                  NO
--     UniCap:                     NO
--     PvAPI:                      NO
--     V4L/V4L2:                   Using libv4l
--     Xine:                       NO
--
--   Other third-party libraries:
--     Use IPP:                    NO
--     Use TBB:                    NO
--     Use ThreadingFramework:     NO
--     Use Cuda:                   NO
--     Use Eigen:                  NO
--
--   Interfaces:
--     Python:                     YES
--     Python interpreter:         /usr/bin/python -B (ver 2.7)
--     Python numpy:               YES
--     Java:                       NO
--
--   Documentation:
--     Sphinx:                     NO
--     PdfLaTeX compiler:          /usr/bin/pdflatex
--     Build Documentation:        NO
--
--   Tests and samples:
--     Tests:                      YES
--     Examples:                   YES
--
--   Install path:                 /usr/local
--
--   cvconfig.h is in:             /home/pi/fongvision/OpenCV-2.3.1/build
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done

CMake Warning:
  Manually-specified variables were not used by the project:

    BUILD_PYTHON_SUPPORT

-- Build files have been written to: /home/pi/fongvision/OpenCV-2.3.1/build

pi@raspberrypi ~/fongvision/OpenCV-2.3.1/build $ date Fri Jun 21 03:52:42 UTC 2013

.END



Raspberry Pi + OpenCV  POSTED BY MICHAEL ON JUN 14, 2012 IN RASPBERRY PI, TUTORIALS | 

http://mitchtech.net/raspberry-pi-opencv/

43 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:


“PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig

export PKG_CONFIG_PATH”

“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


Pablo FEBRUARY 25, 2013

After a few time of study, using the base of this post, I made the installation of Raspbian + openCV + libjpeg-turbo

http://cubieboard.blogspot.com.es/2013/02/raspbian-opencv-libjpeg-turbo.html


angelojoshua APRIL 16, 2013

Hi! After following the steps above, I tried to execute one of the python examples by going to
~/OpenCV-2.3.1/samples/python

some of the examples in the folder are drawing.py and squares.py

I tried to execute a sample by typing python ./drawing.py and i get an error

Traceback (most recent call last):
File “./drawing.py”, line 7, in
import cv2.cv as cv
ImportError: No module named cv2.cv
Please help me figure out this error. thanks in advance!


Pablo Aliaga Cremades JUNE 4, 2013

For sure there are a lot of IDE to work with. But for simplicity and control I use VIM, I’m to busy to learn an IDE, and I don’t want to loss the control of my code, compilation etc.

If You want to use the raspberry-pi forcomputer-vision and need to be fast, maybe is not the best machine, y use a cubieboard which is more powerfull and you can see the result here 

http://cubieboard.blogspot.com.es/2013/03/web-cam-and-cubieboard.html, and itsn’t really good.

The raspberry reproduce perfectly the videos, but it’s not the same if you have to apply for computer vision.


kate JUNE 20, 2013

Using “%make -j” will speed up the compile significantly




Raspberry Pi + OpenCV POSTED BY MICHAEL ON JUN 14, 2012

http://mitchtech.net/raspberry-pi-opencv/

...

*** Make ***

cd OpenCV-2.3.1/

mkdir build

cd build

cd ..


Next, you will need to configure the build using cmake. If you aren’t sure about what options you want/need or are unfamiliar with cmake, this line will create a standard configuration:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON -D BUILD_EXAMPLES=ON ..

Alternatively, you can configure the build using a GUI interface. This can be helpful to build with support for additional OpenCV features. To use the cmake GUI, run:

cmake-gui ..

In the cmake GUI, click ‘configure’ to pre-populate the build options. Select or remove any desired features, then click ‘configure’ again, check the output and ensure that there are not any modules that cmake cannot find. If everything looks good, click ‘generate’ to create the makefiles, then close cmake-gui.

Now we are ready to start the build! To compile, run make, then install with make install:

make


sudo make install


As you can see from the image, this will take a LONG time ... over four and a half hours to compile!




*** 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:

/usr/local/lib

Then edit the system-wide bashrc file:

sudo nano /etc/bash.bashrc

Add the following new lines to the end of the file:

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig export PKG_CONFIG_PATH



*** C Demos ***

Now that everything is installed and configured, on to the demos!  The C demos are here:

cd ~/opencv/OpenCV-2.3.1/build/bin

C demos in build/bin demos worth checking out (that don’t require a webcam):

convexhull

kmeans

drawing


*** Python demos ***

The python demos are located in samples/python:

cd ~/opencv/OpenCV-2.3.1/build/bin

These demos also don’t require a webcam:

python ./minarea.py

python ./delaunay.py

python ./drawing.py

.END

No comments:

Post a Comment