First, note that the development version of OCRopus (at mecurial.iupr.org) doesn't depend on any scripting language anymore; you can run it complete from the command line.
But in terms of scripting language interfaces, we have: - Lua bindings. These are generated with tolua++, which generates high quality interfaces between Lua and C++. However, it only works for Lua. We did Lua bindings because for one application, we needed an embeddable scripting language. - Python bindings via Lua. That is, Python calls into Lua, and then Lua calls into C++. It was simple to do, but isn't all that clean. I've started on SWIG bindings for OCRopus. There are some things that aren't so nice about SWIG, but overall SWIG has come a long way over the years, and it's now a very mature interface generator and supports lots of languages, including Lua, Python, Ruby, and Mono. The SWIG bindings can create and manipulate narrays, convert to/from strings and numerical arrays, and other libraries, and have some image processing bound to them. After I have added support for the OCRopus component model, I will make the repository public, and I hope people can start contributing bindings for functions, methods, and objects, as well as the small amount of custom code that every target language needs (exception handling, etc.). If the SWIG bindings work reasonably well, they will probably replace the current Python/Lua bridge. But we won't know how well the SWIG bindings work until we have more experience with them. Tom On Fri, May 1, 2009 at 19:54, pkt <[email protected]> wrote: > > On Apr 23, 8:43 pm, Ed Wong <[email protected]> wrote: > > Hi All, > > Hi, not an ocropus developer so this is going to be a somewhat generic > answer. > > > > > I am interested in contributing code to bind Ocropus to the Ruby > > language - just like the python binding code. However I have some > > questions: > > > > 1. Can it be done? > > Sure, ocropus is written in C++ and there are several C++ projects > with ruby bindings > these days (KDE probably the most obvious). > > > If so... > > a. How would it be done conceptually? > > You have choices: > > 1) Do all the bindings "by hand" > 2) Use a generic C++ <-> ruby bindings generator > 3) Write an ocropus-specific "framework" and a tool to autogenerate > the less important/more obvious stuff. > > The 3rd approach is what KDE uses for its plugins and what gamera (an > ocr "framework") uses for > its python bindings. It takes a bit more thought this way but > typically the result comes out more elegant > (and sometimes easier to maintain too). > > > b. Which files in the Ocropus project should I look at? > > Probably the .h files (those that expose public API) > > Btw, you can also look at how the python bindings were done. > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ocropus" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/ocropus?hl=en -~----------~----~----~----~------~----~------~--~---
