Im converting this code here
int board_n = board_w * board_h;
CvPoint2D32f* corners = new CvPoint2D32f[ board_n ];
from this link http://dasl.mem.drexel.edu/~noahKuntz/openCVTut10.html
and in the code is a new operator id like to convert but i could use guidance how. first of all i looked on google and there actually doesnt appear to be a C new operator only C++ which is a little weird because the code at the above link is full of only OpenCV C functions so either there is a C new operator or the author is using C and C++ together. I was going to do foreign-alloc but at thislink about the new operator for C++ it says "Allocatescountbytes from free store. Calls the function pointer returned by std::get_new_handler on failure and repeats allocation attempts until new handler does not return or becomes a null pointer, at which time throws std::bad_alloc."
I dont really know what to make of that and that link is for C++...thus the reason for my question....any guidance is appreciated
http://docs.opencv.org/modules/core/doc/basic_structures.html
CvPoint2D32f is a C structure, so you should be able to replace new CvPoint2D32f[ board_n ]; with malloc(sizeof (CvPoint2D32f) * board_n); but new upon a struct type in C++ also initializes the contents to the appropriate zero values, so you'll need to add code to do that yourself.
Test it in the example code, and see if you can compile and run it with a C compiler.
Once you can do that, cffi should be straight-forward to use.
On Mon, Oct 28, 2013 at 5:15 PM, Joeish W joeish80829@yahoo.com wrote:
Im converting this code here
int board_n = board_w * board_h; CvPoint2D32f* corners = new CvPoint2D32f[ board_n ];
from this link http://dasl.mem.drexel.edu/~noahKuntz/openCVTut10.html and in the code is a new operator id like to convert but i could use guidance how. first of all i looked on google and there actually doesnt appear to be a C new operator only C++ which is a little weird because the code at the above link is full of only OpenCV C functions so either there is a C new operator or the author is using C and C++ together. I was going to do foreign-alloc but at this linkhttp://en.cppreference.com/w/cpp/memory/new/operator_newabout the new operator for C++ it says "Allocatescountbytes from free store. Calls the function pointer returned by std::get_new_handlerhttp://en.cppreference.com/w/cpp/memory/new/get_new_handleron failure and repeats allocation attempts until new handler does not return or becomes a null pointer, at which time throws std::bad_allochttp://en.cppreference.com/w/cpp/memory/new/bad_alloc ."
I dont really know what to make of that and that link is for C++...thus the reason for my question....any guidance is appreciated