Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #91336

Re: OpenCV with Python (cv or cv2)

Path csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <markos@c2o.pro.br>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'url:sourceforge': 0.03; 'subject:Python': 0.05; 'importerror:': 0.05; 'python)': 0.05; 'source.': 0.05; 'sys': 0.05; 'linker': 0.07; 'skip:/ 10': 0.07; 'api': 0.09; '/usr/local': 0.09; 'c/c++': 0.09; 'creighton': 0.09; 'format:': 0.09; 'python:': 0.09; 'cc:addr:python-list': 0.10; 'python': 0.11; 'python.': 0.11; 'url:)': 0.14; 'suggest': 0.15; 'output': 0.15; "skip:' 30": 0.15; '(output': 0.16; 'amd': 0.16; 'attention,': 0.16; 'cmake': 0.16; 'compile,': 0.16; 'concurrency': 0.16; 'configuring': 0.16; 'cxx': 0.16; 'examples:': 0.16; 'headers,': 0.16; 'headers:': 0.16; 'numpy': 0.16; 'packages:': 0.16; 'path:': 0.16; 'received:gateway01.websitewelcome.com': 0.16; 'sys.path': 0.16; 'unavailable:': 0.16; 'url:debian': 0.16; 'url:packages': 0.16; 'wrote:': 0.16; 'later': 0.16; 'compilation': 0.18; 'laura': 0.18; 'skip:l 30': 0.18; '(in': 0.18; 'tests': 0.18; 'thanks,': 0.19; '>>>': 0.20; 'load': 0.20; '(not': 0.20; 'library': 0.20; 'versions': 0.20; 'changes': 0.20; 'cc:2**0': 0.21; 'cc:addr:python.org': 0.21; 'trying': 0.22; 'java': 0.22; '"",': 0.22; 'disabled': 0.22; "skip:' 40": 0.22; 'suppose': 0.22; 'cc:no real name:2**0': 0.23; '2015': 0.23; 'module': 0.23; 'third- party': 0.23; "haven't": 0.24; 'tried': 0.24; 'import': 0.24; 'header:In-Reply-To:1': 0.24; '(most': 0.24; 'written': 0.24; 'install': 0.25; 'example': 0.25; 'header:User-Agent:1': 0.26; 'installed': 0.26; 'error': 0.27; 'module.': 0.27; 'skip:( 20': 0.28; 'fine': 0.29; 'complain': 0.29; 'occurred': 0.29; "skip:' 50": 0.29; 'skip:/ 40': 0.29; 'skip:m 60': 0.29; 'tutorial': 0.29; 'print': 0.31; 'url:mailman': 0.31; 'code': 0.31; 'core': 0.32; 'you?': 0.32; 'post': 0.32; 'probably': 0.32; 'url:python': 0.33; 'flags': 0.33; 'legacy': 0.33; 'right?': 0.33; 'skip:/ 20': 0.33; 'traceback': 0.33; 'version:': 0.33; 'running': 0.34; 'file': 0.34; 'message.': 0.34; 'needed': 0.34; 'skip:c 30': 0.35; 'url:listinfo': 0.35; 'could': 0.35; 'done': 0.35; 'skip:. 20': 0.35; 'but': 0.36; 'being': 0.36; 'too': 0.36; 'url:org': 0.36; 'thanks': 0.36; 'modules': 0.36; 'url:2012': 0.36; 'url:source': 0.36; 'hi,': 0.37; "didn't": 0.37; 'subject:: ': 0.37; 'skip:i 20': 0.37; 'thought': 0.37; 'missing': 0.37; "skip:' 20": 0.37; 'tue,': 0.38; 'version': 0.38; 'building': 0.38; 'world': 0.64; 'between': 0.65; '>>>>>': 0.66; 'differences': 0.66; 'received:br': 0.66; 'reuse': 0.66; 'media': 0.67; 'url:4': 0.70; 'url:11': 0.72; 'photo': 0.79; '(import': 0.84; 'apt-get': 0.84; 'precompiled': 0.84; 'python-dev': 0.84; 'samples:': 0.84; 'skip:/ 30': 0.84; 'skip:~ 60': 0.84; 'url:zip': 0.84; 'video:': 0.84; 'edition': 0.86; 'received:com.br': 0.91; 'support:': 0.91; 'package:': 0.93
Date Wed, 27 May 2015 19:56:03 -0300
From Markos <markos@c2o.pro.br>
User-Agent Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20121216 Icedove/3.0.11
MIME-Version 1.0
To Laura Creighton <lac@openend.se>
CC python-list@python.org
Subject Re: OpenCV with Python (cv or cv2)
References <5564740E.3090206@c2o.pro.br> <201505261421.t4QELBUd015477@fido.openend.se>
In-Reply-To <201505261421.t4QELBUd015477@fido.openend.se>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - br78.hostgator.com.br
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - c2o.pro.br
X-BWhitelist no
X-Source-IP 179.170.1.61
X-Exim-ID 1YxkBq-0007yI-1E
X-Source
X-Source-Args
X-Source-Dir
X-Source-Sender ([192.168.1.6]) [179.170.1.61]:43853
X-Source-Auth markos@c2o.pro.br
X-Email-Count 2
X-Source-Cap YzJvcHI4NTY7YzJvcHI4NTY7YnI3OC5ob3N0Z2F0b3IuY29tLmJy
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.110.1432770074.5151.python-list@python.org> (permalink)
Lines 253
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1432770074 news.xs4all.nl 2839 [2001:888:2000:d::a6]:49647
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:91336

Show key headers only | View raw


Hi Laura,

On 26-05-2015 11:21, Laura Creighton wrote:
> In a message of Tue, 26 May 2015 10:24:30 -0300, Markos writes:
>    
>> Hi,
>>
>> I want to use OpenCV with Python.
>>
>> I installed version 2.4.9
>> (http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.9/opencv-2.4.9.zip/)
>> in debian Squeeze running Python 2.6.6. Using the tutorial:
>> http://indranilsinharoy.com/2012/11/01/installing-opencv-on-linux/
>>
>> (I tried to install versions 2.4.11 and 2.4.10 (in Squeeze with python
>> 2.2.6) but I couldn't.)
>>      
> You mean python 2.6.6, right?
> and this package: https://packages.debian.org/source/squeeze/opencv
> which is 2.1.0-3 is too old for you?
>
>    

I installed this package (python-opencv) but I thought this package 
would be only some API for python to use the opencv library and I 
imagined that I would still have to install the opencv library from source.

> What do you mean that you
> tried to install versions 2.4.11 and 2.4.10 but couldn't?  What
> error messages did you get?
>
>    
For example when trying to install the 2.4.11 version after running cmake:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D 
WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D 
INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON 
-D WITH_QT=ON -D WITH_OPENGL=ON ..

(Output of cmake at the end of message.)

and make -j2 to compile, but an error occurred after compiling 55%:

[ 55%] Building CXX object 
modules/legacy/CMakeFiles/opencv_legacy.dir/src/facedetection.cpp.o
Linking CXX shared library ../../lib/libopencv_legacy.so
[ 55%] Built target opencv_legacy
make: ** [all] Erro 2

>> I lost some time trying to load the module cv2:
>>
>>      
>>>>> Import cv2.cv the cv
>>>>>            
> s/the/as/ ?
>    

import cv2.cv as cv


>
>    
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in<module>>
>> ImportError: No module named cv2.cv
>>
>> After a while I realized I could use the cv module. (import cv)
>>
>> But still I do not understand the differences between the modules cv and
>> cv2.
>>
>> Do you suggest any good tutorial about the differences between cv and cv2?
>>
>> I will have to make many changes in python programs using cv to reuse
>> the code later with cv2?
>>
>> Thanks,
>> Markos
>> -- 
>> https://mail.python.org/mailman/listinfo/python-list
>>      
> post the output you got from cmake
>    

At the end of message.

> It will probably complain that it is missing some headers, so couldn't
> make libcv2.so
>
> If you haven't installed python-dev (not just python) and numpy I
> guarantee it will not find needed headers; if you have but it is
> still not being made we will have to look harder at what is going wrong.
>
>    
I installed the following packages:

apt-get install cmake
apt-get install build-essential
apt-get install pkg-config
apt-get install libgtk2.0-dev
apt-get install python-opencv python-dev python-numpy
apt-get install libpng12-0 libpng12-dev libpng++-dev libpng3 libpnglite-dev libpngwriter0-dev libpngwriter0c2 zlib1g-dbg
zlib1g zlib1g-dev pngtools libjasper-dev libjasper-runtime libjasper1 libjpeg8 libjpeg8-dbg libjpeg62 libjpeg62-dev 

libjpeg-progs libtiff4-dev libtiff4 libtiffxx0c2 libtiff-tools ffmpeg libavcodec-dev libavcodec52 libavformat52 

libavformat-dev libswscale0 libswscale-dev openexr libopenexr6 libopenexr-dev

apt-get install libgstreamer0.10-0-dbg libgstreamer0.10-0 libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev 

libxine1-ffmpeg libxine-dev libxine1-bin libunicap2 libunicap2-dev libucil2 libucil2-dev libdc1394-22-dev 

libdc1394-22 libdc1394-utils libv4l-0 libv4l-dev
apt-get install libqt4-dev

> If it made a libcv.so for you, did it put it in a place you can see
> with your PYTHONPATH?
>
> Laura
>
>
>    
 >>> import sys
 >>> print sys.path
['', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', 
'/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', 
'/usr/lib/python2.6/lib-dynload', 
'/usr/local/lib/python2.6/dist-packages', 
'/usr/lib/python2.6/dist-packages', 
'/usr/lib/python2.6/dist-packages/PIL', 
'/usr/lib/python2.6/dist-packages/gst-0.10', 
'/usr/lib/pymodules/python2.6', '/usr/lib/pymodules/python2.6/gtk-2.0', 
'/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode']

import cv works fine but I didn't find libcv.so in my system.

I suppose that cv had already been installed by the package 
python-opencv, and the compilation of the opencv didn't install cv2.

Thanks for your attention,
Markos


Return of cmake
--     Linker flags (Release):
--     Linker flags (Debug):
--     Precompiled headers:         YES
-- 
--   OpenCV modules:
--     To be built:                 core flann imgproc highgui 
features2d calib3d ml video legacy objdetect photo gpu ocl nonfree 
contrib stitching superres ts videostab
--     Disabled:                    world
--     Disabled by dependency:      -
--     Unavailable:                 androidcamera dynamicuda java python viz
-- 
--   GUI:
--     QT 4.x:                      YES (ver 4.6.3 EDITION = OpenSource)
--     QT OpenGL support:           YES (/usr/lib/libQtOpenGL.so)
--     OpenGL support:              YES (/usr/lib/libGLU.so 
/usr/lib/libGL.so /usr/lib/libSM.so /usr/lib/libICE.so 
/usr/lib/libX11.so /usr/lib/libXext.so)
--     VTK support:                 NO
-- 
--   Media I/O:
--     ZLib:                        /usr/lib/libz.so (ver 1.2.3.4)
--     JPEG:                        /usr/lib/libjpeg.so (ver 62)
--     PNG:                         /usr/lib/libpng.so (ver 1.2.44)
--     TIFF:                        /usr/lib/libtiff.so (ver 42 - 3.9.4)
--     JPEG 2000:                   /usr/lib/libjasper.so (ver 1.900.1)
--     OpenEXR:                     /usr/lib/libImath.so 
/usr/lib/libIlmImf.so /usr/lib/libIex.so /usr/lib/libHalf.so 
/usr/lib/libIlmThread.so (ver 1.6.1)
-- 
--   Video I/O:
--     DC1394 1.x:                  NO
--     DC1394 2.x:                  YES (ver 2.1.2)
--     FFMPEG:                      YES
--       codec:                     YES (ver 52.123.0)
--       format:                    YES (ver 52.111.0)
--       util:                      YES (ver 50.43.0)
--       swscale:                   YES (ver 0.14.1)
--       gentoo-style:              YES
--     GStreamer:
--       base:                      YES (ver 0.10.30)
--       video:                     YES (ver 0.10.30)
--       app:                       YES (ver 0.10.30)
--       riff:                      YES (ver 0.10.30)
--       pbutils:                   YES (ver 0.10.30)
--     OpenNI:                      NO
--     OpenNI PrimeSensor Modules:  NO
--     PvAPI:                       NO
--     GigEVisionSDK:               NO
--     UniCap:                      NO
--     UniCap ucil:                 NO
--     V4L/V4L2:                    Using libv4l1 (ver 0.8.0) / libv4l2 
(ver 0.8.0)
--     XIMEA:                       NO
--     Xine:                        NO
-- 
--   Other third-party libraries:
--     Use IPP:                     NO
--     Use Eigen:                   NO
--     Use TBB:                     NO
--     Use OpenMP:                  NO
--     Use GCD                      NO
--     Use Concurrency              NO
--     Use C=:                      NO
--     Use Cuda:                    NO
--     Use OpenCL:                  YES
-- 
--   OpenCL:
--     Version:                     dynamic
--     Include path:                
~/Programacao/Python/OpenCV/opencv-2.4.11/3rdparty/include/opencl/1.2
--     Use AMD FFT:                 NO
--     Use AMD BLAS:                NO
-- 
--   Python:
--     Interpreter:                 /usr/bin/python2.6 (ver 2.6.6)
--     Libraries:                   NO
--     numpy:                       
/usr/lib/pymodules/python2.6/numpy/core/include (ver 1.4.1)
--     packages path:               lib/python2.6/dist-packages
-- 
--   Java:
--     ant:                         NO
--     JNI:                         /usr/lib/jvm/java-6-sun/include 
/usr/lib/jvm/java-6-sun/include/linux /usr/lib/jvm/java-6-sun/include
--     Java tests:                  NO
-- 
--   Documentation:
--     Build Documentation:         NO
--     Sphinx:                      NO
--     PdfLaTeX compiler:           /usr/bin/pdflatex
--     Doxygen:                     NO
-- 
--   Tests and samples:
--     Tests:                       YES
--     Performance tests:           YES
--     C/C++ Examples:              YES
-- 
--   Install path:                  /usr/local
-- 
--   cvconfig.h is in:              
~/Programacao/Python/OpenCV/opencv-2.4.11/build
-- -----------------------------------------------------------------
-- 
-- Configuring done
-- Generating done
-- Build files have been written to: 
~/Programacao/Python/OpenCV/opencv-2.4.11/build

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: OpenCV with Python (cv or cv2) Markos <markos@c2o.pro.br> - 2015-05-27 19:56 -0300

csiph-web