Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to generate python wrapper using gen2.py

In the OpenCV build location

opencv\sources\modules\python\src2 found gen2.py

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++

/example.cpp/

#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(! image.data )                              
   {
       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 gen2.py

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

Let me know the Possiblities ? and Results?