Ask Your Question

How to generate python wrapper using

asked 2015-04-01 10:39:50 -0500

Gopi Krishnan gravatar image

In the OpenCV build location

opencv\sources\modules\python\src2 found

Then ,try to generate python wrapper for the function "int sample(cv::Mat image,cv::Mat &out);" . It creates python object for "Mat" Datatypes in the wrappers,But can't convert python object to Mat for my called c++ source file.

Source Language - C++


#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>

using namespace cv;
using namespace std;

int sample(Mat image,Mat &out)
   cv::Mat thresh; 

    if(! )                              
       cout <<  "Could not open or find the image" << std::endl ;

  cvtColor(image, out,COLOR_BGR2GRAY);// Wait for a keystroke in the window
    return 0;

This my Method ,It is possible to genearte Python Wrapper for below function using the

int sample(cv::Mat image,cv::Mat &out);

Let me know the Possiblities ? and Results?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-04-12 20:48:17 -0500

Why not just make that a python function?

def sample(img, retImg): retImg = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) return retImg

edit flag offensive delete link more


Yes Sure!!, thanks will try it.

Gopi Krishnan gravatar imageGopi Krishnan ( 2015-04-20 02:26:09 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-04-01 10:39:50 -0500

Seen: 314 times

Last updated: Apr 01 '15