C++/Java code embedding?

I was wondering if it’s possible to write some C++ code for the robot, and then interface with it through Java. I’d like to know because it seems to me that WPILibJ’s NIVision class is pitifully lacking (no edge detection, no convex hull, etc.) and I’d like to be able to use some of its functionality in custom code. Even if interacting with NIVision through the C++ code would be impractical or impossible, it would be equally good if I could write my own custom algorithms that would be either extremely clunky to write in Java (2 words: no pointers), or would be too slow running in a VM. I know NIVision uses JNA to bind the IMAQ functions; would it be possible to use JNA to bind my own functions as well? If so, how?

It should be possible to add new C code and call it from Java. You’d have to use workbench to create a new kernel module, made sure that the module had C bindings (if you’re using C++), install the module, get it loaded at startup, and call it from Java using JNA, just like the WPILibJ code does.

That’s a fine and interesting project, but if your goal is to call image processing functions like IMAQ provides, it would be simpler to add the JNA code to call the IMAQ function you need.

Can you go into more detail, please? How is this done?

I’m in the same boat. After some searching I found this class, which is relevant for Java users. (Thanks to Team 1203 for hosting the Javadoc online.) I haven’t had much time to look through it yet, but it looks like a bunch of useful analysis can be done with the MeasureParticle method; check out all the options in the MeasurementType class. I don’t know if the whole NIVision library is wrapped, but there’s far more material than there was last year.

This class should probably be mentioned more prominently somewhere in the documentation… or maybe I’m just bad at looking for things :).

EDIT: This is more of a response to the previous post than to the OP. Basically, it looks like a bunch of useful vision processing functions are easily accessible with Java; it’s only if you want to provide your own C code that you need to mess around with JNA.