Ask Your Question

Akanksha's profile - activity

2019-01-17 08:15:18 -0600 received badge  Popular Question (source)
2015-10-06 21:42:25 -0600 received badge  Enthusiast
2015-10-03 23:44:04 -0600 commented question How to use BOWImgDescriptorExtractor in python - openCV ?

Thank you for your inputs Berak.I tried and searched on google a fair bit to figure out the issue here but could not resolve it. So, I complied opencv3.0 and switched to it. opencv3.0 for python seems to work without any issues :)

2015-10-03 23:41:03 -0600 commented question Issue in compiling and importing opencv 3.0 in python

Thank you for your inputs :). It made me realise everything on the opencv side is fine. There was an issue in using cv2.xfeatures2d in my pydev settings in eclipse. After adding cv2 to forced builtins I was able to use cv2.xfeatures2d

2015-10-03 07:53:06 -0600 asked a question Issue in compiling and importing opencv 3.0 in python

Hi,

I am a beginner to openCV and am trying to use python-openCV 3.0 . I performed the following steps to to import and use opencv in python. I am using python 2.7 , 32-bit on windows 64-bit operating system.

  1. I downloaded the opencv source code from the official site
  2. I downloaded opencv_contrib from https://github.com/itseez/opencv_contrib
  3. I used cmake and Visual studio 2012 to generate the release binary cv2.pyd (I set options Build_shared_libs = false and opencv_extra_modules_path = path of the opencv_contrib modules.).
  4. Then I copy this cv2.pyd in my Python/Lib/site-packages folder.

Now, when I import cv2, I am able to access the usual methods of opencv but am unable to access the ones of opencv_contrib. When I type cv2.xfeatures2d , I get an import error.

Using the following lines of code :

import cv2 as cv
    for method in dir(cv):
        if callable(getattr(cv, method)):
            print method

I do not get xfeatures2d (module of opencv_contrib) printed

However, if I remove the line if callable(getattr(cv, method)) then I get xfeatures2d printed .

The output of (first few lines )of help(cv2) is as follows:

"Help on module cv2:

NAME
    cv2

FILE
    c:\python27\lib\site-packages\cv2.pyd

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

CLASSES
    exceptions.Exception(exceptions.BaseException)
        error

    class error(exceptions.Exception)
     |  Method resolution order:
     |      error
     |      exceptions.Exception
     |      exceptions.BaseException
     |      __builtin__.object
     |  
     |  Data descriptors defined here:
     |  
     |  __weakref__
     |      list of weak references to the object (if defined)
     |  
     |  ----------------------------------------------------------------------
     |  Methods inherited from exceptions.Exception:
     |  
     |  __init__(...)
     |      x.__init__(...) initializes x; see help(type(x)) for signature
     |  
     |  ----------------------------------------------------------------------
     |  Data and other attributes inherited from exceptions.Exception:
     |  
     |  __new__ = <built-in method __new__ of type object>
     |      T.__new__(S, ...) -> a new object with type S, a subtype of T
     |  
     |  ----------------------------------------------------------------------
     |  Methods inherited from exceptions.BaseException:
     |  
     |  __delattr__(...)
     |      x.__delattr__('name') <==> del x.name
     |  
     |  __getattribute__(...)
     |      x.__getattribute__('name') <==> x.name
     |  
     |  __getitem__(...)
     |      x.__getitem__(y) <==> x[y]
     |  
     |  __getslice__(...)
     |      x.__getslice__(i, j) <==> x[i:j]
     |      
     |      Use of negative indices is not supported.
     |  
     |  __reduce__(...)
     |  
     |  __repr__(...)
     |      x.__repr__() <==> repr(x)
     |  
     |  __setattr__(...)
     |      x.__setattr__('name', value) <==> x.name = value
     |  
     |  __setstate__(...)
     |  
     |  __str__(...)
     |      x.__str__() <==> str(x)
     |  
     |  __unicode__(...)
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from exceptions.BaseException:
     |  
     |  __dict__
     |  
     |  args
     |  
     |  message

FUNCTIONS
    AKAZE_create(...)
        AKAZE_create([, descriptor_type[, descriptor_size[, descriptor_channels[, threshold[, nOctaves[, nOctaveLayers[, diffusivity]]]]]]]) -> retval

    AgastFeatureDetector_create(...)
        AgastFeatureDetector_create([, threshold[, nonmaxSuppression[, type]]]) -> retval

    BFMatcher(...)
        BFMatcher([, normType[, crossCheck]]) -> <BFMatcher object>

    BOWImgDescriptorExtractor(...)
        BOWImgDescriptorExtractor(dextractor, dmatcher) -> <BOWImgDescriptorExtractor object>

    BOWKMeansTrainer(...)
        BOWKMeansTrainer(clusterCount[, termcrit[, attempts[, flags]]]) -> <BOWKMeansTrainer object>

    BRISK_create(...)
        BRISK_create([, thresh[, octaves[, patternScale]]]) -> retval  or  BRISK_create(radiusList, numberList[, dMax[, dMin[, indexChange]]]) -> retval

    CamShift(...)
        CamShift(probImage, window, criteria) -> retval, window

    Canny(...)
        Canny(image, threshold1, threshold2[, edges[, apertureSize[, L2gradient]]]) -> edges

    CascadeClassifier(...)
        CascadeClassifier([filename]) -> <CascadeClassifier object>

    CascadeClassifier_convert(...)
        CascadeClassifier_convert(oldcascade, newcascade) -> retval"

Any ideas on what I am missing or doing wrong will be very helpful.

2015-10-03 02:56:48 -0600 commented question How to use BOWImgDescriptorExtractor in python - openCV ?

The value returned by these is of the following type - <type 'cv2.SURF'> and <type 'cv2.FeatureDetector'>. I did not build the cv2.pyd but used the one already provided. I was facing issues building and using opencv3.0 in windows in python so I switched to 2.4.10 because it does not separate SIFT and SURF into opencv_contrib that require building. I even used the pre-built binaries provided at http://www.lfd.uci.edu/~gohlke/python... (2.4.12) and it gave the same error as above.

2015-10-02 02:40:01 -0600 commented question How to use BOWImgDescriptorExtractor in python - openCV ?

I tried this but I still get the same error .

2015-10-02 00:41:03 -0600 asked a question How to use BOWImgDescriptorExtractor in python - openCV ?

Hi,

I am a beginner to openCV and am trying to use python-openCV. I have version 2.4.10. In this I am trying to use the BOWImgDescriptorExtractor as follows :

extractor = cv2.BOWImgDescriptorExtractor(cv2.SURF(), cv2.BFMatcher(cv2.NORM_L2))

and am getting the following error :

extractor = cv2.BOWImgDescriptorExtractor(cv2.SURF(), cv2.BFMatcher(cv2.NORM_L2)) TypeError: Expected cv::DescriptorExtractor for argument 'dextractor'

Not sure how to resolve this since the namespace convention is not used in python.