3.2. Improvements to the Mathematical Expression Evaluator
The field of digital image processing is essentially based on mathematical models of images and algorithms that we want to apply. G’MIC has its own mathematical expression evaluator, and this one has also seen many improvements recently. To summarize, more than 40 new mathematical functions have been implemented in this evaluator in the last two years, in order to improve its calculation capacities:
store()
, date()
, begin_t()
, end_t()
, merge()
, f2ui()
, ui2f()
, ccos()
, csin()
, ctan()
, ccosh()
, csinh()
, ctanh()
, lerp()
, maxabs()
, minabs()
, argmaxabs()
, argminabs()
, da_size()
, da_insert()
, da_push()
, da_remove()
, da_pop()
, da_back()
, isvarname()
, resize()
, fill()
, repeat()
, set()
, deg2rad()
, rad2deg()
, swap()
, vargkth()
, vargmin()
, vargmax()
, vargminabs()
, vargmaxabs()
, vavg()
, vkth()
, vmin()
, vmax()
, vminabs()
, vmaxabs()
, vmed()
, vprod()
, vstd()
, vsum()
, vvar()
, string()
.
More and more complex filters of G’MIC benefit from them. A lot of optimization work has also been done to make this evaluator more and more efficient, in particular by enabling parallel computing when possible. Rather than going into technical details about the implementation and optimization of this module, I demonstrate an example here that shows how this evaluator can be used in a G’MIC pipeline. Here, we want to produce a Buddhabrot image, a particular representation of the Mandelbrot set. Below on the left, you can see the content of the buddhabrot.gmic
file defining the buddhabrot
command, which produces the image on the right. The G’MIC mathematical expression evaluator is invoked between lines 9
and 27
, which represents then a single math expression. As we can see, this evaluator is able to compile and execute math expressions which are in fact real programs!
Fig.3.2.1. Generation of a Buddhabrot image with a G’MIC script.
The mathematical evaluator is an essential part of the G’MIC framework and will probably continue to evolve in future releases.
4. Other Notable Information
Are we done with this article? Not yet! Because working on the G’MIC project obviously means spending a lot of evenings doing research, programming and testing new features, but an important part of the time spent also concerns the management of side items, namely: answering questions on forums or github forges, finding funding to make the project move forward faster, or communicating around the project (for example by writing this kind of articles !). And on these different points, notable things have happened, since the end of 2019:
-
First, we had the privilege of having two grants (two 12-month fixed-term contracts), as part of the “Platform Support” call from the INS2I Institute of the CNRS. These financings allowed the consecutive recruitment of two development engineers to work on the G’MIC project. The first one (2018-2019), Jehan is a major contributor to GIMP. We described his contributions earlier in our [previous report]((PIXLS.US Blog - G'MIC 2.7 - Process Your Images with Style!).
-
The second engineer (2019-2020), Jonathan-David Schröder has done a lot of work on the implementation of a G’MIC binding for the Python language: https://pypi.org/project/gmic/. This binding is for the moment frozen at an earlier version (2.9.2) of G’MIC and there are still a few corrections to be made, but it is an interface that we would like to bring to the fore. Let’s hope that it will attract the interest of new external contributors, experts in Python, why not? In 2020, Jonathan-David presented the progress of his work at the Libre Graphics Meeting which took place online. His presentation is available by clicking on the following link:
In both cases, these financings were fruitful and enabled the opening of the G’MIC project to other horizons (not to mention the pleasure of interacting with these two talented engineers!).
- Another notable news concern the “communication” aspect of the project, with the development and implementation of the Virtual Artist touch table. This interactive table shows the principle of style transfer between two images. It can be helpful to introduce the general public to the field of image processing algorithms, with a direct and fun artistic application. It consists of a touch table on which runs a G’MIC script that implements both the user interface and the style transfer algorithm demonstrated. The video below illustrates the operation of this terminal (click on the image to open the link) :
Virtual Artist is an interesting way to support scientific interaction with the general public. It was used, for example, during the FÉNO 2021 (Festival of Excellence in Normandy), on the CNRS stand.
Fig.4.1. GREYC’s “Virtual Artist” touch table, in action, at FÉNO 2021.
- Additionally, let’s note that G’MIC was allowed a short video presentation during the Fête de la Science 2020, made by the communication department of the CNRS Normandie delegation. Click on the image below to see this video:
- Still on the subject of communication, we wanted to take the opportunity to announce that the project’s mascot “Gmicky” (the little tiger magician) was crocheted by Florence, from Doomyflocrochet. Florence makes nice crochet versions of free project mascots, which we invite you to see (and why not, to order).
Fig.4.1: “Gmicky”, the mascot of the G’MIC project, made of crochet.
- Finally, more generally, for those who would like to dive deeper into the programming of image processing algorithms, let’s mention the release of the book « Le traitement numérique des images en C++ » (Éd. Ellipses, 318 pages, in French), which I co-authored with my colleagues from the University of Clermont Auvergne, Vincent Barra and Christophe Tilmant, during the lockdown of 2020. You will find a presentation of CImg, the C++ image processing library (of which I am the author) and on which most of the G’MIC functionalities are based, as well as various workshops around different image processing themes and applications.
Fig.4.2. A book to deepen your knowledge of image processing algorithms, with the CImg library, on which G’MIC is based.
5. What’s Next?
Since 2008, G’MIC has been an active project, even if we never defined a very precise roadmap. The development of new functionalities is done according to our free time and opportunities, as well as the research activities in image processing that we carry out in parallel in our research team at the GREYC laboratory. We only hope that this time will not ultimately end up vanishing! Being a researcher or a teacher-researcher sometimes seems to be incompatible with an open source software development activity, which is a very demanding job and at the same time not necessarily very well valued in a career evaluation. It can therefore be tempting to focus on more “profitable” activities from a professional point of view.
On a personal note, I would like to thank the GREYC laboratory (notably the management, the management service and the DDA service), the CNRS Normandy Delegation (notably the Valorisation service, the Communication service and the HR service), the INS2I Institute of the CNRS, the LILA association, my colleague Sébastien Fourey (co-lead developer of the project), the members of the PIXLS.US association (which hosts our discussion forum as well as all the contributors to the project, the users giving kind, useful, or even financial feedbacks. All these people who believed in the project at a given time and in the ability of its developers gave us their support in one way or another. This allowed us to never give up the development of G’MIC, since 2008. May they be truly thanked!
6. Additional Resources
To properly bring this report to a close, and to satisfy the readers who are still awake and remain hungry, here is a small selection of videos to occupy the long winter evenings that will arrive soon:
-
« G’MIC for Krita - Three ways to turn a photograph into a cartoon ».
-
« G’MIC for Krita - Step by Step tutorial on how to use this amazing FREE image manipulation plugin ».
-
G’MIC presentation at Libre Graphics Meeting 2021 : « How to make 890+ Color LUTs fit in 3.3Mb ? ».
-
« Using the G’MIC Stylize filter in Krita with flat texture patterns ».
-
Final note: this report is a summary (yes, it is!) of the following detailed release notes: release notes 2.8, release notes 2.9, release notes 3.0. Thanks to Andy Kelday for his help on proof-reading this article!