How to write Pyhton wrapper

asked 2015-03-09 10:42:57 -0600

Gopi Krishnan gravatar image

updated 2015-03-09 11:24:53 -0600

berak gravatar image

I have no idea to create a python wrapper file for my source code, Any one of the expert can provide me a solution

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

using namespace cv;
using namespace std;

int my(Mat image)
{
   cv::Mat out; 
   int z1=10;
    if(! image.data )                                          // Check for invalid input
   {
       cout <<  "Could not open or find the image" << std::endl ;  
   }
  cvtColor(image, out,COLOR_BGR2GRAY);
  imshow( "Display window", out);                   // Show our image inside it.
  waitKey(0);                                                // Wait for a keystroke in the window
    return z1;
}
edit retag flag offensive close merge delete

Comments

Why do you want to wrap this? The same functionality is available in the python commands ... I suggest you start by looking into the official python tutorials.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-03-10 05:41:58 -0600 )edit

Thanks, I am planning to have a common C++ development and would like to build a wrappers for other languages like Python, Java(Desktop/android), C#... Do you know how OpenCV automates the Wrapper Generation?

Gopi Krishnan gravatar imageGopi Krishnan ( 2015-03-31 00:56:51 -0600 )edit

Nope, maybe @berak will have a clue on how they do so, or what they are using for it.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-03-31 01:28:17 -0600 )edit