Ask Your Question

Revision history [back]

Python binding stitcher class

I want to genrate python binding for :

struct CV_EXPORTS ImageFeatures
{
    int img_idx;
    Size img_size;
    std::vector<KeyPoint> keypoints;
    UMat descriptors;
};

I have done :

struct CV_EXPORTS_W_SIMPLE ImageFeatures
{
    CV_PROP_RW int img_idx;
    CV_PROP_RW Size img_size;
    std::vector<KeyPoint> keypoints;
    CV_PROP_RW UMat descriptors;
    CV_WRAP std::vector<KeyPoint> getKeypoints() { return keypoints; };
};

and it works :

import numpy as cv
import cv2 as cv
finder= cv.xfeatures2d_SURF.create()
img = cv.imread('g:/lib/opencv/samples/data/baboon.jpg')
imgFea= cv.detail.computeImageFeatures2(finder,img)
x=imgFea.getKeypoints()
x[0].pt
(334.60760498046875, 54.20581817626953)

My problem is when I add CV_PROP_RW before std::vector<keypoint> keypoints; I have got a compilation error :

10>G:\Lib\opencv\modules\python\src2\cv2.cpp(24): error C2039: 'to': is not a member of 'PyOpenCV_Converter<T,void>'
10>        with
10>        [
10>            T=vector_KeyPoint
10>        ]
10>G:\Lib\opencv\modules\python\src2\cv2.cpp(24): note: see declaration of 'PyOpenCV_Converter<T,void>'
10>        with
10>        [
10>            T=vector_KeyPoint
10>        ]
10>G:\Lib\build\opencv\modules\python_bindings_generator\pyopencv_generated_types.h(72119): note: see reference to function template instantiation 'bool pyopencv_to<vector_KeyPoint>(PyObject *,T &,const char *)' being compiled
10>        with
10>        [
10>            T=vector_KeyPoint
10>        ]
10>G:\Lib\opencv\modules\python\src2\cv2.cpp(24): error C3861: 'to': identifier not found
10>Done building project "opencv_python3.vcxproj" -- FAILED.

Then i add a method to get vector<keypoints> and removed CV_WRAP_RW. Is it only way to get a c++ vector in python ?

Python binding stitcher class

I want to genrate python binding for :

struct CV_EXPORTS ImageFeatures
{
    int img_idx;
    Size img_size;
    std::vector<KeyPoint> keypoints;
    UMat descriptors;
};

I have done :

struct CV_EXPORTS_W_SIMPLE ImageFeatures
{
    CV_PROP_RW int img_idx;
    CV_PROP_RW Size img_size;
    std::vector<KeyPoint> keypoints;
    CV_PROP_RW UMat descriptors;
    CV_WRAP std::vector<KeyPoint> getKeypoints() { return keypoints; };
};

and it works :

import numpy as cv
import cv2 as cv
finder= cv.xfeatures2d_SURF.create()
img = cv.imread('g:/lib/opencv/samples/data/baboon.jpg')
imgFea= cv.detail.computeImageFeatures2(finder,img)
x=imgFea.getKeypoints()
x[0].pt
(334.60760498046875, 54.20581817626953)

My problem is when I add CV_PROP_RW before std::vector<keypoint> keypoints; I have got a compilation error :

10>G:\Lib\opencv\modules\python\src2\cv2.cpp(24): error C2039: 'to': is not a member of 'PyOpenCV_Converter<T,void>'
10>        with
10>        [
10>            T=vector_KeyPoint
10>        ]
10>G:\Lib\opencv\modules\python\src2\cv2.cpp(24): note: see declaration of 'PyOpenCV_Converter<T,void>'
10>        with
10>        [
10>            T=vector_KeyPoint
10>        ]
10>G:\Lib\build\opencv\modules\python_bindings_generator\pyopencv_generated_types.h(72119): note: see reference to function template instantiation 'bool pyopencv_to<vector_KeyPoint>(PyObject *,T &,const char *)' being compiled
10>        with
10>        [
10>            T=vector_KeyPoint
10>        ]
10>G:\Lib\opencv\modules\python\src2\cv2.cpp(24): error C3861: 'to': identifier not found
10>Done building project "opencv_python3.vcxproj" -- FAILED.

Then i add a method to get vector<keypoints> and removed CV_WRAP_RW. Is it only way to get a c++ vector in python ?

private message : @berak any idea?

Python binding stitcher class

I want to genrate generate python binding for :

struct CV_EXPORTS ImageFeatures
{
    int img_idx;
    Size img_size;
    std::vector<KeyPoint> keypoints;
    UMat descriptors;
};

I have done :

struct CV_EXPORTS_W_SIMPLE ImageFeatures
{
    CV_PROP_RW int img_idx;
    CV_PROP_RW Size img_size;
    std::vector<KeyPoint> keypoints;
    CV_PROP_RW UMat descriptors;
    CV_WRAP std::vector<KeyPoint> getKeypoints() { return keypoints; };
};

and it works :

import numpy as cv
import cv2 as cv
finder= cv.xfeatures2d_SURF.create()
img = cv.imread('g:/lib/opencv/samples/data/baboon.jpg')
imgFea= cv.detail.computeImageFeatures2(finder,img)
x=imgFea.getKeypoints()
x[0].pt
(334.60760498046875, 54.20581817626953)

My problem is when I add CV_PROP_RW before std::vector<keypoint> keypoints; I have got a compilation error :

10>G:\Lib\opencv\modules\python\src2\cv2.cpp(24): error C2039: 'to': is not a member of 'PyOpenCV_Converter<T,void>'
10>        with
10>        [
10>            T=vector_KeyPoint
10>        ]
10>G:\Lib\opencv\modules\python\src2\cv2.cpp(24): note: see declaration of 'PyOpenCV_Converter<T,void>'
10>        with
10>        [
10>            T=vector_KeyPoint
10>        ]
10>G:\Lib\build\opencv\modules\python_bindings_generator\pyopencv_generated_types.h(72119): note: see reference to function template instantiation 'bool pyopencv_to<vector_KeyPoint>(PyObject *,T &,const char *)' being compiled
10>        with
10>        [
10>            T=vector_KeyPoint
10>        ]
10>G:\Lib\opencv\modules\python\src2\cv2.cpp(24): error C3861: 'to': identifier not found
10>Done building project "opencv_python3.vcxproj" -- FAILED.

Then i add a method to get vector<keypoints> and removed CV_WRAP_RW. Is it only way to get a c++ vector in python ?

private message : @berak any idea?

Python binding stitcher class

I want to generate python binding for :

struct CV_EXPORTS ImageFeatures
{
    int img_idx;
    Size img_size;
    std::vector<KeyPoint> keypoints;
    UMat descriptors;
};

I have done :

struct CV_EXPORTS_W_SIMPLE ImageFeatures
{
    CV_PROP_RW int img_idx;
    CV_PROP_RW Size img_size;
    std::vector<KeyPoint> keypoints;
    CV_PROP_RW UMat descriptors;
    CV_WRAP std::vector<KeyPoint> getKeypoints() { return keypoints; };
};

and it works :

import numpy as cv
import cv2 as cv
finder= cv.xfeatures2d_SURF.create()
img = cv.imread('g:/lib/opencv/samples/data/baboon.jpg')
imgFea= cv.detail.computeImageFeatures2(finder,img)
x=imgFea.getKeypoints()
x[0].pt
(334.60760498046875, 54.20581817626953)

My problem is when I add CV_PROP_RW before std::vector<keypoint> keypoints; I have got a compilation error :

10>G:\Lib\opencv\modules\python\src2\cv2.cpp(24): error C2039: 'to': is not a member of 'PyOpenCV_Converter<T,void>'
10>        with
10>        [
10>            T=vector_KeyPoint
10>        ]
10>G:\Lib\opencv\modules\python\src2\cv2.cpp(24): note: see declaration of 'PyOpenCV_Converter<T,void>'
10>        with
10>        [
10>            T=vector_KeyPoint
10>        ]
10>G:\Lib\build\opencv\modules\python_bindings_generator\pyopencv_generated_types.h(72119): note: see reference to function template instantiation 'bool pyopencv_to<vector_KeyPoint>(PyObject *,T &,const char *)' being compiled
10>        with
10>        [
10>            T=vector_KeyPoint
10>        ]
10>G:\Lib\opencv\modules\python\src2\cv2.cpp(24): error C3861: 'to': identifier not found
10>Done building project "opencv_python3.vcxproj" -- FAILED.

Then i add a method to get vector<keypoints> and removed CV_WRAP_RW. Is it only way to get a value of c++ vector in python ?

private message : @berak any idea?

Python binding stitcher class

I want to generate python binding for :

struct CV_EXPORTS ImageFeatures
{
    int img_idx;
    Size img_size;
    std::vector<KeyPoint> keypoints;
    UMat descriptors;
};

I have done :

struct CV_EXPORTS_W_SIMPLE ImageFeatures
{
    CV_PROP_RW int img_idx;
    CV_PROP_RW Size img_size;
    std::vector<KeyPoint> keypoints;
    CV_PROP_RW UMat descriptors;
    CV_WRAP std::vector<KeyPoint> getKeypoints() { return keypoints; };
};

and it works :

import numpy as cv
np
import cv2 as cv
finder= cv.xfeatures2d_SURF.create()
img = cv.imread('g:/lib/opencv/samples/data/baboon.jpg')
imgFea= cv.detail.computeImageFeatures2(finder,img)
x=imgFea.getKeypoints()
x[0].pt
(334.60760498046875, 54.20581817626953)

My problem is when I add CV_PROP_RW before std::vector<keypoint> keypoints; I have got a compilation error :

10>G:\Lib\opencv\modules\python\src2\cv2.cpp(24): error C2039: 'to': is not a member of 'PyOpenCV_Converter<T,void>'
10>        with
10>        [
10>            T=vector_KeyPoint
10>        ]
10>G:\Lib\opencv\modules\python\src2\cv2.cpp(24): note: see declaration of 'PyOpenCV_Converter<T,void>'
10>        with
10>        [
10>            T=vector_KeyPoint
10>        ]
10>G:\Lib\build\opencv\modules\python_bindings_generator\pyopencv_generated_types.h(72119): note: see reference to function template instantiation 'bool pyopencv_to<vector_KeyPoint>(PyObject *,T &,const char *)' being compiled
10>        with
10>        [
10>            T=vector_KeyPoint
10>        ]
10>G:\Lib\opencv\modules\python\src2\cv2.cpp(24): error C3861: 'to': identifier not found
10>Done building project "opencv_python3.vcxproj" -- FAILED.

Then i add a method to get vector<keypoints> and removed CV_WRAP_RW. Is it only way to get value of c++ vector in python ?

private message : @berak any idea?

Python binding stitcher class

My problem is translate this C++ code in python ... I want to generate python binding for :

struct CV_EXPORTS ImageFeatures
{
    int img_idx;
    Size img_size;
    std::vector<KeyPoint> keypoints;
    UMat descriptors;
};

I have done :

struct CV_EXPORTS_W_SIMPLE ImageFeatures
{
    CV_PROP_RW int img_idx;
    CV_PROP_RW Size img_size;
    std::vector<KeyPoint> keypoints;
    CV_PROP_RW UMat descriptors;
    CV_WRAP std::vector<KeyPoint> getKeypoints() { return keypoints; };
};

and it works :

import numpy as np
import cv2 as cv
finder= cv.xfeatures2d_SURF.create()
img = cv.imread('g:/lib/opencv/samples/data/baboon.jpg')
imgFea= cv.detail.computeImageFeatures2(finder,img)
x=imgFea.getKeypoints()
x[0].pt
(334.60760498046875, 54.20581817626953)

My problem is when I add CV_PROP_RW before std::vector<keypoint> keypoints; I have got a compilation error :

10>G:\Lib\opencv\modules\python\src2\cv2.cpp(24): error C2039: 'to': is not a member of 'PyOpenCV_Converter<T,void>'
10>        with
10>        [
10>            T=vector_KeyPoint
10>        ]
10>G:\Lib\opencv\modules\python\src2\cv2.cpp(24): note: see declaration of 'PyOpenCV_Converter<T,void>'
10>        with
10>        [
10>            T=vector_KeyPoint
10>        ]
10>G:\Lib\build\opencv\modules\python_bindings_generator\pyopencv_generated_types.h(72119): note: see reference to function template instantiation 'bool pyopencv_to<vector_KeyPoint>(PyObject *,T &,const char *)' being compiled
10>        with
10>        [
10>            T=vector_KeyPoint
10>        ]
10>G:\Lib\opencv\modules\python\src2\cv2.cpp(24): error C3861: 'to': identifier not found
10>Done building project "opencv_python3.vcxproj" -- FAILED.

Then i add a method to get vector<keypoints> and removed CV_WRAP_RW. Is it only way to get value of c++ vector in python ?

private message : @berak any idea?

Python binding stitcher class

My problem is translate this C++ code in python ... I want to generate python binding for :

struct CV_EXPORTS ImageFeatures
{
    int img_idx;
    Size img_size;
    std::vector<KeyPoint> keypoints;
    UMat descriptors;
};

I have done :

struct CV_EXPORTS_W_SIMPLE ImageFeatures
{
    CV_PROP_RW int img_idx;
    CV_PROP_RW Size img_size;
    std::vector<KeyPoint> keypoints;
    CV_PROP_RW UMat descriptors;
    CV_WRAP std::vector<KeyPoint> getKeypoints() { return keypoints; };
};

and it works :

import numpy as np
import cv2 as cv
finder= cv.xfeatures2d_SURF.create()
imgListe=[]
img = cv.imread('g:/lib/opencv/samples/data/baboon.jpg')
cv.imread('f:/images/pano/pano1.jpg')
imgListe.append(img)
img = cv.imread('f:/images/pano/pano2.jpg')
imgListe.append(img)
img = cv.imread('f:/images/pano/pano3.jpg')
imgListe.append(img)
features=[]
for img in imgListe:
    imgFea= cv.detail.computeImageFeatures2(finder,img)
x=imgFea.getKeypoints()
x[0].pt
(334.60760498046875, 54.20581817626953)
    features.append(imgFea)
matcher=cv.detail.BestOf2NearestMatcher_create(False,0.3,6,6)
p=matcher.apply2(features)
indices=cv.detail.leaveBiggestComponent(features,p,0.3)

My problem is when I add CV_PROP_RW before std::vector<keypoint> keypoints; I have got a compilation error :

10>G:\Lib\opencv\modules\python\src2\cv2.cpp(24): error C2039: 'to': is not a member of 'PyOpenCV_Converter<T,void>'
10>        with
10>        [
10>            T=vector_KeyPoint
10>        ]
10>G:\Lib\opencv\modules\python\src2\cv2.cpp(24): note: see declaration of 'PyOpenCV_Converter<T,void>'
10>        with
10>        [
10>            T=vector_KeyPoint
10>        ]
10>G:\Lib\build\opencv\modules\python_bindings_generator\pyopencv_generated_types.h(72119): note: see reference to function template instantiation 'bool pyopencv_to<vector_KeyPoint>(PyObject *,T &,const char *)' being compiled
10>        with
10>        [
10>            T=vector_KeyPoint
10>        ]
10>G:\Lib\opencv\modules\python\src2\cv2.cpp(24): error C3861: 'to': identifier not found
10>Done building project "opencv_python3.vcxproj" -- FAILED.

Then i add a method to get vector<keypoints> and removed CV_WRAP_RW. Is it only way to get value of c++ vector in python ?

private message : @berak any idea?