Opencv help needed for libcbdetect

I would love to be able to auto-detect checkerboards in images for image-calibration purposes. One way forward is to utilize (a C++ implementation of libcbdetect which is in Matlab). But I can’t figure out how to use it… Ultimately, we’d DDL it and be able to use it from Julia.

Does anyone know how to

coords = detect_coordinates(image_with_checkerboard)

with this libcbdetect?


I cannot give you a complete answer, but hopefully some tips that edges to slightly closer to a solution.

Have you looked at whether you can compile this in with OpenCV when you build it?

We have just compiled OpenCV with Julia bindings enabled following this recipe: OpenCV: Introduction to Julia OpenCV Binding

It seem when doing this that one can configure support for a variety of things in OpenCV. Perhaps it can add support for your algorithm.

If that is not a viable path, then there are a few other alternatives:

Look at using Cxx.jl or CxxWrap.jl to wrap the C++ code. With Cxx.jl you can actually call C++ functionality straight from the Julia REPL. However I don’t have enough experience with this to tell whether it will solve your problem.

What I would personally do I think would be to simply wrap what I need to access from Julia in C code. You seem to need only a few functions, so this might be viable path. C functions are easy to call from Julia. You can see an explanation here:

If you have made your own C-library exposing the functionality you want, then you can call it like this:

const glib = "libglib-2.0"
@ccall glib.g_uri_escape_string(my_uri::Cstring, ":/"::Cstring, true::Cint)::Cstring

So you would have to replace glib with whatever the name of your library is. The g_uri_escape_string must be replaced with whatever function in your library you want to call. Notice that you need to specify the types of each argument, as Julia cannot know that.