line descriptor for python doesn't work properly

asked 2015-12-24 04:10:12 -0600

RonS gravatar image

updated 2015-12-24 05:52:19 -0600

berak gravatar image

Hi, I"m a new user with opencv, and I"m trying to use it on python 2.7 (Mac OS), I used this guide to install the opencv 3 on my mac and bulid it for python: http://www.pyimagesearch.com/2015/06/... the problem is some modules doesn't work properly, for example, cv2.line_descriptor doesn't contain any functions and all I can see when I create this object is some constants for drawing, here is what the line_descriptor.py contain:

# encoding: utf-8
# module cv2.line_descriptor
# from /Users/r/.virtualenvs/cv/lib/python2.7/site-packages/cv2.so
# by generator 1.136
# no doc
# no imports

# Variables with simple values

DrawLinesMatchesFlags_DEFAULT = 0

DrawLinesMatchesFlags_DRAW_OVER_OUTIMG = 1

DrawLinesMatchesFlags_NOT_DRAW_SINGLE_LINES = 2

DRAW_LINES_MATCHES_FLAGS_DEFAULT = 0

DRAW_LINES_MATCHES_FLAGS_DRAW_OVER_OUTIMG = 1

DRAW_LINES_MATCHES_FLAGS_NOT_DRAW_SINGLE_LINES = 2

# no functions
# no classes

in addition, I there are some modules that completely uninstalled, even though the cmake show them on the modules list, such as xobjdetect and saliency. (perhaps there are more errors that I didn't find yet).

Is anyone can help me how to fix this isuue?

thanks!

edit retag flag offensive close merge delete

Comments

where do you find that weird line_descriptor.py file ?

(and no class or function from line_descriptor module is exposed to python, same for xobjdetect and saliency [though someone is working on the latter] )

so, no problem with your build, more an "expectation mismatch".

berak gravatar imageberak ( 2015-12-24 05:54:34 -0600 )edit

thanks for the quick reply, If I understood you correctly, I don't need to find the .py files, but I still can use those modules. my problem is that the python don't recognise those modules. for instance,

a = cv2.xobjdetect

gave me error: AttributeError: 'module' object has no attribute 'xobjdetect'

how can I make sure that the cmake files compiled all the modules and functions?

RonS gravatar imageRonS ( 2015-12-24 09:20:49 -0600 )edit

"how can I make sure that the cmake files compiled all the modules and functions?"

just try a >>> import cv2; help(cv2) it should give you a list like this:

Help on module cv2:

NAME
    cv2

FILE
    d:\programme\python27\lib\site-packages\cv2.pyd

SUBMODULES
    Error
    aruco
    bgsegm
    bioinspired
    datasets
    detail
    face
    fisheye
    flann
    ml
    motempl
    multicalib
    ocl
    ogl
    omnidir
    optflow
    ppf_match_3d
    rgbd
    text
    videostab
    xfeatures2d
    ximgproc
    xphoto

CLASSES
.....

and again someone is working on the saliency part

berak gravatar imageberak ( 2015-12-24 09:31:33 -0600 )edit

please also have a look here

when in doubt, check the c++ module headers for CV_EXPORTS_W , and the cmakelists.txt for WRAP python

berak gravatar imageberak ( 2015-12-24 09:39:22 -0600 )edit

out of curiosity, can you shed some light on line_descriptor.py ? where did you find it, how was it generated ?

berak gravatar imageberak ( 2015-12-24 09:42:16 -0600 )edit

I"m sorry for my confusion I never experienced with compiling cpp to python, When you said that line_descriptor not exposed to python,is that mean I can't use them in python? Or that they not written in native python code?

anyway,

I ran the help(cv2) and got:

SUBMODULES

Error

bgsegm

bioinspired

datasets

detail

face

fisheye

flann

line_descriptor

ml

motempl

ocl

ogl

optflow

ppf_match_3d

rgbd

text

videostab

xfeatures2d

ximgproc

xphoto

and specific about line_descriptor.py, I just click command+d on it and it send me to the file, which was located in folder with all the above list [from help(cv2)..] that contain the functions names in each module.

Thanks a lot.

RonS gravatar imageRonS ( 2015-12-24 11:54:02 -0600 )edit