Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

... purely in C and without any wrappers, is it possible ?

No, it isnt. doing your own C wrapper might be your best bet:

// my_api.h (w/o any opencv headers)

extern "C" {
    int funny( void *there_be_pixels, int w, int h, int type );
}

// my.cpp (you'll have to compile it as c++, seperately from your other C code)

#include "opencv2/opencv.hpp"
#include "my_api.h"

int funny(void *there_be_pixels, int w, int h, int type)
{
    cv::Mat m(h,h,type,there_be_pixels);
    // do your c++ processing
}

the least thing you should try is, to use the legacy IplImage* based api.

... purely in C and without any wrappers, is it possible ?

No, it isnt. doing your own C wrapper might be your best bet:

// my_api.h (w/o any opencv headers)

extern "C" {
    int funny( void *there_be_pixels, int w, int h, int type );
}

// my.cpp (you'll have to compile it as c++, seperately from your other C code)

#include "opencv2/opencv.hpp"
#include "my_api.h"

int funny(void *there_be_pixels, int w, int h, int type)
{
    cv::Mat m(h,h,type,there_be_pixels);
m(h, w, type, (char*)there_be_pixels);
    // do your c++ processing
}

the least thing you should try is, to use the legacy IplImage* based api.

... purely in C and without any wrappers, is it possible ?

No, it isnt. doing your own C wrapper might be your best bet:

// my_api.h (w/o any opencv headers)

extern "C" {
    int funny( void *there_be_pixels, int w, int h, int type );
}

// my.cpp (you'll have to compile it as c++, seperately from your other C code)

#include "opencv2/opencv.hpp"
#include "my_api.h"

int funny(void *there_be_pixels, int w, int h, int type)
{
    cv::Mat m(h, w, type, (char*)there_be_pixels);
    // do your c++ processing
}

the what you should leastnot thing you should try is, to use the legacy IplImage* IplImage based api.api - i't s dead, does not give you a real 'watershed', also you're only writing more unwanted legecay code this way.